TypeAnnotation
Auto-generated documentation for mypy_boto3_builder.type_annotations.type_annotation module.
Wrapper for typing
type annotation.
- mypy-boto3-builder / Modules / Mypy Boto3 Builder / Type Annotations / TypeAnnotation
TypeAnnotation
class TypeAnnotation(FakeAnnotation):
def __init__(wrapped_type: str) -> None:
Wrapper for typing
type annotation.
Arguments
wrapped_type
- Original type annotation as a string.
See also
TypeAnnotation().copy
def copy() -> _R:
Create a copy of type annotation wrapper.
TypeAnnotation().get_import_name
def get_import_name() -> str:
Create a safe name for imported annotation.
TypeAnnotation().get_import_record
def get_import_record() -> ImportRecord:
Create a safe Import Record for annotation.
See also
TypeAnnotation().has_fallback
def has_fallback() -> bool:
Whether type should be imported from typing_extensions
as a py37 fallback.
TypeAnnotation().is_dict
def is_dict() -> bool:
Whether annotation is a plain Dict.
TypeAnnotation().is_list
def is_list() -> bool:
Whether annotation is a plain List.
TypeAnnotation().is_union
def is_union() -> bool:
Whether annotation is a Union.
TypeAnnotation().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.