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

Function build_inner

mypy/build.py:464–564  ·  view source on GitHub ↗
(
    sources: list[BuildSource],
    options: Options,
    alt_lib_path: str | None,
    flush_errors: Callable[[str | None, list[str], bool], None],
    fscache: FileSystemCache | None,
    stdout: TextIO,
    stderr: TextIO,
    extra_plugins: Sequence[Plugin],
    workers: list[WorkerClient],
    connect_threads: list[Thread],
    metastore: MetadataStore,
)

Source from the content-addressed store, hash-verified

462
463
464def build_inner(
465 sources: list[BuildSource],
466 options: Options,
467 alt_lib_path: str | None,
468 flush_errors: Callable[[str | None, list[str], bool], None],
469 fscache: FileSystemCache | None,
470 stdout: TextIO,
471 stderr: TextIO,
472 extra_plugins: Sequence[Plugin],
473 workers: list[WorkerClient],
474 connect_threads: list[Thread],
475 metastore: MetadataStore,
476) -> BuildResult:
477 if platform.python_implementation() == "CPython":
478 # Run gc less frequently, as otherwise we can spend a large fraction of
479 # cpu in gc. This seems the most reasonable place to tune garbage collection.
480 gc.set_threshold(200 * 1000, 30, 30)
481
482 data_dir = default_data_dir()
483 fscache = fscache or FileSystemCache()
484
485 search_paths = compute_search_paths(sources, options, data_dir, alt_lib_path)
486
487 reports = None
488 if options.report_dirs:
489 # Import lazily to avoid slowing down startup.
490 from mypy.report import Reports
491
492 reports = Reports(data_dir, options.report_dirs)
493
494 source_set = BuildSourceSet(sources)
495 cached_read = fscache.read
496 error_formatter = None if options.output is None else OUTPUT_CHOICES.get(options.output)
497 errors = Errors(
498 options,
499 read_source=lambda path: read_py_file(path, cached_read),
500 error_formatter=error_formatter,
501 )
502 # Record import errors so that they can be replayed by the workers.
503 if workers:
504 errors.global_watcher = True
505 plugin, snapshot = load_plugins(options, errors, stdout, extra_plugins)
506
507 # Validate error codes after plugins are loaded.
508 options.process_error_codes(error_callback=build_error)
509
510 # Construct a build manager object to hold state during the build.
511 #
512 # Ignore current directory prefix in error messages.
513 manager = BuildManager(
514 data_dir,
515 search_paths,
516 ignore_prefix=os.getcwd(),
517 source_set=source_set,
518 reports=reports,
519 options=options,
520 version_id=__version__,
521 plugin=plugin,

Callers 1

buildFunction · 0.85

Calls 15

verbosityMethod · 0.95
traceMethod · 0.95
commitMethod · 0.95
logMethod · 0.95
dump_statsMethod · 0.95
finishMethod · 0.95
FileSystemCacheClass · 0.90
compute_search_pathsFunction · 0.90
ReportsClass · 0.90
BuildSourceSetClass · 0.90
ErrorsClass · 0.90
read_py_fileFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…