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

Method _get_parent_instance

sdk/python/src/dagger/mod/_module.py:485–510  ·  view source on GitHub ↗

Instantiate the parent object from its state.

(
        self,
        obj_type: ObjectType[T],
        state: Mapping[str, Any],
    )

Source from the content-addressed store, hash-verified

483 raise ObjectNotFoundError(msg, extra=extra) from None
484
485 async def _get_parent_instance(
486 self,
487 obj_type: ObjectType[T],
488 state: Mapping[str, Any],
489 ) -> T:
490 """Instantiate the parent object from its state."""
491 try:
492 return await self.structure(state, obj_type.cls)
493 except Exception as e:
494 log_exception_only(e, "Failed to instantiate parent object")
495 msg = transform_error(
496 e,
497 f"Failed to instantiate parent object '{obj_type}'",
498 origin=obj_type.cls,
499 typ=obj_type.cls,
500 )
501 # If API is able to make the call this is likely a bug in the SDK.
502 # For example, if the registration phase reports a type that isn't
503 # compatible with cattrs' converter.
504 msg += (
505 "\n"
506 "This could be an error in the Python SDK. "
507 "If so, please file a bug report."
508 )
509 extra = {"object_state": state}
510 raise InvalidInputError(msg, extra=extra) from e
511
512 async def _convert_inputs(
513 self,

Callers 1

get_structured_resultMethod · 0.95

Calls 4

structureMethod · 0.95
log_exception_onlyFunction · 0.90
transform_errorFunction · 0.90
InvalidInputErrorClass · 0.90

Tested by

no test coverage detected