class documentation

class TypedDictType(ProperType): (source)

View In Hierarchy

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
Property is_final Undocumented

Inherited from Type (via ProperType):

Method __repr__ Undocumented
Method can_be_false.setter Undocumented
Method can_be_false_default Undocumented
Method can_be_true.setter Undocumented
Method can_be_true_default Undocumented
Method is_singleton_type Undocumented
Instance Variable _can_be_false Undocumented
Instance Variable _can_be_true Undocumented

Inherited from Context (via ProperType, Type):

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_column Undocumented
Instance Variable end_line Undocumented
Instance Variable line Undocumented
@classmethod
def deserialize(cls, data: JsonDict) -> TypedDictType: (source)

Undocumented

def __eq__(self, other: object) -> bool: (source)

Undocumented

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

Undocumented

def __init__(self, items: dict[str, Type], required_keys: set[str], fallback: Instance, line: int = -1, column: int = -1): (source)

Undocumented

def accept(self, visitor: TypeVisitor[T]) -> T: (source)

Undocumented

def as_anonymous(self) -> TypedDictType: (source)

Undocumented

def copy_modified(self, *, fallback: Instance|None = None, item_types: list[Type]|None = None, required_keys: set[str]|None = None) -> TypedDictType: (source)

Undocumented

def create_anonymous_fallback(self) -> Instance: (source)

Undocumented

def is_anonymous(self) -> bool: (source)

Undocumented

def names_are_wider_than(self, other: TypedDictType) -> bool: (source)

Undocumented

def serialize(self) -> JsonDict: (source)

Undocumented

def zip(self, right: TypedDictType) -> Iterable[tuple[str, Type, Type]]: (source)

Undocumented

def zipall(self, right: TypedDictType) -> Iterable[tuple[str, Type|None, Type|None]]: (source)

Undocumented

__slots__: tuple[str, ...] = (source)

Undocumented

can_be_false = (source)

Undocumented

can_be_true = (source)

Undocumented

fallback = (source)

Undocumented

Undocumented

required_keys = (source)

Undocumented

Undocumented