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

Class MypyFile

mypy/nodes.py:442–616  ·  view source on GitHub ↗

The abstract syntax tree of a single source file.

Source from the content-addressed store, hash-verified

440
441
442class MypyFile(SymbolNode):
443 """The abstract syntax tree of a single source file."""
444
445 __slots__ = (
446 "_fullname",
447 "path",
448 "defs",
449 "alias_deps",
450 "module_refs",
451 "is_bom",
452 "names",
453 "imports",
454 "ignored_lines",
455 "skipped_lines",
456 "is_stub",
457 "is_cache_skeleton",
458 "is_partial_stub_package",
459 "uses_template_strings",
460 "plugin_deps",
461 "future_import_flags",
462 "_is_typeshed_file",
463 "raw_data",
464 )
465
466 __match_args__ = ("name", "path", "defs")
467
468 # Fully qualified module name
469 _fullname: str
470 # Path to the file (empty string if not known)
471 path: str
472 # Top-level definitions and statements
473 defs: list[Statement]
474 # Type alias dependencies as mapping from target to set of alias full names
475 alias_deps: defaultdict[str, set[str]]
476 # The set of all dependencies (suppressed or not) that this module accesses, either
477 # directly or indirectly.
478 module_refs: set[str]
479 # Is there a UTF-8 BOM at the start?
480 is_bom: bool
481 names: SymbolTable
482 # All import nodes within the file (also ones within functions etc.)
483 imports: list[ImportBase]
484 # Lines on which to ignore certain errors when checking.
485 # If the value is empty, ignore all errors; otherwise, the list contains all
486 # error codes to ignore.
487 ignored_lines: dict[int, list[str]]
488 # Lines that were skipped during semantic analysis e.g. due to ALWAYS_FALSE, MYPY_FALSE,
489 # or platform/version checks. Those lines would not be type-checked.
490 skipped_lines: set[int]
491 # Is this file represented by a stub file (.pyi)?
492 is_stub: bool
493 # Is this loaded from the cache and thus missing the actual body of the file?
494 is_cache_skeleton: bool
495 # Does this represent an __init__.pyi stub with a module __getattr__
496 # (i.e. a partial stub package), for such packages we suppress any missing
497 # module errors in addition to missing attribute errors.
498 is_partial_stub_package: bool
499 # True if module contains at least one t-string (PEP 750 TemplateStr).

Callers 8

parseFunction · 0.90
visit_ModuleMethod · 0.90
load_from_rawFunction · 0.90
visit_mypy_fileMethod · 0.90
native_parseFunction · 0.90
make_builderFunction · 0.90
deserializeMethod · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by 1

make_builderFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…