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:22

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:75

Create a copy of type annotation wrapper.

Signature#

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

TypeUnion().get_children_literals#

Show source in type_union.py:107

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:85

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:122

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:138

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:94

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:69

Check if type annotation is a named type annotation.

Signature#

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

TypeUnion().is_stringified#

Show source in type_union.py:40

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:154

Whether type annotation is a TypeDef.

Signature#

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

TypeUnion().is_union#

Show source in type_union.py:171

Whether type annotation is a TypeUnion.

Signature#

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

TypeUnion().iterate_children#

Show source in type_union.py:177

Iterate over children.

Signature#

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

See also#

TypeUnion().iterate_types#

Show source in type_union.py:144

Extract type annotations from children.

Signature#

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

See also#

TypeUnion().render#

Show source in type_union.py:52

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:183

Render type annotation definition.

Signature#

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

TypeUnion().stringify#

Show source in type_union.py:46

Render Union usage as a string.

Signature#

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

TypeUnion().type_hint_annotations#

Show source in type_union.py:160

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

Signature#

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

See also#