Skip to content

Commit

Permalink
refactor: remove unused api call (#4673)
Browse files Browse the repository at this point in the history
<!-- Thanks for your contribution! As part of our Community Growers
initiative 🌱, we're donating Justdiggit bunds in your name to reforest
sub-Saharan Africa. To claim your Community Growers certificate, please
contact David Berenstein in our Slack community or fill in this form
https://tally.so/r/n9XrxK once your PR has been merged. -->

# Description

This PR removes an unused API call function. Also the related tests have
been removed.


**Type of change**

(Please delete options that are not relevant. Remember to title the PR
according to the type of change)

- [ ] New feature (non-breaking change which adds functionality)
- [X] Refactor (change restructuring the codebase without changing
functionality)
- [ ] Improvement (change adding some improvement to an existing
functionality)

**How Has This Been Tested**

(Please describe the tests that you ran to verify your changes. And
ideally, reference `tests`)

- [ ] Test A
- [ ] Test B

**Checklist**

- [ ] I added relevant documentation
- [ ] I followed the style guidelines of this project
- [ ] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the `CHANGELOG.md` file (See
https://keepachangelog.com/)
  • Loading branch information
frascuchon authored Mar 22, 2024
1 parent 8efa11e commit 82a8294
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
21 changes: 0 additions & 21 deletions src/argilla/client/sdk/workspaces/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,6 @@
from argilla.client.sdk.workspaces.models import WorkspaceModel


def list_workspaces(client: httpx.Client) -> Response[Union[List[WorkspaceModel], ErrorMessage, HTTPValidationError]]:
"""Sends a request to `GET /api/workspaces` to list all the workspaces in the account.
Args:
client: the authenticated Argilla client to be used to send the request to the API.
Returns:
A Response object with the parsed response, containing a `parsed` attribute with the
parsed response if the request was successful, which is a list of `WorkspaceModel` objects.
"""
url = "/api/workspaces"

response = client.get(url=url)

if response.status_code == 200:
response_obj = Response.from_httpx_response(response)
response_obj.parsed = [WorkspaceModel(**workspace) for workspace in response.json()]
return response_obj
return handle_response_error(response)


def create_workspace(
client: httpx.Client, name: str
) -> Response[Union[WorkspaceModel, ErrorMessage, HTTPValidationError]]:
Expand Down
13 changes: 0 additions & 13 deletions tests/integration/client/sdk/api/test_workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
create_workspace_user,
delete_workspace_user,
list_workspace_users,
list_workspaces,
)
from argilla.client.sdk.workspaces.models import WorkspaceModel
from argilla.client.singleton import ArgillaSingleton
Expand All @@ -28,18 +27,6 @@
from tests.factories import WorkspaceFactory, WorkspaceUserFactory


@pytest.mark.asyncio
async def test_list_workspaces(owner: User) -> None:
await WorkspaceFactory.create(name="test_workspace")
httpx_client = ArgillaSingleton.init(api_key=owner.api_key).http_client.httpx

response = list_workspaces(client=httpx_client)
assert response.status_code == 200
assert isinstance(response.parsed, list)
assert len(response.parsed) > 0
assert isinstance(response.parsed[0], WorkspaceModel)


def test_create_workspace(owner: User) -> None:
httpx_client = ArgillaSingleton.init(api_key=owner.api_key).http_client.httpx

Expand Down

0 comments on commit 82a8294

Please sign in to comment.