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:
Kumi 2024-07-02 08:25:52 +02:00
parent d0cb2906c6
commit ea1fe9fbde
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -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: