Skip to content

Commit

Permalink
Patched /home/runner/work/patchwork/patchwork/patchwork/common/utils/…
Browse files Browse the repository at this point in the history
…dependency.py
  • Loading branch information
patched.codes[bot] committed Nov 15, 2024
1 parent 8187002 commit cc42f04
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions patchwork/common/utils/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
"notification": ["slack_sdk"],
}

__ALLOWED_MODULES = {module for modules in __DEPENDENCY_GROUPS.values() for module in modules}

@lru_cache(maxsize=None)
def import_with_dependency_group(name):
if name not in __ALLOWED_MODULES:
raise ImportError(f"Module {name} is not allowed to be imported.")
try:
return importlib.import_module(name)
except ImportError:
Expand Down

0 comments on commit cc42f04

Please sign in to comment.