Skip to content

bug: issue with repr in list types #218

@tlambert03

Description

@tlambert03

when getting repr on OME.structured_annotations

File ~/mambaforge/envs/ome-types/lib/python3.11/site-packages/rich/pretty.py:887, in traverse(_object, max_length, max_string, max_depth)
    884     node.is_namedtuple = _is_namedtuple(obj)
    885     return node
--> 887 node = _traverse(_object, root=True)
    888 return node

File ~/mambaforge/envs/ome-types/lib/python3.11/site-packages/rich/pretty.py:683, in traverse.<locals>._traverse(obj, root, depth)
    681 push_visited(obj_id)
    682 angular = getattr(obj.__rich_repr__, "angular", False)
--> 683 args = list(iter_rich_args(rich_repr_result))
    684 class_name = obj.__class__.__name__
    686 if args:

File ~/mambaforge/envs/ome-types/lib/python3.11/site-packages/rich/pretty.py:650, in traverse.<locals>._traverse.<locals>.iter_rich_args(rich_args)
    649 def iter_rich_args(rich_args: Any) -> Iterable[Union[Any, Tuple[str, Any]]]:
--> 650     for arg in rich_args:
    651         if _safe_isinstance(arg, tuple):
    652             if len(arg) == 3:

File ~/mambaforge/envs/ome-types/lib/python3.11/site-packages/pydantic/_internal/_repr.py:72, in Representation.__rich_repr__(self)
     70 def __rich_repr__(self) -> RichReprResult:
     71     """Used by Rich (https://rich.readthedocs.io/en/stable/pretty.html) to pretty print objects."""
---> 72     for name, field_repr in self.__repr_args__():
     73         if name is None:
     74             yield field_repr

File ~/dev/self/ome-types/src/ome_types/_mixins/_base_type.py:136, in OMEType.__repr_args__(self)
    134 """Repr with only set values, and truncated sequences."""
    135 args = []
--> 136 for k, v in model_dump(self, exclude_defaults=True).items():
    137     if k == "kind":
    138         continue

AttributeError: 'list' object has no attribute 'items'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions