fix(core): handle missing entry point groups gracefully
Refactored the handling of entry points for notifiers and providers to avoid potential errors when their groups are missing. Simplifies and improves the robustness of the logic by directly iterating over all entry points and filtering by group instead of relying on potentially absent group keys.
This commit is contained in:
parent
d0cb2906c6
commit
ea1fe9fbde
1 changed files with 8 additions and 6 deletions
|
@ -74,9 +74,10 @@ class Core:
|
|||
logging.debug("Finding external notifiers")
|
||||
notifiers = []
|
||||
|
||||
for entry_point in importlib.metadata.entry_points().get(
|
||||
"trackbert.notifiers", []
|
||||
):
|
||||
for entry_point in importlib.metadata.entry_points():
|
||||
if entry_point.group != "trackbert.notifiers":
|
||||
continue
|
||||
|
||||
logging.debug(f"Considering external notifier {entry_point.name}")
|
||||
|
||||
try:
|
||||
|
@ -149,9 +150,10 @@ class Core:
|
|||
|
||||
providers = []
|
||||
|
||||
for entry_point in importlib.metadata.entry_points().get(
|
||||
"trackbert.providers", []
|
||||
):
|
||||
for entry_point in importlib.metadata.entry_points():
|
||||
if entry_point.group != "trackbert.providers":
|
||||
continue
|
||||
|
||||
logging.debug(f"Considering external provider {entry_point.name}")
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue