(d: dict[str, Any], cls: type)
| 331 | return issubclass(cls, Type) and hasattr(cls, "__slots__") |
| 332 | |
| 333 | def _struct(d: dict[str, Any], cls: type) -> Any: |
| 334 | obj = cls(ctx) |
| 335 | hints = typing.get_type_hints(cls) |
| 336 | for slot in getattr(cls, "__slots__", ()): |
| 337 | t = hints.get(slot) |
| 338 | if t and slot in d: |
| 339 | setattr(obj, slot, conv.structure(d[slot], t)) |
| 340 | return obj |
| 341 | |
| 342 | conv.register_structure_hook_func( |
| 343 | _needs_hook, |