class documentation

class SemanticAnalyzerInterface(SemanticAnalyzerCoreInterface): (source)

Known subclasses: mypy.semanal.SemanticAnalyzer

View In Hierarchy

A limited abstract interface to some generic semantic analyzer pass 2 functionality.

We use this interface for various reasons:

  • Looser coupling
  • Cleaner import graph
  • Less need to pass around callback functions
Method accept Undocumented
Method add​_symbol Add symbol to the current symbol table.
Method add​_symbol​_skip​_local Add symbol to the current symbol table, skipping locals.
Method add​_symbol​_table​_node Add node to the current symbol table.
Method anal​_type Undocumented
Method basic​_new​_typeinfo Undocumented
Method current​_symbol​_table Get currently active symbol table.
Method is​_func​_scope Undocumented
Method lookup Undocumented
Method named​_type Undocumented
Method named​_type​_or​_none Undocumented
Method parse​_bool Undocumented
Method qualified​_name Undocumented
Method schedule​_patch Undocumented
Property is​_typeshed​_stub​_file Undocumented

Inherited from SemanticAnalyzerCoreInterface:

Method defer Undocumented
Method fail Undocumented
Method is​_future​_flag​_set Is the specific __future__ feature imported
Method is​_incomplete​_namespace Is a module or class namespace potentially missing some definitions?
Method lookup​_fully​_qualified Undocumented
Method lookup​_fully​_qualified​_or​_none Undocumented
Method lookup​_qualified Undocumented
Method note Undocumented
Method record​_incomplete​_ref Undocumented
Property final​_iteration Is this the final iteration of semantic analysis?
Property is​_stub​_file Undocumented
@abstractmethod
def accept(self, node): (source)

Undocumented

Parameters
node:NodeUndocumented
@abstractmethod
def add_symbol(self, name, node, context, module_public=True, module_hidden=False, can_defer=True): (source)
Add symbol to the current symbol table.
Parameters
name:strUndocumented
node:SymbolNodeUndocumented
context:ContextUndocumented
module​_public:boolUndocumented
module​_hidden:boolUndocumented
can​_defer:boolUndocumented
Returns
boolUndocumented
@abstractmethod
def add_symbol_skip_local(self, name, node): (source)

Add symbol to the current symbol table, skipping locals.

This is used to store symbol nodes in a symbol table that is going to be serialized (local namespaces are not serialized). See implementation docstring for more details.

Parameters
name:strUndocumented
node:SymbolNodeUndocumented
@abstractmethod
def add_symbol_table_node(self, name, stnode): (source)
Add node to the current symbol table.
Parameters
name:strUndocumented
stnode:SymbolTableNodeUndocumented
Returns
boolUndocumented
@abstractmethod
def anal_type(self, t, *, tvar_scope=None, allow_tuple_literal=False, allow_unbound_tvars=False, allow_required=False, report_invalid_types=True): (source)

Undocumented

Parameters
t:TypeUndocumented
tvar​_scope:Optional[TypeVarLikeScope]Undocumented
allow​_tuple​_literal:boolUndocumented
allow​_unbound​_tvars:boolUndocumented
allow​_required:boolUndocumented
report​_invalid​_types:boolUndocumented
Returns
Optional[Type]Undocumented
@abstractmethod
def basic_new_typeinfo(self, name, basetype_or_fallback, line): (source)

Undocumented

Parameters
name:strUndocumented
basetype​_or​_fallback:InstanceUndocumented
line:intUndocumented
Returns
TypeInfoUndocumented
@abstractmethod
def current_symbol_table(self): (source)

Get currently active symbol table.

May be module, class, or local namespace.

Returns
SymbolTableUndocumented
@abstractmethod
def is_func_scope(self): (source)

Undocumented

Returns
boolUndocumented
@abstractmethod
def lookup(self, name, ctx, suppress_errors=False): (source)

Undocumented

Parameters
name:strUndocumented
ctx:ContextUndocumented
suppress​_errors:boolUndocumented
Returns
Optional[SymbolTableNode]Undocumented
@abstractmethod
def named_type(self, fullname, args=None): (source)

Undocumented

Parameters
fullname:strUndocumented
args:Optional[List[Type]]Undocumented
Returns
InstanceUndocumented
@abstractmethod
def named_type_or_none(self, fullname, args=None): (source)

Undocumented

Parameters
fullname:strUndocumented
args:Optional[List[Type]]Undocumented
Returns
Optional[Instance]Undocumented
@abstractmethod
def parse_bool(self, expr): (source)

Undocumented

Parameters
expr:ExpressionUndocumented
Returns
Optional[bool]Undocumented
@abstractmethod
def qualified_name(self, n): (source)

Undocumented

Parameters
n:strUndocumented
Returns
strUndocumented
@abstractmethod
def schedule_patch(self, priority, fn): (source)

Undocumented

Parameters
priority:intUndocumented
fn:Callable[[], None]Undocumented
@property
@abstractmethod
is_typeshed_stub_file: bool = (source)

Undocumented