Skip to content

Commit 9676e1e

Browse files
committed
WIP
1 parent 42d6385 commit 9676e1e

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

src/spiffworkflow_proxy/plugin_service.py

+3-30
Original file line numberDiff line numberDiff line change
@@ -76,48 +76,21 @@ def command_named(plugin_display_name: str, command_name: str) -> type[Connector
7676
return available_commands_by_plugin[plugin_name][command_name]
7777
except Exception:
7878
return None
79-
80-
#
81-
# commands True connector_example.commands
82-
# combine_strings False connector_example.commands.combine_strings
83-
# some_helper False connector_example.some_helper
84-
#
8579

86-
@staticmethod
87-
def modules_for_plugin_in_package2(
88-
plugin: types.ModuleType, package_name: str | None
89-
) -> Generator[tuple[str, types.ModuleType], None, None]:
90-
for finder, name, ispkg in pkgutil.iter_modules(plugin.__path__):
91-
print(name, ispkg, f"{plugin.__name__}.{name}")
92-
imported = importlib.import_module(f"{plugin.__name__}.{name}")
93-
if ispkg:
94-
yield from PluginService.modules_for_plugin_in_package(imported, None)
95-
else:
96-
yield name, imported
97-
98-
#
99-
# commands True connector_example.commands
100-
# combine_strings False commands.combine_strings
101-
#
102-
10380
@staticmethod
10481
def modules_for_plugin_in_package(
10582
plugin: types.ModuleType, package_name: str | None
10683
) -> Generator[tuple[str, types.ModuleType], None, None]:
10784
for finder, name, ispkg in pkgutil.iter_modules(plugin.__path__):
108-
print(name, ispkg, f"{plugin.__name__}.{name}")
10985
if ispkg and name == package_name:
110-
found_module = finder.find_module(name) # type: ignore
111-
if found_module is not None:
112-
sub_pkg = found_module.load_module(name)
113-
yield from PluginService.modules_for_plugin_in_package(sub_pkg, None)
114-
elif package_name is None:
86+
imported = importlib.import_module(f"{plugin.__name__}.{name}")
87+
yield from PluginService.modules_for_plugin_in_package(imported, None)
88+
elif not package_name:
11589
spec = finder.find_spec(name) # type: ignore
11690
if spec is not None and spec.loader is not None:
11791
module = types.ModuleType(spec.name)
11892
spec.loader.exec_module(module)
11993
yield name, module
120-
assert False
12194

12295
@staticmethod
12396
def targets_for_plugin(

0 commit comments

Comments
 (0)