MCPcopy Index your code
hub / github.com/ipython/ipython / post_execute_hook

Method post_execute_hook

IPython/extensions/autoreload.py:856–877  ·  view source on GitHub ↗

Cache the modification times of any modules imported in this execution and track imports

(self)

Source from the content-addressed store, hash-verified

854 pass
855
856 def post_execute_hook(self):
857 """Cache the modification times of any modules imported in this execution and track imports"""
858
859 # Track imports from the recently executed code if autoreload 3 is enabled
860 if self._reloader.enabled and self._reloader.autoload_obj:
861 # Use the stored execution info
862 if (
863 hasattr(self, "_last_execution_info")
864 and self._last_execution_info
865 and self._last_execution_info.transformed_cell
866 ):
867 self._track_imports_from_code(
868 self._last_execution_info.transformed_cell
869 )
870
871 newly_loaded_modules = set(sys.modules) - self.loaded_modules
872 for modname in newly_loaded_modules:
873 _, pymtime = self._reloader.filename_and_mtime(sys.modules[modname])
874 if pymtime is not None:
875 self._reloader.modules_mtimes[modname] = pymtime
876
877 self.loaded_modules.update(newly_loaded_modules)
878
879 def _track_imports_from_code(self, code: str) -> None:
880 """Track import statements from executed code"""

Callers 3

run_codeMethod · 0.80
run_codeMethod · 0.80
magic_aimportMethod · 0.80

Calls 3

filename_and_mtimeMethod · 0.80
updateMethod · 0.45

Tested by 3

run_codeMethod · 0.64
run_codeMethod · 0.64
magic_aimportMethod · 0.64