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

[pre-commit.ci] pre-commit autoupdate #171

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
rev: v1.5.5
hooks:
- id: insert-license
name: "Insert license header in Python source files"
Expand All @@ -11,8 +11,8 @@ repos:
- LICENSE_HEADER
- --fuzzy-match-generates-todo

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.4
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
hooks:
- id: ruff
args:
Expand Down
24 changes: 8 additions & 16 deletions src/argilla_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,11 @@ def __iter__(self):

@overload
@abstractmethod
def __getitem__(self, index: int) -> "User":
...
def __getitem__(self, index: int) -> "User": ...

@overload
@abstractmethod
def __getitem__(self, index: slice) -> Sequence["User"]:
...
def __getitem__(self, index: slice) -> Sequence["User"]: ...

def __getitem__(self, index):
model = self._api.list()[index]
Expand All @@ -150,12 +148,10 @@ def add(self, user: "User") -> "User":
return user.create()

@overload
def list(self) -> List["User"]:
...
def list(self) -> List["User"]: ...

@overload
def list(self, workspace: "Workspace") -> List["User"]:
...
def list(self, workspace: "Workspace") -> List["User"]: ...

def list(self, workspace: Optional["Workspace"] = None) -> List["User"]:
"""List all users."""
Expand Down Expand Up @@ -207,13 +203,11 @@ def __iter__(self):

@overload
@abstractmethod
def __getitem__(self, index: int) -> "Workspace":
...
def __getitem__(self, index: int) -> "Workspace": ...

@overload
@abstractmethod
def __getitem__(self, index: slice) -> Sequence["Workspace"]:
...
def __getitem__(self, index: slice) -> Sequence["Workspace"]: ...

def __getitem__(self, index) -> "Workspace":
model = self._api.list()[index]
Expand Down Expand Up @@ -287,13 +281,11 @@ def __iter__(self):

@overload
@abstractmethod
def __getitem__(self, index: int) -> "Dataset":
...
def __getitem__(self, index: int) -> "Dataset": ...

@overload
@abstractmethod
def __getitem__(self, index: slice) -> Sequence["Dataset"]:
...
def __getitem__(self, index: slice) -> Sequence["Dataset"]: ...

def __getitem__(self, index) -> "Dataset":
model = self._api.list()[index]
Expand Down
12 changes: 4 additions & 8 deletions src/argilla_sdk/workspaces/_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,21 @@ def __init__(self, workspace: "Workspace") -> None:
self._workspace = workspace

@overload
def add(self, user: "User") -> "User":
...
def add(self, user: "User") -> "User": ...

@overload
def add(self, user: str) -> "User":
...
def add(self, user: str) -> "User": ...

def add(self, user: Union["User", str]) -> "User":
if isinstance(user, str):
return self._add_user_by_username(username=user)
return user.add_to_workspace(workspace=self._workspace)

@overload
def delete(self, user: "User") -> "User":
...
def delete(self, user: "User") -> "User": ...

@overload
def delete(self, user: str) -> "User":
...
def delete(self, user: str) -> "User": ...

def delete(self, user: Union["User", str]) -> "User":
if isinstance(user, str):
Expand Down