morpheus.utils.type_utils
Functions
flatten_types (type_list) |
Flattens a list of types, removing any union and typing.Any types. |
get_full_qualname (klass) |
Returns the fully qualified name of a class. |
greatest_ancestor (*cls_list) |
Returns the greatest common ancestor of the classes in the class list |
is_union_type (type_) |
Returns True if the type is a typing.Union or a types.UnionType . |
pretty_print_type_name (type_) |
Determines a good label to use for a type. |
unpack_tuple () |
|
unpack_union () |
- flatten_types(type_list)[source]
Flattens a list of types, removing any union and typing.Any
types.
- get_full_qualname(klass)[source]
Returns the fully qualified name of a class.
- greatest_ancestor(*cls_list)[source]
Returns the greatest common ancestor of the classes in the class list
- is_union_type(type_)[source]
Returns True if the type is a typing.Union
or a types.UnionType
.
- pretty_print_type_name(type_)[source]
Determines a good label to use for a type. Keeps the strings shorter.
- unpack_tuple(cls_1: Type[morpheus.utils.type_utils.T]) → Tuple[Type[morpheus.utils.type_utils.T]][source]
- unpack_tuple(cls_1: Type[morpheus.utils.type_utils.T1], cls_2: Type[morpheus.utils.type_utils.T2]) → Tuple[Type[morpheus.utils.type_utils.T1], Type[morpheus.utils.type_utils.T2]]
- unpack_tuple(cls_1: Type[morpheus.utils.type_utils.T1], cls_2: Type[morpheus.utils.type_utils.T2], cls_3: Type[morpheus.utils.type_utils.T3]) → Tuple[Type[morpheus.utils.type_utils.T1], Type[morpheus.utils.type_utils.T2], Type[morpheus.utils.type_utils.T3]]
- unpack_union(cls_1: Type[morpheus.utils.type_utils.T]) → Type[morpheus.utils.type_utils.T][source]
- unpack_union(cls_1: Type[morpheus.utils.type_utils.T1], cls_2: Type[morpheus.utils.type_utils.T2]) → Union[Type[morpheus.utils.type_utils.T1], Type[morpheus.utils.type_utils.T2]]
- unpack_union(cls_1: Type[morpheus.utils.type_utils.T1], cls_2: Type[morpheus.utils.type_utils.T2], cls_3: Type[morpheus.utils.type_utils.T3]) → Union[Type[morpheus.utils.type_utils.T1], Type[morpheus.utils.type_utils.T2], Type[morpheus.utils.type_utils.T3]]