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

Method restore_after

mypy/suggestions.py:303–311  ·  view source on GitHub ↗

Context manager that reloads a module after executing the body. This should undo any damage done to the module state while mucking around.

(self, module: str)

Source from the content-addressed store, hash-verified

301
302 @contextmanager
303 def restore_after(self, module: str) -> Iterator[None]:
304 """Context manager that reloads a module after executing the body.
305
306 This should undo any damage done to the module state while mucking around.
307 """
308 try:
309 yield
310 finally:
311 self.reload(self.graph[module])
312
313 @contextmanager
314 def with_export_types(self) -> Iterator[None]:

Callers 2

suggestMethod · 0.95
suggest_callsitesMethod · 0.95

Calls 1

reloadMethod · 0.95

Tested by

no test coverage detected