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

Function reload

IPython/lib/deepreload.py:285–310  ·  view source on GitHub ↗

Recursively reload all modules used in the given module. Optionally takes a list of modules to exclude from reloading. The default exclude list contains modules listed in sys.builtin_module_names with additional sys, os.path, builtins and __main__, to prevent, e.g., resetting displ

(
    module,
    exclude=(
        *sys.builtin_module_names,
        "sys",
        "os.path",
        "builtins",
        "__main__",
        "numpy",
        "numpy._globals",
    ),
)

Source from the content-addressed store, hash-verified

283
284# Replacement for reload()
285def reload(
286 module,
287 exclude=(
288 *sys.builtin_module_names,
289 "sys",
290 "os.path",
291 "builtins",
292 "__main__",
293 "numpy",
294 "numpy._globals",
295 ),
296):
297 """Recursively reload all modules used in the given module. Optionally
298 takes a list of modules to exclude from reloading. The default exclude
299 list contains modules listed in sys.builtin_module_names with additional
300 sys, os.path, builtins and __main__, to prevent, e.g., resetting
301 display, exception, and io hooks.
302 """
303 global found_now
304 for i in exclude:
305 found_now[i] = 1
306 try:
307 with replace_import_hook(deep_import_hook):
308 return deep_reload_hook(module)
309 finally:
310 found_now = {}

Callers 3

reload_extensionMethod · 0.85
superreloadFunction · 0.85
environmentFunction · 0.85

Calls 2

replace_import_hookFunction · 0.85
deep_reload_hookFunction · 0.85

Tested by 1

environmentFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…