nip.utils.types.get_union_elements#
- nip.utils.types.get_union_elements(tp: Any) list [source]#
Get the elements of a union type.
If the type is not a union, returns a singleton list containing the type.
- Parameters:
tp (Any) – The type, which may be a union type
- Returns:
type_list (list) – A list of types that are part of the union, or a singleton list if the type is not a union.