We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b79e62 commit 505d1f2Copy full SHA for 505d1f2
patchwork/common/utils/dependency.py
@@ -6,9 +6,12 @@
6
"notification": ["slack_sdk"],
7
}
8
9
+__ALLOWED_MODULES = {module for modules in __DEPENDENCY_GROUPS.values() for module in modules}
10
11
@lru_cache(maxsize=None)
12
def import_with_dependency_group(name):
13
+ if name not in __ALLOWED_MODULES:
14
+ raise ImportError(f"Module {name} is not allowed.")
15
try:
16
return importlib.import_module(name)
17
except ImportError:
@@ -20,6 +23,5 @@ def import_with_dependency_group(name):
20
23
error_msg = f"Please `pip install patchwork-cli[{dependency_group}]` to use this step"
21
24
raise ImportError(error_msg)
22
25
-
26
def slack_sdk():
27
return import_with_dependency_group("slack_sdk")
0 commit comments