fqr.objects.metas.utl module¶
Metaclass module utility functions.
- parse_new_annotations(__namespace: dict[str | string[StringType], Any], __annotations: dict[string[snake_case], Any], __module: str, __slots: list[string[snake_case]], __fields: dict[string[snake_case], AnyField[lib.t.Any]], __base_fields: set[string[snake_case]]) tuple[list[string[snake_case]], dict[string[snake_case], AnyField[lib.t.Any]]] | Never¶
Parse passed
__annotationsfor validFieldsnot otherwise explicitly mapped in__namespace.Returns updated
__slotsand__fields.Passed
__namespacewill be mutated inplace, removing all key, value pairs where keys overlap with those in__annotations.Raises a corresponding exception if class definition invalid.
- parse_new_namespace(__namespace: dict[str | string[StringType], Any], __annotations: dict[string[snake_case], Any], __module: str, __slots: list[string[snake_case]], __fields: dict[string[snake_case], AnyField[lib.t.Any]]) tuple[list[str], list[string[snake_case]], dict[string[snake_case], AnyField[lib.t.Any]]] | Never¶
Parse passed
__namespacefor validFields.Returns a
list[str]of default values, as well as updated__slotsand__fields.Raises a corresponding exception if class definition invalid.
- get_enumerations_from_fields(fields: dict[string[snake_case], AnyField[lib.t.Any]]) dict[string[snake_case], tuple[bool | float | int | None | str, ...]]¶
Return dict containing all enums for object.
Automatically appends
Noneto any enums for anOptionaltype.
- get_fields_for_hash(__fields: dict[string[snake_case], AnyField[lib.t.Any]]) tuple[string[snake_case], ...]¶
Filter to set of minimum fields required to compute a unique hash for their owner object.
Fields used must be of primitive types, for these purposes:
bool | float | int | None | str.Fields ending in the following will be used [in the following order of precedence]:
'*id' | '*key''*name'
For example, for an object with fields
'id_'and'_common_name_', this function would return('id_', ), as'id_'takes precedence over'_common_name_'.If no fields are named in ways that suggest they can be used to determine the uniqueness of the object, all fields will instead be returned.
- is_public_field(f: str) bool¶
Return if field name is public.
- is_valid_keyword(f: str) bool¶
Return if field name is allowed.