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

Method filename_and_mtime

IPython/extensions/autoreload.py:246–270  ·  view source on GitHub ↗
(self, module)

Source from the content-addressed store, hash-verified

244 return top_module, top_name
245
246 def filename_and_mtime(self, module):
247 if not hasattr(module, "__file__") or module.__file__ is None:
248 return None, None
249
250 if getattr(module, "__name__", None) in [None, "__mp_main__", "__main__"]:
251 # we cannot reload(__main__) or reload(__mp_main__)
252 return None, None
253
254 filename = module.__file__
255 path, ext = os.path.splitext(filename)
256
257 if ext.lower() == ".py":
258 py_filename = filename
259 else:
260 try:
261 py_filename = source_from_cache(filename)
262 except ValueError:
263 return None, None
264
265 try:
266 pymtime = os.stat(py_filename).st_mtime
267 except OSError:
268 return None, None
269
270 return py_filename, pymtime
271
272 def check(self, check_all=False, do_reload=True, execution_info=None):
273 """Check whether some modules need to be reloaded."""

Callers 2

checkMethod · 0.95
post_execute_hookMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected