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:71

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:209

Create a copy of type annotation wrapper.

Signature#

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

TypeTypedDict()._get_import_records#

Show source in type_typed_dict.py:142

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:148

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:248

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:226

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:133

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:270

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:199

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:189

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:106

Sort Typed Dicts by name.

Signature#

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

TypeTypedDict().get_sortable_children#

Show source in type_typed_dict.py:235

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:183

Whether TypedDict has both optional and required keys.

Signature#

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

TypeTypedDict().has_optional#

Show source in type_typed_dict.py:171

Whether TypedDict has optional keys.

Signature#

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

TypeTypedDict().has_required#

Show source in type_typed_dict.py:177

Whether TypedDict has required keys.

Signature#

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

TypeTypedDict().is_dict#

Show source in type_typed_dict.py:159

Whether type annotation is Dict or TypedDict.

Signature#

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

TypeTypedDict().is_same#

Show source in type_typed_dict.py:220

Check whether typed dict attributes are the same as other.

Signature#

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

TypeTypedDict().is_stringified#

Show source in type_typed_dict.py:94

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:287

Whether type annotation is a TypeDef.

Signature#

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

TypeTypedDict().is_typed_dict#

Show source in type_typed_dict.py:165

Whether type annotation is TypedDict.

Signature#

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

TypeTypedDict().is_union#

Show source in type_typed_dict.py:293

Whether type annotation is a TypeUnion.

Signature#

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

TypeTypedDict().iterate_children#

Show source in type_typed_dict.py:263

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:115

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:127

Render type annotation definition.

Signature#

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

TypeTypedDict().stringify#

Show source in type_typed_dict.py:100

Render TypedDict usage as a string.

Signature#

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

TypeTypedDict().type_hint_annotations#

Show source in type_typed_dict.py:276

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:22

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().get_type_annotation#

Show source in type_typed_dict.py:40

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:64

Whether argument is required.

Signature#

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

TypedDictAttribute().iterate_types#

Show source in type_typed_dict.py:58

Itera over type annotations.

Signature#

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

See also#

TypedDictAttribute().render#

Show source in type_typed_dict.py:49

Render attribute to use in class-based TypedDict definition.

Returns#

A string with argument definition.

Signature#

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