TypeSubscript
Auto-generated documentation for mypy_boto3_builder.type_annotations.type_subscript module.
Wrapper for subscript type annotations, like List[str]
.
- mypy-boto3-builder / Modules / Mypy Boto3 Builder / Type Annotations / TypeSubscript
TypeSubscript
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
def add_child(child: FakeAnnotation) -> None:
Add new child to Substcript.
See also
TypeSubscript().copy
def copy() -> 'TypeSubscript':
Create a copy of type annotation wrapper.
TypeSubscript().get_import_record
def get_import_record() -> ImportRecord:
Get import record required for using type annotation.
See also
TypeSubscript().get_local_types
def get_local_types() -> list[FakeAnnotation]:
Get internal types generated by builder.
See also
TypeSubscript().is_dict
def is_dict() -> bool:
Whether subscript parent is Dict.
TypeSubscript().is_list
def is_list() -> bool:
Whether subscript parent is List.
TypeSubscript().iterate_types
def iterate_types() -> Iterator[FakeAnnotation]:
Extract type annotations from children.
See also
TypeSubscript().render
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.