class SemanticAnalyzerPluginInterface: (source)
Known subclasses: mypy.semanal.SemanticAnalyzer
Interface for accessing semantic analyzer functionality in plugins.
Methods docstrings contain only basic info. Look for corresponding implementation docstrings in semanal.py for more details.
# TODO: clean-up lookup functions.
| Method | add_plugin_dependency |
Specify semantic dependencies for generated methods/variables. |
| Method | add_symbol_table_node |
Add node to global symbol table (or to nearest class if there is one). |
| Method | anal_type |
Analyze an unbound type. |
| Method | class_type |
Generate type of first argument of class methods from type of self. |
| Method | defer |
Call this to defer the processing of the current node. |
| Method | fail |
Emit an error message at given location. |
| Method | lookup_fully_qualified |
Lookup a symbol by its fully qualified name. |
| Method | lookup_fully_qualified_or_none |
Lookup a symbol by its fully qualified name. |
| Method | lookup_qualified |
Lookup symbol using a name in current scope. |
| Method | named_type |
Construct an instance of a builtin type with given type arguments. |
| Method | named_type_or_none |
Construct an instance of a type with given type arguments. |
| Method | parse_bool |
Parse True/False literals. |
| Method | qualified_name |
Make qualified name using current module and enclosing class (if any). |
| Class Variable | cur_mod_id |
Undocumented |
| Class Variable | modules |
Undocumented |
| Class Variable | msg |
Undocumented |
| Class Variable | options |
Undocumented |
| Property | final_iteration |
Is this the final iteration of semantic analysis? |
| Property | is_stub_file |
Undocumented |
mypy.semanal.SemanticAnalyzerSpecify semantic dependencies for generated methods/variables.
If the symbol with full name given by trigger is found to be stale by mypy, then the body of node with full name given by target will be re-checked. By default, this is the node that is currently analyzed.
For example, the dataclass plugin adds a generated __init__ method with a signature that depends on types of attributes in ancestor classes. If any attribute in an ancestor class gets stale (modified), we need to reprocess the subclasses (and thus regenerate __init__ methods).
This is used by fine-grained incremental mode (mypy daemon). See mypy/server/deps.py for more details.
| Parameters | |
trigger:str | Undocumented |
target:Optional[ | Undocumented |
mypy.semanal.SemanticAnalyzer| Parameters | |
name:str | Undocumented |
stnode:SymbolTableNode | Undocumented |
| Returns | |
Any | Undocumented |
mypy.semanal.SemanticAnalyzerAnalyze an unbound type.
Return None if some part of the type is not ready yet. In this case the current target being analyzed will be deferred and analyzed again.
| Parameters | |
t:Type | Undocumented |
tvar_scope:Optional[ | Undocumented |
allow_tuple_literal:bool | Undocumented |
allow_unbound_tvars:bool | Undocumented |
report_invalid_types:bool | Undocumented |
third_pass:bool | Undocumented |
| Returns | |
Optional[ | Undocumented |
mypy.semanal.SemanticAnalyzerCall this to defer the processing of the current node.
This will request an additional iteration of semantic analysis.
mypy.semanal.SemanticAnalyzerLookup a symbol by its fully qualified name.
Raise an error if not found.
| Parameters | |
name:str | Undocumented |
| Returns | |
SymbolTableNode | Undocumented |
mypy.semanal.SemanticAnalyzerLookup a symbol by its fully qualified name.
Return None if not found.
| Parameters | |
name:str | Undocumented |
| Returns | |
Optional[ | Undocumented |
mypy.semanal.SemanticAnalyzerLookup symbol using a name in current scope.
This follows Python local->non-local->global->builtins rules.
| Parameters | |
name:str | Undocumented |
ctx:Context | Undocumented |
suppress_errors:bool | Undocumented |
| Returns | |
Optional[ | Undocumented |
mypy.semanal.SemanticAnalyzerConstruct an instance of a type with given type arguments.
Return None if a type could not be constructed for the qualified type name. This is possible when the qualified name includes a module name and the module has not been imported.
| Parameters | |
fullname:str | Undocumented |
args:Optional[ | Undocumented |
| Returns | |
Optional[ | Undocumented |
mypy.semanal.SemanticAnalyzer| Parameters | |
expr:Expression | Undocumented |
| Returns | |
Optional[ | Undocumented |
mypy.semanal.SemanticAnalyzer| Parameters | |
n:str | Undocumented |
| Returns | |
str | Undocumented |