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

Method get_options

mypy/test/testfinegrained.py:144–168  ·  view source on GitHub ↗
(self, source: str, testcase: DataDrivenTestCase, build_cache: bool)

Source from the content-addressed store, hash-verified

142 )
143
144 def get_options(self, source: str, testcase: DataDrivenTestCase, build_cache: bool) -> Options:
145 # This handles things like '# flags: --foo'.
146 options = parse_options(source, testcase, incremental_step=1)
147 options.incremental = True
148 options.use_builtins_fixtures = True
149 options.show_traceback = True
150 options.error_summary = False
151 options.fine_grained_incremental = not build_cache
152 options.use_fine_grained_cache = self.use_cache and not build_cache
153 options.cache_fine_grained = self.use_cache
154 options.local_partial_types = True
155 options.export_types = "inspect" in testcase.file
156 # Treat empty bodies safely for these test cases.
157 options.allow_empty_bodies = not testcase.name.endswith("_no_empty")
158 options.reveal_verbose_types = True
159 if re.search("flags:.*--follow-imports", source) is None:
160 # Override the default for follow_imports
161 options.follow_imports = "error"
162
163 for name, _ in testcase.files:
164 if "mypy.ini" in name or "pyproject.toml" in name:
165 parse_config_file(options, lambda: None, name)
166 break
167
168 return options
169
170 def run_check(self, server: Server, sources: list[BuildSource]) -> list[str]:
171 response = server.check(sources, export_types=False, is_tty=False, terminal_width=-1)

Callers 1

run_caseMethod · 0.95

Calls 3

parse_optionsFunction · 0.90
parse_config_fileFunction · 0.90
endswithMethod · 0.45

Tested by

no test coverage detected