Skip to content

TypeAnnotation#

Mypy_boto3_builder Index / Mypy Boto3 Builder / Type Annotations / TypeAnnotation

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

TypeAnnotation#

Show source in type_annotation.py:14

Attributes#

  • SUPPORTED_TYPES: dict[str, ImportString] - Set of supported type annotations. value is default import module: {'Union': _typing, 'Any': _typing, 'Dict': _typing, 'List': _typing, 'Set': _typing, 'Optional': _typing, 'IO': _typing, 'overload': _typing, 'Type': _typing, 'NoReturn': _typing, 'TypedDict': _typing, 'Literal': _typing, 'Mapping': _typing, 'Sequence': _typing, 'Callable': _typing, 'Iterator': _typing, 'Awaitable': _typing, 'AsyncIterator': _typing, 'NotRequired': _typing}

  • FALLBACK: dict[str, tuple[tuple[int, int] | None, ImportString]] - Set of fallback type annotations: {'NotRequired': ((3, 12), _typing_extensions), 'TypedDict': ((3, 12), _typing_extensions), 'Literal': ((3, 12), _typing_extensions)}

Wrapper for typing type annotation.

Arguments#

  • wrapped_type - Original type annotation as a string.

Signature#

class TypeAnnotation(FakeAnnotation):
    def __init__(self, wrapped_type: str) -> None: ...

See also#

TypeAnnotation().copy#

Show source in type_annotation.py:114

Create a copy of type annotation wrapper.

Signature#

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

TypeAnnotation()._get_import_records#

Show source in type_annotation.py:76

Create a safe Import Record for annotation.

Signature#

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

See also#

TypeAnnotation().get_import_name#

Show source in type_annotation.py:70

Create a safe name for imported annotation.

Signature#

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

TypeAnnotation().is_dict#

Show source in type_annotation.py:96

Whether annotation is a plain Dict.

Signature#

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

TypeAnnotation().is_list#

Show source in type_annotation.py:102

Whether annotation is a plain List.

Signature#

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

TypeAnnotation().is_union#

Show source in type_annotation.py:108

Whether annotation is a Union.

Signature#

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

TypeAnnotation().render#

Show source in type_annotation.py:61

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

Returns#

A string with a valid type annotation.

Signature#

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