class TypedDictType(ProperType): (source)
Type of TypedDict object {'k1': v1, ..., 'kn': vn}.
A TypedDict object is a dictionary with specific string (literal) keys. Each key has a value with a distinct type that depends on the key. TypedDict objects are normal dict objects at runtime.
A TypedDictType can be either named or anonymous. If it's anonymous, its fallback will be typing_extensions._TypedDict (Instance). _TypedDict is a subclass of Mapping[str, object] and defines all non-mapping dict methods that TypedDict supports. Some dict methods are unsafe and not supported. _TypedDict isn't defined at runtime.
If a TypedDict is named, its fallback will be an Instance of the named type (ex: "Point") whose TypeInfo has a typeddict_type that is anonymous. This is similar to how named tuples work.
TODO: The fallback structure is perhaps overly complicated.
| Class Method | deserialize |
Undocumented |
| Method | __eq__ |
Undocumented |
| Method | __hash__ |
Undocumented |
| Method | __init__ |
Undocumented |
| Method | accept |
Undocumented |
| Method | as_anonymous |
Undocumented |
| Method | copy_modified |
Undocumented |
| Method | create_anonymous_fallback |
Undocumented |
| Method | is_anonymous |
Undocumented |
| Method | names_are_wider_than |
Undocumented |
| Method | serialize |
Undocumented |
| Method | zip |
Undocumented |
| Method | zipall |
Undocumented |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | can_be_false |
Undocumented |
| Instance Variable | can_be_true |
Undocumented |
| Instance Variable | fallback |
Undocumented |
| Instance Variable | items |
Undocumented |
| Instance Variable | required_keys |
Undocumented |
Inherited from Type (via ProperType):
| Method | __repr__ |
Undocumented |
| Method | can_be_false_default |
Undocumented |
| Method | can_be_true_default |
Undocumented |
Inherited from Context (via ProperType, Type):
| Method | get_column |
Don't use. Use x.column. |
| Method | get_line |
Don't use. Use x.line. |
| Method | set_line |
If target is a node, pull line (and column) information into this node. If column is specified, this will override any column information coming from a node. |
| Instance Variable | column |
Undocumented |
| Instance Variable | end_line |
Undocumented |
| Instance Variable | line |
Undocumented |
mypy.types.Type.deserializeUndocumented
| Parameters | |
data:JsonDict | Undocumented |
| Returns | |
TypedDictType | Undocumented |
mypy.types.Type.acceptUndocumented
| Parameters | |
visitor:TypeVisitor[ | Undocumented |
| Returns | |
T | Undocumented |
Undocumented
| Parameters | |
fallback:Optional[ | Undocumented |
item_types:Optional[ | Undocumented |
required_keys:Optional[ | Undocumented |
| Returns | |
TypedDictType | Undocumented |
Undocumented
| Parameters | |
right:TypedDictType | Undocumented |
| Returns | |
Iterable[ | Undocumented |
Undocumented
| Parameters | |
right:TypedDictType | Undocumented |
| Returns | |
Iterable[ | Undocumented |