Unions
packtype.utils.union
get_member_type(member)
Get the type name of a member in a Packtype union.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
member
|
Base
|
The member to inspect |
required |
Returns:
Type | Description |
---|---|
str | None
|
The type name of the member if it is not a simple member, else None |
get_members(union)
Get the members of a Packtype union
Parameters:
Name | Type | Description | Default |
---|---|---|---|
union
|
Union | type[Union]
|
The Packtype union to inspect |
required |
Returns:
Type | Description |
---|---|
Iterable[tuple[str, Base]]
|
List of tuples of member name and type |
is_simple_member(member)
Check if a member in a Packtype union is a simple scalar member and does not refer to another existing type
Parameters:
Name | Type | Description | Default |
---|---|---|---|
member
|
Base
|
The member to check |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the member is a simple member, False otherwise |
is_union(ptype)
Check if a Packtype definition is a union.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ptype
|
type[Base] | Base
|
The Packtype definition to check |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the definition is a union, False otherwise |