MCPcopy Index your code
hub / github.com/python/mypy / __init__

Method __init__

mypy/build.py:830–1002  ·  view source on GitHub ↗
(
        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[[str | None, list[str], bool], None],
        fscache: FileSystemCache,
        stdout: TextIO,
        stderr: TextIO,
        error_formatter: ErrorFormatter | None = None,
        parallel_worker: bool = False,
        metastore: MetadataStore | None = None,
    )

Source from the content-addressed store, hash-verified

828 """
829
830 def __init__(
831 self,
832 data_dir: str,
833 search_paths: SearchPaths,
834 ignore_prefix: str,
835 source_set: BuildSourceSet,
836 reports: Reports | None,
837 options: Options,
838 version_id: str,
839 plugin: Plugin,
840 plugins_snapshot: dict[str, str],
841 errors: Errors,
842 flush_errors: Callable[[str | None, list[str], bool], None],
843 fscache: FileSystemCache,
844 stdout: TextIO,
845 stderr: TextIO,
846 error_formatter: ErrorFormatter | None = None,
847 parallel_worker: bool = False,
848 metastore: MetadataStore | None = None,
849 ) -> None:
850 self.stats: dict[str, Any] = {} # Values are ints or floats
851 # Use in cases where we need to prevent race conditions in stats reporting.
852 self.stats_lock = Lock()
853 self.stdout = stdout
854 self.stderr = stderr
855 self.start_time = time.time()
856 self.data_dir = data_dir
857 self.errors = errors
858 self.errors.set_ignore_prefix(ignore_prefix)
859 self.error_formatter = error_formatter
860 self.search_paths = search_paths
861 self.source_set = source_set
862 self.reports = reports
863 self.options = options
864 self.version_id = version_id
865 self.modules: dict[str, MypyFile] = {}
866 # Share same modules dictionary with the global fixer state.
867 # We need to set allow_missing when doing a fine-grained cache
868 # load because we need to gracefully handle missing modules.
869 modules_state.modules = self.modules
870 modules_state.node_fixer = NodeFixer(self.modules, self.options.use_fine_grained_cache)
871 self.import_map: dict[str, set[str]] = {}
872 self.missing_modules: dict[str, int] = {}
873 self.fg_deps_meta: dict[str, FgDepMeta] = {}
874 # fg_deps holds the dependencies of every module that has been
875 # processed. We store this in BuildManager so that we can compute
876 # dependencies as we go, which allows us to free ASTs and type information,
877 # saving a ton of memory on net.
878 self.fg_deps: dict[str, set[str]] = {}
879 # Always convert the plugin to a ChainedPlugin so that it can be manipulated if needed
880 if not isinstance(plugin, ChainedPlugin):
881 plugin = ChainedPlugin(options, [plugin])
882 self.plugin = plugin
883 # These allow quickly skipping logging and stats collection calls. Note
884 # that some stats impact mypy behavior, so be careful when skipping stats
885 # collection calls.
886 self.stats_enabled = self.options.dump_build_stats
887 self.logging_enabled = self.options.verbosity >= 1

Callers

nothing calls this directly

Calls 15

errorMethod · 0.95
noteMethod · 0.95
verbosityMethod · 0.95
traceMethod · 0.95
NodeFixerClass · 0.90
ChainedPluginClass · 0.90
SemanticAnalyzerClass · 0.90
FindModuleCacheClass · 0.90
is_typeshed_fileFunction · 0.90
is_stub_package_fileFunction · 0.90
isinstanceFunction · 0.85

Tested by

no test coverage detected