Skip to content

TypeUnion#

Mypy_boto3_builder Index / Mypy Boto3 Builder / Type Annotations / TypeUnion

Auto-generated documentation for mypy_boto3_builder.type_annotations.type_union module.

TypeUnion#

Show source in type_union.py:21

Wrapper for name Union type annotations, like MyUnion = Union[str, int].

Signature#

class TypeUnion(TypeSubscript, TypeDefSortable):
    def __init__(
        self, children: Iterable[FakeAnnotation], name: str = "", stringify: bool = False
    ) -> None: ...

See also#

TypeUnion().copy#

Show source in type_union.py:74

Create a copy of type annotation wrapper.

Signature#

def __copy__(self: Self) -> Self: ...

TypeUnion()._get_import_records#

Show source in type_union.py:131

Get import record required for using type annotation.

Signature#

def _get_import_records(self) -> set[ImportRecord]: ...

See also#

TypeUnion().get_children_literals#

Show source in type_union.py:106

Extract required TypeLiteral list from attributes.

Signature#

def get_children_literals(self, processed: Iterable[str] = ()) -> set[TypeLiteral]: ...

See also#

TypeUnion().get_children_types#

Show source in type_union.py:84

Extract required type annotations from attributes.

Signature#

def get_children_types(self) -> set[FakeAnnotation]: ...

See also#

TypeUnion().get_definition_import_records#

Show source in type_union.py:121

Get import record required for using Union.

Signature#

def get_definition_import_records(self) -> set[ImportRecord]: ...

See also#

TypeUnion().get_import_records#

Show source in type_union.py:137

Get all import records required for using type annotation.

Signature#

def get_import_records(self) -> set[ImportRecord]: ...

See also#

TypeUnion().get_sortable_children#

Show source in type_union.py:93

Extract required TypeDefSortable list from attributes.

Signature#

def get_sortable_children(self) -> list[TypeDefSortable]: ...

See also#

TypeUnion().is_named#

Show source in type_union.py:68

Check if type annotation is a named type annotation.

Signature#

def is_named(self) -> bool: ...

TypeUnion().is_stringified#

Show source in type_union.py:39

Whether Union usage should be rendered as a string.

Signature#

def is_stringified(self) -> bool: ...

TypeUnion().is_type_def#

Show source in type_union.py:153

Whether type annotation is a TypeDef.

Signature#

def is_type_def(self) -> bool: ...

TypeUnion().is_union#

Show source in type_union.py:170

Whether type annotation is a TypeUnion.

Signature#

def is_union(self) -> bool: ...

TypeUnion().iterate_children#

Show source in type_union.py:176

Iterate over children.

Signature#

def iterate_children(self) -> Iterator[FakeAnnotation]: ...

See also#

TypeUnion().iterate_types#

Show source in type_union.py:143

Extract type annotations from children.

Signature#

def iterate_types(self) -> Iterator[FakeAnnotation]: ...

See also#

TypeUnion().render#

Show source in type_union.py:51

Render type annotation to a valid Python code for local usage.

Returns#

A string with a valid type annotation.

Signature#

def render(self) -> str: ...

TypeUnion().render_definition#

Show source in type_union.py:182

Render type annotation definition.

Signature#

def render_definition(self) -> str: ...

TypeUnion().stringify#

Show source in type_union.py:45

Render Union usage as a string.

Signature#

def stringify(self) -> None: ...

TypeUnion().type_hint_annotations#

Show source in type_union.py:159

Type annotations list from arguments and return type with internal types.

Signature#

@property
def type_hint_annotations(self) -> list[FakeAnnotation]: ...

See also#