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

Commit

Permalink
Update legacy_api_client.py (#93)
Browse files Browse the repository at this point in the history
* Update legacy_api_client.py

* qa

* edit message

---------

Co-authored-by: malmans2 <m.almansi@bopen.eu>
  • Loading branch information
EddyCMWF and malmans2 authored Oct 21, 2024
1 parent 9c0d0f3 commit 377fc23
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cads_api_client/legacy_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ def issue_deprecated_kwargs_warning(self, **kwargs: Any) -> None:
)

@classmethod
def raise_not_implemented_error(self) -> None:
def raise_toolbox_error(self) -> None:
raise NotImplementedError(
"This is a beta version. This functionality has not been implemented yet."
"Legacy CDS Toolbox is now discontinued."
" Watch for announcements/updates on new CDS improved capabilities on our Forum (https://forum.ecmwf.int/)."
)

@overload
Expand Down Expand Up @@ -190,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 377fc23

Please sign in to comment.