Skip to content

Commit

Permalink
Proper typing of the decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexejPenner committed Feb 21, 2024
1 parent 1da81bd commit cf8a1c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/zenml/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
logger = get_logger(__name__)

AnyResponse = TypeVar("AnyResponse", bound=BaseIdentifiedResponse) # type: ignore[type-arg]
T = TypeVar("T")


class ClientConfiguration(FileSyncModel):
Expand Down Expand Up @@ -365,7 +366,7 @@ def _reset_instance(cls, client: Optional["Client"] = None) -> None:
cls._global_client = client

@staticmethod
def _fail_for_sql_zen_store(method):
def _fail_for_sql_zen_store(method: Callable[..., T]) -> Callable[..., T]:
"""Decorator for all methods, that are disallowed when the client is not connected through REST API.
Args:
Expand All @@ -376,7 +377,7 @@ def _fail_for_sql_zen_store(method):
"""

@functools.wraps(method)
def wrapper(self, *args, **kwargs):
def wrapper(self: "Client", *args: Any, **kwargs: Any) -> Any:
# No isinstance check to avoid importing ZenStore implementations
if self.zen_store.__class__.__name__ == "SqlZenStore":
raise TypeError(
Expand Down

0 comments on commit cf8a1c3

Please sign in to comment.