-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path__init__.py
More file actions
executable file
·36 lines (28 loc) · 1.13 KB
/
__init__.py
File metadata and controls
executable file
·36 lines (28 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
################### Packages needed for init
import importlib
import os
import pkgutil
#####################################################
# Import all self-named functions
#####################################################
__all__ = []
package_name = __name__
package_path = os.path.dirname(__file__)
for modinfo in pkgutil.iter_modules([package_path]):
module_name = modinfo.name
if module_name.startswith("_") or module_name == "__init__" or module_name == "attenuation_tools":
continue
module = importlib.import_module(f".{module_name}", package=package_name)
attr = getattr(module, module_name, None)
if callable(attr):
globals()[module_name] = attr
__all__.append(module_name)
########## Still thinking about proper implementation for this
######################################################
# Import all functions from attenuation_tools.py
######################################################
#
#nickmodule = importlib.import_module(".attenuation_tools", package=__name__)
#for name, obj in inspect.getmembers(nickmodule):
# if inspect.isfunction(obj):
# globals()[name] = obj