class documentation

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 detect_possibly_undefined_vars Undocumented
Method finish_passes Undocumented
Method fix_cross_refs Undocumented
Method free_state Undocumented
Method generate_ignore_without_code_notes 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 time_spent_us 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 per_line_checking_time_ns 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: str|None, path: str|None, source: str|None, manager: BuildManager, caller_state: State|None = None, caller_line: int = 0, ancestor_for: State|None = None, root_source: bool = False, temporary: bool = False): (source)

Undocumented

def add_ancestors(self): (source)

Undocumented

def add_dependency(self, dep: str): (source)

Undocumented

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) -> dict[str, set[str]]: (source)

Undocumented

def dependency_lines(self) -> list[int]: (source)

Undocumented

def dependency_priorities(self) -> list[int]: (source)

Undocumented

def detect_possibly_undefined_vars(self): (source)

Undocumented

def finish_passes(self): (source)

Undocumented

def fix_cross_refs(self): (source)

Undocumented

def free_state(self): (source)

Undocumented

def generate_ignore_without_code_notes(self): (source)

Undocumented

def generate_unused_ignore_notes(self): (source)

Undocumented

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

Return whether the cache data for this file is fresh.

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

Undocumented

def load_fine_grained_deps(self) -> dict[str, set[str]]: (source)

Undocumented

def load_tree(self, temporary: bool = False): (source)

Undocumented

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: bool = False): (source)

Marks this module as having a stale public interface, and discards the cache data.

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: str): (source)

Check for inline mypy: options directive and parse them.

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: str): (source)

Undocumented

def type_check_first_pass(self): (source)

Undocumented

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

Undocumented

def type_checker(self) -> TypeChecker: (source)

Undocumented

def type_map(self) -> dict[Expression, Type]: (source)

Undocumented

def update_fine_grained_deps(self, deps: dict[str, set[str]]): (source)

Undocumented

def valid_references(self) -> set[str]: (source)

Undocumented

def verify_dependencies(self, suppressed_only: bool = False): (source)

Report errors for import targets in modules that don't exist. If suppressed_only is set, only check suppressed dependencies.

@contextlib.contextmanager
def wrap_context(self, check_blockers: bool = True) -> Iterator[None]: (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.

def write_cache(self): (source)

Undocumented

Undocumented

fine_grained_deps_loaded: bool = (source)

Undocumented

order_counter: ClassVar[int] = (source)

Undocumented

time_spent_us: int = (source)

Undocumented

transitive_error: bool = (source)

Undocumented

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

Undocumented

Undocumented

meta_source_hash = (source)

Undocumented

Undocumented

Undocumented

Undocumented

per_line_checking_time_ns = (source)

Undocumented

priorities: dict = (source)

Undocumented

Undocumented

source_hash = (source)

Undocumented

suppressed: list = (source)

Undocumented

suppressed_set = (source)

Undocumented

Undocumented

Undocumented

Undocumented

def _patch_indirect_dependencies(self, module_refs: set[str], types: set[Type]): (source)

Undocumented

_type_checker = (source)

Undocumented