class documentation

class BuildManager: (source)

View In Hierarchy

This class holds shared state for building a mypy program. It is used to coordinate parsing, import processing, semantic analysis and type checking. The actual build steps are carried out by dispatch(). Attributes: data_dir: Mypy data directory (contains stubs) search_paths: SearchPaths instance indicating where to look for modules modules: Mapping of module ID to MypyFile (shared by the passes) semantic_analyzer: Semantic analyzer, pass 2 all_types: Map {Expression: Type} from all modules (enabled by export_types) options: Build options missing_modules: Set of modules that could not be imported encountered so far stale_modules: Set of modules that needed to be rechecked (only used by tests) fg_deps_meta: Metadata for fine-grained dependencies caches associated with modules fg_deps: A fine-grained dependency map version_id: The current mypy version (based on commit id when possible) plugin: Active mypy plugin(s) plugins_snapshot: Snapshot of currently active user plugins (versions and hashes) old_plugins_snapshot: Plugins snapshot from previous incremental run (or None in non-incremental mode and if cache was not found) errors: Used for reporting all errors flush_errors: A function for processing errors after each SCC cache_enabled: Whether cache is being read. This is set based on options, but is disabled if fine-grained cache loading fails and after an initial fine-grained load. This doesn't determine whether we write cache files or not. quickstart_state: A cache of filename -> mtime/size/hash info used to avoid needing to hash source files when using a cache with mismatching mtimes stats: Dict with various instrumentation numbers, it is used not only for debugging, but also required for correctness, in particular to check consistency of the fine-grained dependency cache. fscache: A file system cacher ast_cache: AST cache to speed up mypy daemon

Method __init__ Undocumented
Method add_stats Undocumented
Method all_imported_modules_in_file Find all reachable import statements in a file.
Method dump_stats Undocumented
Method get_stat Undocumented
Method getmtime Return a file's mtime; but 0 in bazel mode.
Method is_module Is there a file in the file system corresponding to module id?
Method load_fine_grained_deps Undocumented
Method log Undocumented
Method log_fine_grained Undocumented
Method maybe_swap_for_shadow_path Undocumented
Method parse_file Parse the source of a file with the given name.
Method report_file Undocumented
Method stats_summary Undocumented
Method trace Undocumented
Method use_fine_grained_cache Undocumented
Method verbosity Undocumented
Instance Variable all_types Undocumented
Instance Variable ast_cache Undocumented
Instance Variable cache_enabled Undocumented
Instance Variable data_dir Undocumented
Instance Variable errors Undocumented
Instance Variable fg_deps Undocumented
Instance Variable fg_deps_meta Undocumented
Instance Variable find_module_cache Undocumented
Instance Variable flush_errors Undocumented
Instance Variable fscache Undocumented
Instance Variable incomplete_namespaces Undocumented
Instance Variable indirection_detector Undocumented
Instance Variable metastore Undocumented
Instance Variable missing_modules Undocumented
Instance Variable missing_stub_packages Undocumented
Instance Variable modules Undocumented
Instance Variable old_plugins_snapshot Undocumented
Instance Variable options Undocumented
Instance Variable plugin Undocumented
Instance Variable plugins_snapshot Undocumented
Instance Variable processed_targets Undocumented
Instance Variable quickstart_state Undocumented
Instance Variable rechecked_modules Undocumented
Instance Variable reports Undocumented
Instance Variable search_paths Undocumented
Instance Variable semantic_analyzer Undocumented
Instance Variable shadow_equivalence_map Undocumented
Instance Variable shadow_map Undocumented
Instance Variable source_set Undocumented
Instance Variable stale_modules Undocumented
Instance Variable start_time Undocumented
Instance Variable stats Undocumented
Instance Variable stderr Undocumented
Instance Variable stdout Undocumented
Instance Variable version_id Undocumented
def __init__(self, data_dir: str, search_paths: SearchPaths, ignore_prefix: str, source_set: BuildSourceSet, reports: Reports|None, options: Options, version_id: str, plugin: Plugin, plugins_snapshot: dict[str, str], errors: Errors, flush_errors: Callable[[list[str], bool], None], fscache: FileSystemCache, stdout: TextIO, stderr: TextIO): (source)

Undocumented

def add_stats(self, **kwds: Any): (source)

Undocumented

def all_imported_modules_in_file(self, file: MypyFile) -> list[tuple[int, str, int]]: (source)

Find all reachable import statements in a file. Return list of tuples (priority, module id, import line number) for all modules imported in file; lower numbers == higher priority. Can generate blocking errors on bogus relative imports.

def dump_stats(self): (source)

Undocumented

def get_stat(self, path: str) -> os.stat_result: (source)

Undocumented

def getmtime(self, path: str) -> int: (source)

Return a file's mtime; but 0 in bazel mode. (Bazel's distributed cache doesn't like filesystem metadata to end up in output files.)

def is_module(self, id: str) -> bool: (source)

Is there a file in the file system corresponding to module id?

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

Undocumented

def log(self, *message: str): (source)

Undocumented

def log_fine_grained(self, *message: str): (source)

Undocumented

def maybe_swap_for_shadow_path(self, path: str) -> str: (source)

Undocumented

def parse_file(self, id: str, path: str, source: str, ignore_errors: bool, options: Options) -> MypyFile: (source)

Parse the source of a file with the given name. Raise CompileError if there is a parse error.

def report_file(self, file: MypyFile, type_map: dict[Expression, Type], options: Options): (source)

Undocumented

def stats_summary(self) -> Mapping[str, object]: (source)

Undocumented

def trace(self, *message: str): (source)

Undocumented

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

Undocumented

def verbosity(self) -> int: (source)

Undocumented

Undocumented

Undocumented

cache_enabled = (source)

Undocumented

data_dir = (source)

Undocumented

Undocumented

Undocumented

fg_deps_meta: dict[str, FgDepMeta] = (source)

Undocumented

find_module_cache = (source)

Undocumented

flush_errors = (source)

Undocumented

Undocumented

incomplete_namespaces: set[str] = (source)

Undocumented

indirection_detector = (source)

Undocumented

metastore = (source)

Undocumented

missing_modules: set[str] = (source)

Undocumented

missing_stub_packages: set[str] = (source)

Undocumented

Undocumented

old_plugins_snapshot = (source)

Undocumented

Undocumented

Undocumented

plugins_snapshot = (source)

Undocumented

processed_targets: list[str] = (source)

Undocumented

quickstart_state = (source)

Undocumented

rechecked_modules: set[str] = (source)

Undocumented

Undocumented

search_paths = (source)

Undocumented

semantic_analyzer = (source)

Undocumented

shadow_equivalence_map: dict[str, str|None] = (source)

Undocumented

shadow_map = (source)

Undocumented

source_set = (source)

Undocumented

stale_modules: set[str] = (source)

Undocumented

start_time = (source)

Undocumented

Undocumented

Undocumented

Undocumented

version_id = (source)

Undocumented