Path 1: 2 calls (0.4)

Console (1) test_cast_recursive..B (1)

False (2)

1def is_expandable(obj: Any) -> bool:
2    """Check if an object may be expanded by pretty print."""
3    return (
4        _safe_isinstance(obj, _CONTAINERS)
5        or (is_dataclass(obj))
6        or (hasattr(obj, "__rich_repr__"))
7        or _is_attr_object(obj)
8    ) and not isclass(obj)
            

Path 2: 2 calls (0.4)

Foo (1) Bar (1)

True (2)

1def is_expandable(obj: Any) -> bool:
2    """Check if an object may be expanded by pretty print."""
3    return (
4        _safe_isinstance(obj, _CONTAINERS)
5        or (is_dataclass(obj))
6        or (hasattr(obj, "__rich_repr__"))
7        or _is_attr_object(obj)
8    ) and not isclass(obj)
            

Path 3: 1 calls (0.2)

[1, 2, 3] (1)

True (1)

1def is_expandable(obj: Any) -> bool:
2    """Check if an object may be expanded by pretty print."""
3    return (
4        _safe_isinstance(obj, _CONTAINERS)
5        or (is_dataclass(obj))
6        or (hasattr(obj, "__rich_repr__"))
7        or _is_attr_object(obj)
8    ) and not isclass(obj)