Skip to content

Commit

Permalink
use empty string instead of checking hasattr
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Fu <hfu.gabriel@gmail.com>
  • Loading branch information
gabrielfu committed Jan 19, 2024
1 parent aedf8d6 commit 4171e1e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mlflow/gateway/providers/base.py
Expand Up @@ -12,12 +12,15 @@ class BaseProvider(ABC):
Base class for MLflow Gateway providers.
"""

NAME: str
NAME: str = ""
SUPPORTED_ROUTE_TYPES: Tuple[str, ...]

def __init__(self, config: RouteConfig):
if not hasattr(self, "NAME"):
raise TypeError(f"'NAME' is not defined for {self.__class__.__name__}")
if self.NAME == "":
raise ValueError(
f"{self.__class__.__name__} is a subclass of BaseProvider and must "
f"override 'NAME' attribute as a non-empty string."
)

self.config = config

Expand Down

0 comments on commit 4171e1e

Please sign in to comment.