-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from pathlib import Path | ||
import sys | ||
import inspect | ||
import pkgutil | ||
from importlib import import_module | ||
|
||
# make sure to add all dynamically created classes to the modules | ||
# found at: https://www.bnmetrics.com/blog/dynamic-import-in-python3 | ||
for (_, name, _) in pkgutil.iter_modules([Path(__file__).parent]): | ||
|
||
imported_module = import_module('.' + name, package=__name__) | ||
|
||
for i in dir(imported_module): | ||
attribute = getattr(imported_module, i) | ||
|
||
if inspect.isclass(attribute): | ||
setattr(sys.modules[__name__], name, attribute) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters