MCPcopy
hub / github.com/dabeaz/python-cookbook / decorate

Function decorate

src/10/monkeypatching_modules_on_import/postimport.py:32–37  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

30
31def when_imported(fullname):
32 def decorate(func):
33 if fullname in sys.modules:
34 func(sys.modules[fullname])
35 else:
36 _post_import_hooks[fullname].append(func)
37 return func
38 return decorate
39
40sys.meta_path.insert(0, PostImportFinder())

Callers

nothing calls this directly

Calls 1

funcFunction · 0.50

Tested by

no test coverage detected