MCPcopy
hub / github.com/python/mypy / BuildSource

Class BuildSource

mypy/modulefinder.py:123–145  ·  view source on GitHub ↗

A single source file.

Source from the content-addressed store, hash-verified

121
122
123class BuildSource:
124 """A single source file."""
125
126 def __init__(
127 self,
128 path: str | None,
129 module: str | None,
130 text: str | None = None,
131 base_dir: str | None = None,
132 followed: bool = False,
133 ) -> None:
134 self.path = path # File where it's found (e.g. 'xxx/yyy/foo/bar.py')
135 self.module = module or "__main__" # Module name (e.g. 'foo.bar')
136 self.text = text # Source code, if initially supplied, else None
137 self.base_dir = base_dir # Directory where the package is rooted (e.g. 'xxx/yyy')
138 self.followed = followed # Was this found by following imports?
139
140 def __repr__(self) -> str:
141 return (
142 "BuildSource(path={!r}, module={!r}, has_text={}, base_dir={!r}, followed={})".format(
143 self.path, self.module, self.text is not None, self.base_dir, self.followed
144 )
145 )
146
147
148class BuildSourceSet:

Callers 15

__init__Method · 0.90
readMethod · 0.90
direct_importsMethod · 0.90
create_source_listFunction · 0.90
find_sources_in_dirMethod · 0.90
process_optionsFunction · 0.90
test_semanalFunction · 0.90
test_semanal_errorFunction · 0.90
run_caseMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_semanalFunction · 0.72
test_semanal_errorFunction · 0.72
run_caseMethod · 0.72
run_caseMethod · 0.72
parse_sourcesMethod · 0.72
test_error_streamFunction · 0.72
buildMethod · 0.72
run_caseMethod · 0.72
buildMethod · 0.72
run_caseMethod · 0.72
test_transformFunction · 0.72
run_case_onceMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…