TypeLiteral
Auto-generated documentation for builder.mypy_boto3_builder.type_annotations.type_literal module.
Wrapper for typing/typing_extensions.Literal
type annotations like Literal['a', 'b']
- mypy-boto3 / Modules /
Builder
/ Mypy Boto3 Builder / Type Annotations / TypeLiteral
TypeLiteral
class TypeLiteral(FakeAnnotation):
def __init__(*children: Any) -> None:
Wrapper for typing/typing_extensions.Literal
type annotations like Literal['a', 'b']
Arguments
children
- Literal values.
TypeLiteral().add_child
def add_child(child: FakeAnnotation) -> None:
TypeLiteral().add_literal_child
def add_literal_child(child: Any) -> None:
Add new child to TypeLiteral annotation.
TypeLiteral().copy
def copy() -> 'TypeLiteral':
Create a copy of type annotation wrapper.
TypeLiteral.get_import_record
@staticmethod
def get_import_record() -> ImportRecord:
Get import record required for using type annotation.
TypeLiteral().is_literal
def is_literal() -> bool:
Whether type annotation is Literal
.
TypeLiteral().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.