class TypedDictAnalyzer: (source)
Undocumented
Method | __init__ |
Undocumented |
Method | analyze_typeddict_classdef |
Analyze a class that may define a TypedDict. |
Method | analyze_typeddict_classdef_fields |
Analyze fields defined in a TypedDict class definition. |
Method | build_typeddict_typeinfo |
Undocumented |
Method | check_typeddict |
Check if a call defines a TypedDict. |
Method | fail |
Undocumented |
Method | fail_typeddict_arg |
Undocumented |
Method | is_typeddict |
Undocumented |
Method | note |
Undocumented |
Method | parse_typeddict_args |
Parse typed dict call expression. |
Method | parse_typeddict_fields_with_types |
Parse typed dict items passed as pairs (name expression, type expression). |
Instance Variable | api |
Undocumented |
Instance Variable | msg |
Undocumented |
Instance Variable | options |
Undocumented |
Undocumented
Parameters | |
options:Options | Undocumented |
api:SemanticAnalyzerInterface | Undocumented |
msg:MessageBuilder | Undocumented |
Analyze a class that may define a TypedDict.
Assume that base classes have been analyzed already.
Note: Unlike normal classes, we won't create a TypeInfo until the whole definition of the TypeDict (including the body and all key names and types) is complete. This is mostly because we store the corresponding TypedDictType in the TypeInfo.
Parameters | |
defn:ClassDef | Undocumented |
Returns | |
Tuple[ | Undocumented |
Analyze fields defined in a TypedDict class definition.
This doesn't consider inherited fields (if any). Also consider totality, if given.
Parameters | |
defn:ClassDef | Undocumented |
oldfields:Optional[ | Undocumented |
Returns | |
Tuple[ | Undocumented |
Check if a call defines a TypedDict.
The optional var_name argument is the name of the variable to which this is assigned, if any.
Return a pair (is it a typed dict, corresponding TypeInfo).
If the definition is invalid but looks like a TypedDict, report errors but return (some) TypeInfo. If some type is not ready, return (True, None).
Parameters | |
node:Expression | Undocumented |
var_name:Optional[ | Undocumented |
is_func_scope:bool | Undocumented |
Returns | |
Tuple[ | Undocumented |
Parse typed dict items passed as pairs (name expression, type expression).
Return names, types, was there an error. If some type is not ready, return None.
Parameters | |
dict_items:List[ | Undocumented |
context:Context | Undocumented |
Returns | |
Optional[ | Undocumented |