Skip to content

TypeSubscript#

Mypy_boto3_builder Index / Mypy Boto3 Builder / Type Annotations / TypeSubscript

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

TypeSubscript#

Show source in type_subscript.py:16

Wrapper for subscript type annotations, like List[str].

Arguments#

  • parent - Parent type annotation.
  • children - Children type annotations.
  • stringify - Convert type annotation to string.

Signature#

class TypeSubscript(FakeAnnotation):
    def __init__(
        self,
        parent: FakeAnnotation,
        children: Iterable[FakeAnnotation] = (),
        stringify: bool = False,
    ) -> None: ...

See also#

TypeSubscript().copy#

Show source in type_subscript.py:91

Create a copy of type annotation wrapper.

Signature#

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

TypeSubscript().add_child#

Show source in type_subscript.py:73

Add new child to Substcript.

Signature#

def add_child(self, child: FakeAnnotation) -> None: ...

See also#

TypeSubscript().find_type_annotation_parent#

Show source in type_subscript.py:110

Check recursively if child is present in subscript.

Signature#

def find_type_annotation_parent(
    self: _R, type_annotation: FakeAnnotation
) -> _R | None: ...

See also#

TypeSubscript().get_import_records#

Show source in type_subscript.py:55

Get all import records required for using type annotation.

Signature#

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

See also#

TypeSubscript().get_local_types#

Show source in type_subscript.py:101

Get internal types generated by builder.

Signature#

def get_local_types(self) -> list[FakeAnnotation]: ...

See also#

TypeSubscript().is_dict#

Show source in type_subscript.py:79

Whether subscript parent is Dict.

Signature#

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

TypeSubscript().is_list#

Show source in type_subscript.py:85

Whether subscript parent is List.

Signature#

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

TypeSubscript().iterate_types#

Show source in type_subscript.py:65

Extract type annotations from children.

Signature#

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

See also#

TypeSubscript().render#

Show source in type_subscript.py:39

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

Returns#

A string with a valid type annotation.

Signature#

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

TypeSubscript().replace_child#

Show source in type_subscript.py:125

Replace child type annotation with a new one.

Signature#

def replace_child(self, child: FakeAnnotation, new_child: FakeAnnotation) -> Self: ...

See also#