TypeTypedDict

Auto-generated documentation for builder.mypy_boto3_builder.type_annotations.type_typed_dict module.

Wrapper for typing/typing_extensions.TypedDict type annotations.

TypeTypedDict

[find in source code]

class TypeTypedDict(FakeAnnotation):
    def __init__(
        name: str,
        children: Iterable[TypedDictAttribute] = (),
        docstring: str = '',
    ) -> None:

Wrapper for typing/typing_extensions.TypedDict type annotations.

Arguments

TypeTypedDict().add_attribute

[find in source code]

def add_attribute(
    name: str,
    type_annotation: FakeAnnotation,
    required: bool,
) -> None:

Add new attribute to a dictionary.

Arguments

TypeTypedDict().copy

[find in source code]

def copy() -> 'TypeTypedDict':

Create a copy of type annotation wrapper.

TypeTypedDict().get_attribute

[find in source code]

def get_attribute(name: str) -> TypedDictAttribute:

See also

TypeTypedDict().get_children_types

[find in source code]

def get_children_types() -> Set[FakeAnnotation]:

TypeTypedDict().get_import_record

[find in source code]

def get_import_record() -> ImportRecord:

Get import record required for using type annotation.

TypeTypedDict().get_optional

[find in source code]

def get_optional() -> List[TypedDictAttribute]:

TypeTypedDict().get_required

[find in source code]

def get_required() -> List[TypedDictAttribute]:

TypeTypedDict().get_types

[find in source code]

def get_types() -> Set[FakeAnnotation]:

Get set with itself.

To get child types, TypeTypedDict().get_children_types has to be used.

Returns

A set of type annotations.

TypeTypedDict().has_both

[find in source code]

def has_both() -> bool:

Whether TypedDict has both optional and required keys.

TypeTypedDict().has_optional

[find in source code]

def has_optional() -> bool:

Whether TypedDict has optional keys.

TypeTypedDict().has_required

[find in source code]

def has_required() -> bool:

Whether TypedDict has required keys.

TypeTypedDict().is_dict

[find in source code]

def is_dict() -> bool:

Always True as it is a TypedDict.

TypeTypedDict().is_same

[find in source code]

def is_same(other: 'TypeTypedDict') -> bool:

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

TypeTypedDict().render_class

[find in source code]

def render_class() -> str:

Render class-based definition for debugging.

TypedDictAttribute

[find in source code]

class TypedDictAttribute():
    def __init__(name: str, type_annotation: FakeAnnotation, required: bool):

TypedDict attribute wrapper.

Arguments

TypedDictAttribute().render

[find in source code]

def render() -> str:

Render attribute to use in class-based TypedDict definition.

Returns

A string with argument definition.