Show More
@@ -219,7 +219,7 b' def ensure_fromlist(mod, fromlist, buf, recursive):' | |||||
219 | elif not hasattr(mod, item): |
|
219 | elif not hasattr(mod, item): | |
220 | import_submodule(mod, item, buf + '.' + item) |
|
220 | import_submodule(mod, item, buf + '.' + item) | |
221 |
|
221 | |||
222 |
def import_ |
|
222 | def deep_import_hook(name, globals=None, locals=None, fromlist=None, level=-1): | |
223 | """Replacement for __import__()""" |
|
223 | """Replacement for __import__()""" | |
224 | parent, buf = get_parent(globals, level) |
|
224 | parent, buf = get_parent(globals, level) | |
225 |
|
225 | |||
@@ -243,7 +243,7 b' def import_module_level(name, globals=None, locals=None, fromlist=None, level=-1' | |||||
243 |
|
243 | |||
244 | modules_reloading = {} |
|
244 | modules_reloading = {} | |
245 |
|
245 | |||
246 |
def reload_ |
|
246 | def deep_reload_hook(m): | |
247 | """Replacement for reload().""" |
|
247 | """Replacement for reload().""" | |
248 | if not isinstance(m, ModuleType): |
|
248 | if not isinstance(m, ModuleType): | |
249 | raise TypeError("reload() argument must be module") |
|
249 | raise TypeError("reload() argument must be module") | |
@@ -307,9 +307,9 b" def reload(module, exclude=['sys', 'os.path', '__builtin__', '__main__']):" | |||||
307 | for i in exclude: |
|
307 | for i in exclude: | |
308 | found_now[i] = 1 |
|
308 | found_now[i] = 1 | |
309 | original_import = __builtin__.__import__ |
|
309 | original_import = __builtin__.__import__ | |
310 |
__builtin__.__import__ = import_ |
|
310 | __builtin__.__import__ = deep_import_hook | |
311 | try: |
|
311 | try: | |
312 |
ret = reload_ |
|
312 | ret = deep_reload_hook(module) | |
313 | finally: |
|
313 | finally: | |
314 | __builtin__.__import__ = original_import |
|
314 | __builtin__.__import__ = original_import | |
315 | found_now = {} |
|
315 | found_now = {} |
General Comments 0
You need to be logged in to leave comments.
Login now