Skip to content

Commit 13a6d33

Browse files
committed
Add root module import
1 parent 7759d37 commit 13a6d33

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from inference_core_nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
2+
3+
__all__ = ("NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS")
Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
__version__ = "0.1.0"
1+
__all__ = ("__version__", "NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS")
2+
3+
__version__ = "0.1.0"
4+
5+
6+
def _get_node_mappings():
7+
import importlib
8+
import pkgutil
9+
10+
node_class_mappings = {}
11+
node_display_name_mappings = {}
12+
13+
for submodule_info in pkgutil.iter_modules(__path__):
14+
# import
15+
submodule = importlib.import_module(f"{__name__}.{submodule_info.name}")
16+
17+
node_class_mappings.update(getattr(submodule, "NODE_CLASS_MAPPINGS"))
18+
node_display_name_mappings.update(
19+
getattr(submodule, "NODE_DISPLAY_NAME_MAPPINGS")
20+
)
21+
22+
return node_class_mappings, node_display_name_mappings
23+
24+
25+
NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS = _get_node_mappings()

0 commit comments

Comments
 (0)