Skip to content

Commit

Permalink
🚸 truncated ozi.spec repr.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjdbcm committed May 19, 2024
1 parent aca019e commit a5a3bd6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ozi/spec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
"""Specification API for OZI Metadata."""
from ozi.spec._spec import OZI
from ozi.spec._spec import Metadata
from ozi.spec._spec import Spec
from ozi.spec._spec import current_version

__all__ = (
'METADATA',
'Metadata',
'OZI',
'Spec',
'current_version',
)

Expand Down
4 changes: 4 additions & 0 deletions ozi/spec/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""Base dataclasses for OZI Metadata."""
from __future__ import annotations

import reprlib
from typing import TYPE_CHECKING
from typing import ClassVar
from typing import Protocol
Expand Down Expand Up @@ -71,5 +72,8 @@ def asdict(self: Self) -> dict[str, _VT]:
'help': str(self.__class__.__doc__).replace('\n ', ''),
}

def __repr__(self: Self) -> str:
return reprlib.repr(self)

def __len__(self: Self) -> int: # pragma: defer to python
return len(list(iter(asdict(self))))

0 comments on commit a5a3bd6

Please sign in to comment.