Skip to content

TypeTypedDict#

Mypy_boto3_builder Index / Mypy Boto3 Builder / Type Annotations / TypeTypedDict

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

TypeTypedDict#

Show source in type_typed_dict.py:79

Wrapper for typing/typing_extensions.TypedDict type annotations.

Arguments#

  • name - Type name.
  • children - Typed dict attributes.
  • docstring - Docstring for render.
  • stringify - Convert type annotation to string to avoid circular deps.

Signature#

class TypeTypedDict(FakeAnnotation, TypeDefSortable):
    def __init__(
        self,
        name: str,
        children: Iterable[TypedDictAttribute] = (),
        docstring: str = "",
        stringify: bool = False,
    ) -> None: ...

See also#

TypeTypedDict().copy#

Show source in type_typed_dict.py:220

Create a copy of type annotation wrapper.

Signature#

def __copy__(self: Self) -> Self: ...

TypeTypedDict().hash#

Show source in type_typed_dict.py:120

Calculate hash value based on name and children.

Signature#

def __hash__(self) -> int: ...

TypeTypedDict()._get_import_records#

Show source in type_typed_dict.py:153

Get import record required for using type annotation.

Signature#

def _get_import_records(self) -> set[ImportRecord]: ...

See also#

TypeTypedDict().add_attribute#

Show source in type_typed_dict.py:159

Add new attribute to a dictionary.

Arguments#

  • name - Argument name.
  • type_annotation - Argument type annotation.
  • required - Whether argument has to be set.

Signature#

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

See also#

TypeTypedDict().get_children_literals#

Show source in type_typed_dict.py:259

Extract required TypeLiteral list from attributes.

Signature#

def get_children_literals(self, processed: Iterable[str] = ()) -> set[TypeLiteral]: ...

See also#

TypeTypedDict().get_children_types#

Show source in type_typed_dict.py:237

Extract required type annotations from attributes.

Signature#

def get_children_types(self) -> set[FakeAnnotation]: ...

See also#

TypeTypedDict().get_definition_import_records#

Show source in type_typed_dict.py:144

Get import record required for using TypedDict.

Signature#

def get_definition_import_records(self) -> set[ImportRecord]: ...

See also#

TypeTypedDict().get_local_types#

Show source in type_typed_dict.py:281

Get internal types generated by builder.

Signature#

def get_local_types(self) -> list[FakeAnnotation]: ...

See also#

TypeTypedDict().get_optional#

Show source in type_typed_dict.py:210

Get a list of optional attributes.

Signature#

def get_optional(self) -> list[TypedDictAttribute]: ...

See also#

TypeTypedDict().get_required#

Show source in type_typed_dict.py:200

Get a list of required attributes.

Signature#

def get_required(self) -> list[TypedDictAttribute]: ...

See also#

TypeTypedDict().get_sort_key#

Show source in type_typed_dict.py:114

Sort Typed Dicts by name.

Signature#

def get_sort_key(self) -> str: ...

TypeTypedDict().get_sortable_children#

Show source in type_typed_dict.py:246

Extract required TypeDefSortable list from attributes.

Signature#

def get_sortable_children(self) -> list[TypeDefSortable]: ...

See also#

TypeTypedDict().has_both#

Show source in type_typed_dict.py:194

Whether TypedDict has both optional and required keys.

Signature#

def has_both(self) -> bool: ...

TypeTypedDict().has_optional#

Show source in type_typed_dict.py:182

Whether TypedDict has optional keys.

Signature#

def has_optional(self) -> bool: ...

TypeTypedDict().has_required#

Show source in type_typed_dict.py:188

Whether TypedDict has required keys.

Signature#

def has_required(self) -> bool: ...

TypeTypedDict().is_dict#

Show source in type_typed_dict.py:170

Whether type annotation is Dict or TypedDict.

Signature#

def is_dict(self) -> bool: ...

TypeTypedDict().is_same#

Show source in type_typed_dict.py:231

Check whether typed dict attributes are the same as other.

Signature#

def is_same(self: Self, other: Self) -> bool: ...

TypeTypedDict().is_stringified#

Show source in type_typed_dict.py:102

Whether TypedDict usage should be rendered as a string.

Signature#

def is_stringified(self) -> bool: ...

TypeTypedDict().is_type_def#

Show source in type_typed_dict.py:298

Whether type annotation is a TypeDef.

Signature#

def is_type_def(self) -> bool: ...

TypeTypedDict().is_typed_dict#

Show source in type_typed_dict.py:176

Whether type annotation is TypedDict.

Signature#

def is_typed_dict(self) -> bool: ...

TypeTypedDict().is_union#

Show source in type_typed_dict.py:304

Whether type annotation is a TypeUnion.

Signature#

def is_union(self) -> bool: ...

TypeTypedDict().iterate_children#

Show source in type_typed_dict.py:274

Iterate over children from required to optional.

Signature#

def iterate_children(self) -> Iterator[TypedDictAttribute]: ...

See also#

TypeTypedDict().render#

Show source in type_typed_dict.py:126

Render type annotation to a valid Python code for local usage.

Returns#

A string with a valid type annotation.

Signature#

def render(self) -> str: ...

TypeTypedDict().render_definition#

Show source in type_typed_dict.py:138

Render type annotation definition.

Signature#

def render_definition(self) -> str: ...

TypeTypedDict().stringify#

Show source in type_typed_dict.py:108

Render TypedDict usage as a string.

Signature#

def stringify(self) -> None: ...

TypeTypedDict().type_hint_annotations#

Show source in type_typed_dict.py:287

Type annotations list from arguments and return type with internal types.

Signature#

@property
def type_hint_annotations(self) -> list[FakeAnnotation]: ...

See also#

TypedDictAttribute#

Show source in type_typed_dict.py:21

TypedDict attribute wrapper.

Arguments#

  • name - Attribute name.
  • type_annotation - Attribute type annotation.
  • required - Whether the attribute has to be set.

Signature#

class TypedDictAttribute:
    def __init__(
        self, name: str, type_annotation: FakeAnnotation, required: bool
    ) -> None: ...

See also#

TypedDictAttribute().hash#

Show source in type_typed_dict.py:36

Calculate hash value based on name, required and type annotation.

Signature#

def __hash__(self) -> int: ...

TypedDictAttribute().get_type_annotation#

Show source in type_typed_dict.py:42

Get wrapped for non-required type annotation or raw type annotation.

Signature#

def get_type_annotation(self) -> FakeAnnotation: ...

See also#

TypedDictAttribute().is_required#

Show source in type_typed_dict.py:66

Whether argument is required.

Signature#

def is_required(self) -> bool: ...

TypedDictAttribute().iterate_types#

Show source in type_typed_dict.py:60

Itera over type annotations.

Signature#

def iterate_types(self) -> Iterator[FakeAnnotation]: ...

See also#

TypedDictAttribute().mark_as_required#

Show source in type_typed_dict.py:72

Mark attribute as required.

Signature#

def mark_as_required(self) -> None: ...

TypedDictAttribute().render#

Show source in type_typed_dict.py:51

Render attribute to use in class-based TypedDict definition.

Returns#

A string with argument definition.

Signature#

def render(self) -> str: ...