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")
|
logging.debug("Finding external notifiers")
|
||||||
notifiers = []
|
notifiers = []
|
||||||
|
|
||||||
for entry_point in importlib.metadata.entry_points().get(
|
for entry_point in importlib.metadata.entry_points():
|
||||||
"trackbert.notifiers", []
|
if entry_point.group != "trackbert.notifiers":
|
||||||
):
|
continue
|
||||||
|
|
||||||
logging.debug(f"Considering external notifier {entry_point.name}")
|
logging.debug(f"Considering external notifier {entry_point.name}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -149,9 +150,10 @@ class Core:
|
||||||
|
|
||||||
providers = []
|
providers = []
|
||||||
|
|
||||||
for entry_point in importlib.metadata.entry_points().get(
|
for entry_point in importlib.metadata.entry_points():
|
||||||
"trackbert.providers", []
|
if entry_point.group != "trackbert.providers":
|
||||||
):
|
continue
|
||||||
|
|
||||||
logging.debug(f"Considering external provider {entry_point.name}")
|
logging.debug(f"Considering external provider {entry_point.name}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue