Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 9, 2024
1 parent bc10f55 commit b4b1510
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions notifiers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from abc import ABC
from abc import abstractmethod
from importlib.metadata import entry_points
import importlib.machinery
import importlib.util

import jsonschema
import requests
Expand Down Expand Up @@ -353,7 +351,7 @@ def get_notifier(provider_name: str, strict: bool = False) -> Provider:
raise NoSuchNotifierError(name=provider_name)


def load_provider_from_points(entry_points: str) -> 'Provider':
def load_provider_from_points(entry_points: str) -> "Provider":
"""Load a Provider class from a given entry point string.
This function takes an entry point string in the format
Expand All @@ -372,7 +370,7 @@ def load_provider_from_points(entry_points: str) -> 'Provider':
>>> provider_class = load_provider_from_points(entry_points)
>>> provider = provider_class()
"""
if not entry_points or ':' not in entry_points:
if not entry_points or ":" not in entry_points:
raise ValueError(
f"Invalid entry point format: {entry_points}. "
"Expected format: 'module_path:class_name'"
Expand All @@ -389,9 +387,7 @@ def load_provider_from_points(entry_points: str) -> 'Provider':
try:
module = importlib.import_module(module_path.strip())
except ImportError as e:
raise ImportError(
f"Failed to import module '{module_path}': {str(e)}"
) from e
raise ImportError(f"Failed to import module '{module_path}': {str(e)}") from e

try:
provider_class = getattr(module, class_name.strip())
Expand All @@ -401,9 +397,7 @@ def load_provider_from_points(entry_points: str) -> 'Provider':
) from e

if not (isinstance(provider_class, type) and issubclass(provider_class, Provider)):
raise TypeError(
f"'{module_path}:{class_name}' must be a subclass of Provider"
)
raise TypeError(f"'{module_path}:{class_name}' must be a subclass of Provider")

return provider_class

Expand Down

0 comments on commit b4b1510

Please sign in to comment.