Skip to content

Commit

Permalink
Update code to be aligned with ruff==0.3.4
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
  • Loading branch information
anmyachev committed Mar 28, 2024
1 parent d0307e7 commit 5b71040
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 178 deletions.
1 change: 1 addition & 0 deletions spec/API_specification/dataframe_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# mypy: disable-error-code="empty-body"
"""Function stubs and API documentation for the DataFrame API standard."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Literal
Expand Down
27 changes: 9 additions & 18 deletions spec/API_specification/dataframe_api/column_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,32 +579,23 @@ def __divmod__(self, other: Self | AnyScalar) -> tuple[Column, Column]:
"""
...

def __radd__(self, other: Self | AnyScalar) -> Self:
...
def __radd__(self, other: Self | AnyScalar) -> Self: ...

def __rsub__(self, other: Self | AnyScalar) -> Self:
...
def __rsub__(self, other: Self | AnyScalar) -> Self: ...

def __rmul__(self, other: Self | AnyScalar) -> Self:
...
def __rmul__(self, other: Self | AnyScalar) -> Self: ...

def __rtruediv__(self, other: Self | AnyScalar) -> Self:
...
def __rtruediv__(self, other: Self | AnyScalar) -> Self: ...

def __rand__(self, other: Self | bool) -> Self:
...
def __rand__(self, other: Self | bool) -> Self: ...

def __ror__(self, other: Self | bool) -> Self:
...
def __ror__(self, other: Self | bool) -> Self: ...

def __rfloordiv__(self, other: Self | AnyScalar) -> Self:
...
def __rfloordiv__(self, other: Self | AnyScalar) -> Self: ...

def __rpow__(self, other: Self | AnyScalar) -> Self:
...
def __rpow__(self, other: Self | AnyScalar) -> Self: ...

def __rmod__(self, other: Self | AnyScalar) -> Self:
...
def __rmod__(self, other: Self | AnyScalar) -> Self: ...

def __invert__(self) -> Self:
"""Invert truthiness of (boolean) elements.
Expand Down
27 changes: 9 additions & 18 deletions spec/API_specification/dataframe_api/dataframe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,32 +576,23 @@ def __divmod__(self, other: AnyScalar) -> tuple[DataFrame, DataFrame]:
"""
...

def __radd__(self, other: AnyScalar) -> Self:
...
def __radd__(self, other: AnyScalar) -> Self: ...

def __rsub__(self, other: AnyScalar) -> Self:
...
def __rsub__(self, other: AnyScalar) -> Self: ...

def __rmul__(self, other: AnyScalar) -> Self:
...
def __rmul__(self, other: AnyScalar) -> Self: ...

def __rtruediv__(self, other: AnyScalar) -> Self:
...
def __rtruediv__(self, other: AnyScalar) -> Self: ...

def __rand__(self, other: AnyScalar) -> Self:
...
def __rand__(self, other: AnyScalar) -> Self: ...

def __ror__(self, other: AnyScalar) -> Self:
...
def __ror__(self, other: AnyScalar) -> Self: ...

def __rfloordiv__(self, other: AnyScalar) -> Self:
...
def __rfloordiv__(self, other: AnyScalar) -> Self: ...

def __rpow__(self, other: AnyScalar) -> Self:
...
def __rpow__(self, other: AnyScalar) -> Self: ...

def __rmod__(self, other: AnyScalar) -> Self:
...
def __rmod__(self, other: AnyScalar) -> Self: ...

def __invert__(self) -> Self:
"""Invert truthiness of (boolean) elements.
Expand Down
66 changes: 22 additions & 44 deletions spec/API_specification/dataframe_api/groupby_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,48 +23,37 @@ class GroupBy(Protocol):
"""

def any(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
...
def any(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...

def all(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
...
def all(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...

def min(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
...
def min(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...

def max(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
...
def max(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...

def sum(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
...
def sum(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...

def prod(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
...
def prod(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...

def median(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
...
def median(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...

def mean(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
...
def mean(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...

def std(
self,
*,
correction: float | Scalar = 1,
skip_nulls: bool | Scalar = True,
) -> DataFrame:
...
) -> DataFrame: ...

def var(
self,
*,
correction: float | Scalar = 1,
skip_nulls: bool | Scalar = True,
) -> DataFrame:
...
) -> DataFrame: ...

def size(self) -> DataFrame:
...
def size(self) -> DataFrame: ...

def aggregate(self, *aggregation: Aggregation) -> DataFrame:
"""Aggregate columns according to given aggregation function.
Expand Down Expand Up @@ -93,36 +82,28 @@ def rename(self, name: str | Scalar) -> Aggregation:
...

@classmethod
def any(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
...
def any(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...

@classmethod
def all(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
...
def all(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...

@classmethod
def min(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
...
def min(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...

@classmethod
def max(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
...
def max(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...

@classmethod
def sum(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
...
def sum(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...

@classmethod
def prod(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
...
def prod(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...

@classmethod
def median(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
...
def median(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...

@classmethod
def mean(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
...
def mean(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...

@classmethod
def std(
Expand All @@ -131,8 +112,7 @@ def std(
*,
correction: float | Scalar = 1,
skip_nulls: bool | Scalar = True,
) -> Aggregation:
...
) -> Aggregation: ...

@classmethod
def var(
Expand All @@ -141,9 +121,7 @@ def var(
*,
correction: float | Scalar = 1,
skip_nulls: bool | Scalar = True,
) -> Aggregation:
...
) -> Aggregation: ...

@classmethod
def size(cls) -> Aggregation:
...
def size(cls) -> Aggregation: ...
57 changes: 19 additions & 38 deletions spec/API_specification/dataframe_api/scalar_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,73 +70,54 @@ def scalar(self) -> Any:
"""Return underlying (not-necessarily-Standard-compliant) scalar object."""
...

def __lt__(self, other: AnyScalar) -> Scalar:
...
def __lt__(self, other: AnyScalar) -> Scalar: ...

def __le__(self, other: AnyScalar) -> Scalar:
...
def __le__(self, other: AnyScalar) -> Scalar: ...

def __eq__(self, other: AnyScalar) -> Scalar: # type: ignore[override]
...

def __ne__(self, other: AnyScalar) -> Scalar: # type: ignore[override]
...

def __gt__(self, other: AnyScalar) -> Scalar:
...
def __gt__(self, other: AnyScalar) -> Scalar: ...

def __ge__(self, other: AnyScalar) -> Scalar:
...
def __ge__(self, other: AnyScalar) -> Scalar: ...

def __add__(self, other: AnyScalar) -> Scalar:
...
def __add__(self, other: AnyScalar) -> Scalar: ...

def __radd__(self, other: AnyScalar) -> Scalar:
...
def __radd__(self, other: AnyScalar) -> Scalar: ...

def __sub__(self, other: AnyScalar) -> Scalar:
...
def __sub__(self, other: AnyScalar) -> Scalar: ...

def __rsub__(self, other: AnyScalar) -> Scalar:
...
def __rsub__(self, other: AnyScalar) -> Scalar: ...

def __mul__(self, other: AnyScalar) -> Scalar:
...
def __mul__(self, other: AnyScalar) -> Scalar: ...

def __rmul__(self, other: AnyScalar) -> Scalar:
...
def __rmul__(self, other: AnyScalar) -> Scalar: ...

def __mod__(self, other: AnyScalar) -> Scalar:
...
def __mod__(self, other: AnyScalar) -> Scalar: ...

# Signatures of "__rmod__" of "Scalar" and "__mod__" of "str | int | float | Scalar"
# are unsafely overlapping
def __rmod__(self, other: AnyScalar) -> Scalar: # type: ignore[misc]
...

def __pow__(self, other: AnyScalar) -> Scalar:
...
def __pow__(self, other: AnyScalar) -> Scalar: ...

def __rpow__(self, other: AnyScalar) -> Scalar:
...
def __rpow__(self, other: AnyScalar) -> Scalar: ...

def __floordiv__(self, other: AnyScalar) -> Scalar:
...
def __floordiv__(self, other: AnyScalar) -> Scalar: ...

def __rfloordiv__(self, other: AnyScalar) -> Scalar:
...
def __rfloordiv__(self, other: AnyScalar) -> Scalar: ...

def __truediv__(self, other: AnyScalar) -> Scalar:
...
def __truediv__(self, other: AnyScalar) -> Scalar: ...

def __rtruediv__(self, other: AnyScalar) -> Scalar:
...
def __rtruediv__(self, other: AnyScalar) -> Scalar: ...

def __neg__(self) -> Scalar:
...
def __neg__(self) -> Scalar: ...

def __abs__(self) -> Scalar:
...
def __abs__(self) -> Scalar: ...

def __bool__(self) -> bool:
"""Note that this return a Python scalar.
Expand Down
Loading

0 comments on commit 5b71040

Please sign in to comment.