Skip to content

Commit

Permalink
Merge pull request #83 from alexlnkp/pr-optimization
Browse files Browse the repository at this point in the history
fixes for all operating systems + lazyimporting
  • Loading branch information
kalomaze authored Aug 1, 2023
2 parents 5175ecc + 03da05e commit 43a0fe3
Show file tree
Hide file tree
Showing 2 changed files with 1,017 additions and 1,008 deletions.
13 changes: 13 additions & 0 deletions LazyImport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from importlib.util import find_spec, LazyLoader, module_from_spec
from sys import modules

def lazyload(name):
if name in modules:
return modules[name]
else:
spec = find_spec(name)
loader = LazyLoader(spec.loader)
module = module_from_spec(spec)
modules[name] = module
loader.exec_module(module)
return module
Loading

0 comments on commit 43a0fe3

Please sign in to comment.