Spaces:
Configuration error
Configuration error
Commit ·
017f11e
1
Parent(s): c18cd89
Delete LazyImport.py
Browse files- LazyImport.py +0 -13
LazyImport.py
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
from importlib.util import find_spec, LazyLoader, module_from_spec
|
| 2 |
-
from sys import modules
|
| 3 |
-
|
| 4 |
-
def lazyload(name):
|
| 5 |
-
if name in modules:
|
| 6 |
-
return modules[name]
|
| 7 |
-
else:
|
| 8 |
-
spec = find_spec(name)
|
| 9 |
-
loader = LazyLoader(spec.loader)
|
| 10 |
-
module = module_from_spec(spec)
|
| 11 |
-
modules[name] = module
|
| 12 |
-
loader.exec_module(module)
|
| 13 |
-
return module
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|