Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
edit message
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Oct 21, 2024
1 parent 7bae572 commit 7d45e96
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
17 changes: 11 additions & 6 deletions cads_api_client/legacy_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,11 @@ def issue_deprecated_kwargs_warning(self, **kwargs: Any) -> None:
)

@classmethod
def raise_not_implemented_error(self) -> None:
raise NotImplementedError("This functionality is no longer supported.")
def raise_toolbox_error(self) -> None:
raise NotImplementedError(
"Legacy CDS Toolbox is now discontinued."
" Watch for announcements/updates on new CDS improved capabilities on our Forum (https://forum.ecmwf.int/)."
)

@overload
def retrieve(self, name: str, request: dict[str, Any], target: str) -> str: ...
Expand Down Expand Up @@ -188,11 +191,13 @@ def error(self, *args: Any, **kwargs: Any) -> None:
def debug(self, *args: Any, **kwargs: Any) -> None:
self.log(logging.DEBUG, *args, **kwargs)

def service(self, name, *args, **kwargs): # type: ignore
self.raise_not_implemented_error()
@typing.no_type_check
def service(self, name, *args, **kwargs):
self.raise_toolbox_error()

def workflow(self, code, *args, **kwargs): # type: ignore
self.raise_not_implemented_error()
@typing.no_type_check
def workflow(self, code, *args, **kwargs):
self.raise_toolbox_error()

def status(self, context: Any = None) -> dict[str, list[str]]:
status = collections.defaultdict(list)
Expand Down
7 changes: 7 additions & 0 deletions tests/integration_test_70_legacy_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,10 @@ def test_legacy_api_client_warning(
metadata="b", # type: ignore[arg-type]
forget="c", # type: ignore[arg-type]
)


def test_legacy_api_client_toolbox(legacy_client: LegacyApiClient) -> None:
with pytest.raises(NotImplementedError):
legacy_client.service("service")
with pytest.raises(NotImplementedError):
legacy_client.workflow("workflow")

0 comments on commit 7d45e96

Please sign in to comment.