TypeAnnotation

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

Wrapper for typing type annotation.

TypeAnnotation

[find in source code]

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

[find in source code]

def copy() -> _R:

Create a copy of type annotation wrapper.

TypeAnnotation().get_import_name

[find in source code]

def get_import_name() -> str:

Create a safe name for imported annotation.

TypeAnnotation().get_import_record

[find in source code]

def get_import_record() -> ImportRecord:

Create a safe Import Record for annotation.

See also

TypeAnnotation().has_fallback

[find in source code]

def has_fallback() -> bool:

Whether type should be imported from typing_extensions as a py37 fallback.

TypeAnnotation().is_dict

[find in source code]

def is_dict() -> bool:

Whether annotation is a plain Dict.

TypeAnnotation().is_list

[find in source code]

def is_list() -> bool:

Whether annotation is a plain List.

TypeAnnotation().is_union

[find in source code]

def is_union() -> bool:

Whether annotation is a Union.

TypeAnnotation().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.