Instantiate the parent object from its state.
(
self,
obj_type: ObjectType[T],
state: Mapping[str, Any],
)
| 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, |
no test coverage detected