TypeLiteral

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

Wrapper for typing/typing_extensions.Literal type annotations like Literal['a', 'b']

TypeLiteral

[find in source code]

class TypeLiteral(FakeAnnotation):
    def __init__(*children: Any) -> None:

Wrapper for typing/typing_extensions.Literal type annotations like Literal['a', 'b']

Arguments

  • children - Literal values.

See also

TypeLiteral().add_child

[find in source code]

def add_child(child: FakeAnnotation) -> None:

See also

TypeLiteral().add_literal_child

[find in source code]

def add_literal_child(child: Any) -> None:

Add new child to TypeLiteral annotation.

TypeLiteral().copy

[find in source code]

def copy() -> 'TypeLiteral':

Create a copy of type annotation wrapper.

TypeLiteral.get_import_record

[find in source code]

@staticmethod
def get_import_record() -> ImportRecord:

Get import record required for using type annotation.

See also

TypeLiteral().is_literal

[find in source code]

def is_literal() -> bool:

Whether type annotation is Literal.

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