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

Method reload_module

mypy/inspections.py:218–227  ·  view source on GitHub ↗

Reload given module while temporary exporting types.

(self, state: State)

Source from the content-addressed store, hash-verified

216 self.module: State | None = None
217
218 def reload_module(self, state: State) -> None:
219 """Reload given module while temporary exporting types."""
220 old = self.fg_manager.manager.options.export_types
221 self.fg_manager.manager.options.export_types = True
222 try:
223 self.fg_manager.flush_cache()
224 assert state.path is not None
225 self.fg_manager.update([(state.id, state.path)], [])
226 finally:
227 self.fg_manager.manager.options.export_types = old
228
229 def expr_type(self, expression: Expression) -> tuple[str, bool]:
230 """Format type for an expression using current options.

Callers 2

modules_for_nodesMethod · 0.95
run_inspectionMethod · 0.95

Calls 2

flush_cacheMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected