Skip to content

Commit 7e76c38

Browse files
authored
Update code to be aligned with ruff==0.3.4 (#354)
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
1 parent d0307e7 commit 7e76c38

10 files changed

+95
-178
lines changed

spec/API_specification/dataframe_api/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# mypy: disable-error-code="empty-body"
22
"""Function stubs and API documentation for the DataFrame API standard."""
3+
34
from __future__ import annotations
45

56
from typing import TYPE_CHECKING, Any, Literal

spec/API_specification/dataframe_api/column_object.py

+9-18
Original file line numberDiff line numberDiff line change
@@ -579,32 +579,23 @@ def __divmod__(self, other: Self | AnyScalar) -> tuple[Column, Column]:
579579
"""
580580
...
581581

582-
def __radd__(self, other: Self | AnyScalar) -> Self:
583-
...
582+
def __radd__(self, other: Self | AnyScalar) -> Self: ...
584583

585-
def __rsub__(self, other: Self | AnyScalar) -> Self:
586-
...
584+
def __rsub__(self, other: Self | AnyScalar) -> Self: ...
587585

588-
def __rmul__(self, other: Self | AnyScalar) -> Self:
589-
...
586+
def __rmul__(self, other: Self | AnyScalar) -> Self: ...
590587

591-
def __rtruediv__(self, other: Self | AnyScalar) -> Self:
592-
...
588+
def __rtruediv__(self, other: Self | AnyScalar) -> Self: ...
593589

594-
def __rand__(self, other: Self | bool) -> Self:
595-
...
590+
def __rand__(self, other: Self | bool) -> Self: ...
596591

597-
def __ror__(self, other: Self | bool) -> Self:
598-
...
592+
def __ror__(self, other: Self | bool) -> Self: ...
599593

600-
def __rfloordiv__(self, other: Self | AnyScalar) -> Self:
601-
...
594+
def __rfloordiv__(self, other: Self | AnyScalar) -> Self: ...
602595

603-
def __rpow__(self, other: Self | AnyScalar) -> Self:
604-
...
596+
def __rpow__(self, other: Self | AnyScalar) -> Self: ...
605597

606-
def __rmod__(self, other: Self | AnyScalar) -> Self:
607-
...
598+
def __rmod__(self, other: Self | AnyScalar) -> Self: ...
608599

609600
def __invert__(self) -> Self:
610601
"""Invert truthiness of (boolean) elements.

spec/API_specification/dataframe_api/dataframe_object.py

+9-18
Original file line numberDiff line numberDiff line change
@@ -576,32 +576,23 @@ def __divmod__(self, other: AnyScalar) -> tuple[DataFrame, DataFrame]:
576576
"""
577577
...
578578

579-
def __radd__(self, other: AnyScalar) -> Self:
580-
...
579+
def __radd__(self, other: AnyScalar) -> Self: ...
581580

582-
def __rsub__(self, other: AnyScalar) -> Self:
583-
...
581+
def __rsub__(self, other: AnyScalar) -> Self: ...
584582

585-
def __rmul__(self, other: AnyScalar) -> Self:
586-
...
583+
def __rmul__(self, other: AnyScalar) -> Self: ...
587584

588-
def __rtruediv__(self, other: AnyScalar) -> Self:
589-
...
585+
def __rtruediv__(self, other: AnyScalar) -> Self: ...
590586

591-
def __rand__(self, other: AnyScalar) -> Self:
592-
...
587+
def __rand__(self, other: AnyScalar) -> Self: ...
593588

594-
def __ror__(self, other: AnyScalar) -> Self:
595-
...
589+
def __ror__(self, other: AnyScalar) -> Self: ...
596590

597-
def __rfloordiv__(self, other: AnyScalar) -> Self:
598-
...
591+
def __rfloordiv__(self, other: AnyScalar) -> Self: ...
599592

600-
def __rpow__(self, other: AnyScalar) -> Self:
601-
...
593+
def __rpow__(self, other: AnyScalar) -> Self: ...
602594

603-
def __rmod__(self, other: AnyScalar) -> Self:
604-
...
595+
def __rmod__(self, other: AnyScalar) -> Self: ...
605596

606597
def __invert__(self) -> Self:
607598
"""Invert truthiness of (boolean) elements.

spec/API_specification/dataframe_api/groupby_object.py

+22-44
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,37 @@ class GroupBy(Protocol):
2323
2424
"""
2525

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

29-
def all(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
30-
...
28+
def all(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...
3129

32-
def min(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
33-
...
30+
def min(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...
3431

35-
def max(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
36-
...
32+
def max(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...
3733

38-
def sum(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
39-
...
34+
def sum(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...
4035

41-
def prod(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
42-
...
36+
def prod(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...
4337

44-
def median(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
45-
...
38+
def median(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...
4639

47-
def mean(self, *, skip_nulls: bool | Scalar = True) -> DataFrame:
48-
...
40+
def mean(self, *, skip_nulls: bool | Scalar = True) -> DataFrame: ...
4941

5042
def std(
5143
self,
5244
*,
5345
correction: float | Scalar = 1,
5446
skip_nulls: bool | Scalar = True,
55-
) -> DataFrame:
56-
...
47+
) -> DataFrame: ...
5748

5849
def var(
5950
self,
6051
*,
6152
correction: float | Scalar = 1,
6253
skip_nulls: bool | Scalar = True,
63-
) -> DataFrame:
64-
...
54+
) -> DataFrame: ...
6555

66-
def size(self) -> DataFrame:
67-
...
56+
def size(self) -> DataFrame: ...
6857

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

9584
@classmethod
96-
def any(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
97-
...
85+
def any(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...
9886

9987
@classmethod
100-
def all(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
101-
...
88+
def all(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...
10289

10390
@classmethod
104-
def min(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
105-
...
91+
def min(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...
10692

10793
@classmethod
108-
def max(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
109-
...
94+
def max(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...
11095

11196
@classmethod
112-
def sum(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
113-
...
97+
def sum(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...
11498

11599
@classmethod
116-
def prod(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
117-
...
100+
def prod(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...
118101

119102
@classmethod
120-
def median(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
121-
...
103+
def median(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...
122104

123105
@classmethod
124-
def mean(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation:
125-
...
106+
def mean(cls, column: str, *, skip_nulls: bool | Scalar = True) -> Aggregation: ...
126107

127108
@classmethod
128109
def std(
@@ -131,8 +112,7 @@ def std(
131112
*,
132113
correction: float | Scalar = 1,
133114
skip_nulls: bool | Scalar = True,
134-
) -> Aggregation:
135-
...
115+
) -> Aggregation: ...
136116

137117
@classmethod
138118
def var(
@@ -141,9 +121,7 @@ def var(
141121
*,
142122
correction: float | Scalar = 1,
143123
skip_nulls: bool | Scalar = True,
144-
) -> Aggregation:
145-
...
124+
) -> Aggregation: ...
146125

147126
@classmethod
148-
def size(cls) -> Aggregation:
149-
...
127+
def size(cls) -> Aggregation: ...

spec/API_specification/dataframe_api/scalar_object.py

+19-38
Original file line numberDiff line numberDiff line change
@@ -70,73 +70,54 @@ def scalar(self) -> Any:
7070
"""Return underlying (not-necessarily-Standard-compliant) scalar object."""
7171
...
7272

73-
def __lt__(self, other: AnyScalar) -> Scalar:
74-
...
73+
def __lt__(self, other: AnyScalar) -> Scalar: ...
7574

76-
def __le__(self, other: AnyScalar) -> Scalar:
77-
...
75+
def __le__(self, other: AnyScalar) -> Scalar: ...
7876

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

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

85-
def __gt__(self, other: AnyScalar) -> Scalar:
86-
...
83+
def __gt__(self, other: AnyScalar) -> Scalar: ...
8784

88-
def __ge__(self, other: AnyScalar) -> Scalar:
89-
...
85+
def __ge__(self, other: AnyScalar) -> Scalar: ...
9086

91-
def __add__(self, other: AnyScalar) -> Scalar:
92-
...
87+
def __add__(self, other: AnyScalar) -> Scalar: ...
9388

94-
def __radd__(self, other: AnyScalar) -> Scalar:
95-
...
89+
def __radd__(self, other: AnyScalar) -> Scalar: ...
9690

97-
def __sub__(self, other: AnyScalar) -> Scalar:
98-
...
91+
def __sub__(self, other: AnyScalar) -> Scalar: ...
9992

100-
def __rsub__(self, other: AnyScalar) -> Scalar:
101-
...
93+
def __rsub__(self, other: AnyScalar) -> Scalar: ...
10294

103-
def __mul__(self, other: AnyScalar) -> Scalar:
104-
...
95+
def __mul__(self, other: AnyScalar) -> Scalar: ...
10596

106-
def __rmul__(self, other: AnyScalar) -> Scalar:
107-
...
97+
def __rmul__(self, other: AnyScalar) -> Scalar: ...
10898

109-
def __mod__(self, other: AnyScalar) -> Scalar:
110-
...
99+
def __mod__(self, other: AnyScalar) -> Scalar: ...
111100

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

117-
def __pow__(self, other: AnyScalar) -> Scalar:
118-
...
106+
def __pow__(self, other: AnyScalar) -> Scalar: ...
119107

120-
def __rpow__(self, other: AnyScalar) -> Scalar:
121-
...
108+
def __rpow__(self, other: AnyScalar) -> Scalar: ...
122109

123-
def __floordiv__(self, other: AnyScalar) -> Scalar:
124-
...
110+
def __floordiv__(self, other: AnyScalar) -> Scalar: ...
125111

126-
def __rfloordiv__(self, other: AnyScalar) -> Scalar:
127-
...
112+
def __rfloordiv__(self, other: AnyScalar) -> Scalar: ...
128113

129-
def __truediv__(self, other: AnyScalar) -> Scalar:
130-
...
114+
def __truediv__(self, other: AnyScalar) -> Scalar: ...
131115

132-
def __rtruediv__(self, other: AnyScalar) -> Scalar:
133-
...
116+
def __rtruediv__(self, other: AnyScalar) -> Scalar: ...
134117

135-
def __neg__(self) -> Scalar:
136-
...
118+
def __neg__(self) -> Scalar: ...
137119

138-
def __abs__(self) -> Scalar:
139-
...
120+
def __abs__(self) -> Scalar: ...
140121

141122
def __bool__(self) -> bool:
142123
"""Note that this return a Python scalar.

0 commit comments

Comments
 (0)