TypeSubscript

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

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

TypeSubscript

[find in source code]

class TypeSubscript(FakeAnnotation):
    def __init__(
        parent: FakeAnnotation,
        children: Iterable[FakeAnnotation] = (),
    ) -> None:

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

Arguments

  • parent - Parent type annotation.
  • children - Children type annotations.

See also

TypeSubscript().add_child

[find in source code]

def add_child(child: FakeAnnotation) -> None:

Add new child to Substcript.

See also

TypeSubscript().copy

[find in source code]

def copy() -> 'TypeSubscript':

Create a copy of type annotation wrapper.

TypeSubscript().get_import_record

[find in source code]

def get_import_record() -> ImportRecord:

Get import record required for using type annotation.

See also

TypeSubscript().get_local_types

[find in source code]

def get_local_types() -> list[FakeAnnotation]:

Get internal types generated by builder.

See also

TypeSubscript().is_dict

[find in source code]

def is_dict() -> bool:

Whether subscript parent is Dict.

TypeSubscript().is_list

[find in source code]

def is_list() -> bool:

Whether subscript parent is List.

TypeSubscript().iterate_types

[find in source code]

def iterate_types() -> Iterator[FakeAnnotation]:

Extract type annotations from children.

See also

TypeSubscript().render

[find in source code]

def render(parent_name: str = '') -> str:

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

Returns

A string with a valid type annotation.