class documentation

class State: (source)

View In Hierarchy

The state for a module.

The source is only used for the -c command line option; in that case path is None. Otherwise source is None and path isn't.

Method __init__ Undocumented
Method add​_ancestors Undocumented
Method add​_dependency Undocumented
Method check​_blockers Raise CompileError if a blocking error is detected.
Method compute​_dependencies Compute a module's dependencies after parsing it.
Method compute​_fine​_grained​_deps Undocumented
Method dependency​_lines Undocumented
Method dependency​_priorities Undocumented
Method finish​_passes Undocumented
Method fix​_cross​_refs Undocumented
Method free​_state Undocumented
Method generate​_unused​_ignore​_notes Undocumented
Method is​_fresh Return whether the cache data for this file is fresh.
Method is​_interface​_fresh Undocumented
Method load​_fine​_grained​_deps Undocumented
Method load​_tree Undocumented
Method mark​_as​_rechecked Marks this module as having been fully re-analyzed by the type-checker.
Method mark​_interface​_stale Marks this module as having a stale public interface, and discards the cache data.
Method parse​_file Parse file and run first pass of semantic analysis.
Method parse​_inline​_configuration Check for inline mypy: options directive and parse them.
Method semantic​_analysis​_pass1 Perform pass 1 of semantic analysis, which happens immediately after parsing.
Method suppress​_dependency Undocumented
Method type​_check​_first​_pass Undocumented
Method type​_check​_second​_pass Undocumented
Method type​_checker Undocumented
Method type​_map Undocumented
Method update​_fine​_grained​_deps Undocumented
Method valid​_references Undocumented
Method verify​_dependencies Report errors for import targets in modules that don't exist.
Method wrap​_context Temporarily change the error import context to match this state.
Method write​_cache Undocumented
Class Variable data Undocumented
Class Variable fine​_grained​_deps​_loaded Undocumented
Class Variable order​_counter Undocumented
Class Variable transitive​_error Undocumented
Instance Variable abspath Undocumented
Instance Variable ancestors Undocumented
Instance Variable caller​_line Undocumented
Instance Variable caller​_state Undocumented
Instance Variable dep​_line​_map Undocumented
Instance Variable dependencies Undocumented
Instance Variable dependencies​_set Undocumented
Instance Variable early​_errors Undocumented
Instance Variable externally​_same Undocumented
Instance Variable id Undocumented
Instance Variable ignore​_all Undocumented
Instance Variable import​_context Undocumented
Instance Variable interface​_hash Undocumented
Instance Variable manager Undocumented
Instance Variable meta Undocumented
Instance Variable meta​_source​_hash Undocumented
Instance Variable options Undocumented
Instance Variable order Undocumented
Instance Variable path Undocumented
Instance Variable priorities Undocumented
Instance Variable source Undocumented
Instance Variable source​_hash Undocumented
Instance Variable suppressed Undocumented
Instance Variable suppressed​_set Undocumented
Instance Variable tree Undocumented
Instance Variable xpath Undocumented
Property xmeta Undocumented
Method _patch​_indirect​_dependencies Undocumented
Instance Variable _type​_checker Undocumented
def __init__(self, id, path, source, manager, caller_state=None, caller_line=0, ancestor_for=None, root_source=False, temporary=False): (source)

Undocumented

Parameters
id:Optional[str]Undocumented
path:Optional[str]Undocumented
source:Optional[str]Undocumented
manager:BuildManagerUndocumented
caller​_state:Optional[State]Undocumented
caller​_line:intUndocumented
ancestor​_for:Optional[State]Undocumented
root​_source:boolUndocumented
temporary:boolUndocumented
def add_ancestors(self): (source)

Undocumented

def add_dependency(self, dep): (source)

Undocumented

Parameters
dep:strUndocumented
def check_blockers(self): (source)
Raise CompileError if a blocking error is detected.
def compute_dependencies(self): (source)

Compute a module's dependencies after parsing it.

This is used when we parse a file that we didn't have up-to-date cache information for. When we have an up-to-date cache, we just use the cached info.

def compute_fine_grained_deps(self): (source)

Undocumented

Returns
Dict[str, Set[str]]Undocumented
def dependency_lines(self): (source)

Undocumented

Returns
List[int]Undocumented
def dependency_priorities(self): (source)

Undocumented

Returns
List[int]Undocumented
def finish_passes(self): (source)

Undocumented

def fix_cross_refs(self): (source)

Undocumented

def free_state(self): (source)

Undocumented

def generate_unused_ignore_notes(self): (source)

Undocumented

def is_fresh(self): (source)
Return whether the cache data for this file is fresh.
Returns
boolUndocumented
def is_interface_fresh(self): (source)

Undocumented

Returns
boolUndocumented
def load_fine_grained_deps(self): (source)

Undocumented

Returns
Dict[str, Set[str]]Undocumented
def load_tree(self, temporary=False): (source)

Undocumented

Parameters
temporary:boolUndocumented
def mark_as_rechecked(self): (source)
Marks this module as having been fully re-analyzed by the type-checker.
def mark_interface_stale(self, *, on_errors=False): (source)
Marks this module as having a stale public interface, and discards the cache data.
Parameters
on​_errors:boolUndocumented
def parse_file(self): (source)

Parse file and run first pass of semantic analysis.

Everything done here is local to the file. Don't depend on imported modules in any way. Also record module dependencies based on imports.

def parse_inline_configuration(self, source): (source)
Check for inline mypy: options directive and parse them.
Parameters
source:strUndocumented
def semantic_analysis_pass1(self): (source)

Perform pass 1 of semantic analysis, which happens immediately after parsing.

This pass can't assume that any other modules have been processed yet.

def suppress_dependency(self, dep): (source)

Undocumented

Parameters
dep:strUndocumented
def type_check_first_pass(self): (source)

Undocumented

def type_check_second_pass(self): (source)

Undocumented

Returns
boolUndocumented
def type_checker(self): (source)

Undocumented

Returns
TypeCheckerUndocumented
def type_map(self): (source)

Undocumented

Returns
Dict[Expression, Type]Undocumented
def update_fine_grained_deps(self, deps): (source)

Undocumented

Parameters
deps:Dict[str, Set[str]]Undocumented
def valid_references(self): (source)

Undocumented

Returns
Set[str]Undocumented
def verify_dependencies(self, suppressed_only=False): (source)

Report errors for import targets in modules that don't exist.

If suppressed_only is set, only check suppressed dependencies.

Parameters
suppressed​_only:boolUndocumented
@contextlib.contextmanager
def wrap_context(self, check_blockers=True): (source)

Temporarily change the error import context to match this state.

Also report an internal error if an unexpected exception was raised and raise an exception on a blocking error, unless check_blockers is False. Skipping blocking error reporting is used in the semantic analyzer so that we can report all blocking errors for a file (across multiple targets) to maintain backward compatibility.

Parameters
check​_blockers:boolUndocumented
Returns
Iterator[None]Undocumented
def write_cache(self): (source)

Undocumented

data: Optional[str] = (source)

Undocumented

fine_grained_deps_loaded: bool = (source)

Undocumented

order_counter: ClassVar[int] = (source)

Undocumented

transitive_error: bool = (source)

Undocumented

abspath = (source)

Undocumented

ancestors = (source)

Undocumented

caller_line = (source)

Undocumented

caller_state = (source)

Undocumented

dep_line_map: dict = (source)

Undocumented

dependencies: list = (source)

Undocumented

dependencies_set = (source)

Undocumented

early_errors = (source)

Undocumented

externally_same: bool = (source)

Undocumented

Undocumented

ignore_all: bool = (source)

Undocumented

import_context = (source)

Undocumented

interface_hash = (source)

Undocumented

manager = (source)

Undocumented

meta = (source)

Undocumented

meta_source_hash = (source)

Undocumented

options = (source)

Undocumented

order = (source)

Undocumented

path = (source)

Undocumented

priorities: dict = (source)

Undocumented

source = (source)

Undocumented

source_hash = (source)

Undocumented

suppressed: list = (source)

Undocumented

suppressed_set = (source)

Undocumented

tree = (source)

Undocumented

xpath = (source)

Undocumented

@property
xmeta: CacheMeta = (source)

Undocumented

def _patch_indirect_dependencies(self, module_refs, type_map): (source)

Undocumented

Parameters
module​_refs:Set[str]Undocumented
type​_map:Dict[Expression, Type]Undocumented
_type_checker = (source)

Undocumented