MCPcopy Create free account
hub / github.com/dagger/dagger / _struct

Function _struct

sdk/python/src/dagger/client/_core.py:333–340  ·  view source on GitHub ↗
(d: dict[str, Any], cls: type)

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 2

structureMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected