Skip to content

Commit

Permalink
Bug/workspace dataset user return lists (#4549)
Browse files Browse the repository at this point in the history
Closes #4548 

**Type of change**

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

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (change restructuring the codebase without changing
functionality)
- [ ] Improvement (change adding some improvement to an existing
functionality)
- [ ] Documentation update

**How Has This Been Tested**

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

- [x] Manually testing that Workspace, User and Feedback Dataset returns
a list.

**Checklist**

- [ ] I added relevant documentation
- [ ] follows the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] 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/)

---------

Co-authored-by: Alvaro Bartolome <[email protected]>
  • Loading branch information
ignacioct and alvarobartt authored Jan 31, 2024
1 parent 29fb9e5 commit f15cb07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/argilla/client/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,6 @@ def list(cls) -> Iterator["User"]:
"""
client = cls.__active_client()
try:
users = users_api.list_users(client).parsed
for user in users:
yield cls.__new_instance(client, user)
return [cls.__new_instance(client, user) for user in users_api.list_users(client).parsed]
except Exception as e:
raise RuntimeError("Error while listing the users from Argilla.") from e
8 changes: 5 additions & 3 deletions src/argilla/client/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,10 @@ def list(cls) -> Iterator["Workspace"]:
"""
client = cls.__active_client()
try:
workspaces = workspaces_api_v1.list_workspaces_me(client).parsed
for ws in workspaces:
yield cls._new_instance(client, ws)
return [
cls._new_instance(client, workspace)
for workspace in workspaces_api_v1.list_workspaces_me(client).parsed
]

except Exception as e:
raise RuntimeError("Error while retrieving the list of workspaces from Argilla.") from e

0 comments on commit f15cb07

Please sign in to comment.