Utility functions
- flame_hub._base_client._get_annotated_property_names(model: type[ResourceT], sentinel: object) tuple[str, ...]
Returns the names of all properties for a given model that are annotated with a specific sentinel.
This function traverses a given
modeland all of its bases using the method resolution order. While traversing, all attributes are checked if they are annotated with asentinelobject. The names of all annotated attributes are returned as a tuple.- Parameters:
- Returns:
- flame_hub.get_field_names(model: type[ResourceT]) tuple[str, ...]
This function is a wrapper which calls
_get_annotated_property_names()withsentinelset toIsOptionalField.See also
_get_annotated_property_names(),IsOptionalField
- flame_hub.get_includable_names(model: type[ResourceT]) tuple[str, ...]
This function is a wrapper which calls
_get_annotated_property_names()withsentinelset toIsIncludable.See also
_get_annotated_property_names(),IsIncludable
- flame_hub._base_client.obtain_uuid_from(uuid_identifiable: UuidModel | UUID | str) UUID
Extract a
UUIDfrom a model containing anidproperty,UUIDobject or a string.- Raises:
ValueErrorIf
uuid_identifiableis neither an instance ofBaseModel,strnorUUID.
- flame_hub._base_client.uuid_validator(value: Any, handler: ValidatorFunctionWrapHandler) UUID
Callable for Pydantic’s wrap validator
WrapValidatorto cast resource type instances and strings toUUID.This function tries to validate
valuewithhandlerand if this raises a validation error, it tries to castvalueto a UUID withobtain_from_uuid().- Raises:
ValidationErrorIf
obtain_from_uuid()raises aValueError, the originalValidationErroris raised.