I think I ran into a bug with the following config:
@dataclass
class Config:
_target: Type = field(default_factory=lambda: MyClass)
class MyClass:
def __len__(self):
return 0
tyro.cli(Config)
this triggers TypeError: object of type 'type' has no len() inside
typ: TypeOrCallable, default_instance: Any
) -> TypeOrCallable:
"""TypeForm narrowing for containers. Infers types of container contents."""
if hasattr(default_instance, "__len__") and len(default_instance) == 0:
return typ
Hi,
I think I ran into a bug with the following config:
this triggers
TypeError: object of type 'type' has no len()
insideat
tyro/_resolver.py:240