ft3.objects.utl module¶
Objects utility functions.
- ast_find_classdef(tree: AST) ClassDef¶
Get
ClassDeffrom an AST.
- get_attribute_docs(cls: metas.Meta) dict[string[snake_case], str]¶
Get class attribute docstrings.
- get_enumerations_from_fields(fields: dict[string[snake_case], AnyField[lib.t.Any]]) dict[string[snake_case], tuple[bool | int | float | None | str | string[StringType], ...]]¶
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, no fields will be returned.
- get_obj_from_type(type_: Any) type[typ.Object] | None¶
Return valid
type[Object]from a generictypeorNoneotherwise.
- is_public_field(f: str) bool¶
Return if field name is public.
- is_valid_keyword(f: str) bool¶
Return if field name is allowed.
- should_extract_attribute_docs() bool¶
Return if source-backed attribute docs should be extracted.