Skip to content

Commit f2b471c

Browse files
committed
Merge branch 'main' into feature/cmp0xff/arithmetic-mul
2 parents 560695e + 10f5f92 commit f2b471c

20 files changed

+171
-176
lines changed

pyrightconfig-strict.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"enableTypeIgnoreComments": false,
66
"reportUnnecessaryTypeIgnoreComment": true,
77
"reportMissingModuleSource": true,
8-
"useLibraryCodeForTypes": false
8+
"useLibraryCodeForTypes": false,
9+
"reportUnknownLambdaType": false
910
}

scripts/_job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Step:
1414
rollback: Callable[[], None] | None = None
1515

1616

17-
def __rollback_job(steps: deque[Step]):
17+
def __rollback_job(steps: deque[Step]) -> None:
1818
"""
1919
Responsible to run rollback of steps.
2020
"""

scripts/test/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test(
2525
src: bool = False,
2626
dist: bool = False,
2727
type_checker: Literal["", "mypy", "pyright"] = "",
28-
):
28+
) -> None:
2929
steps = []
3030
if src:
3131
steps.extend(_SRC_STEPS)

scripts/test/run.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@
55
import sys
66

77

8-
def mypy_src():
8+
def mypy_src() -> None:
99
cmd = ["mypy", "pandas-stubs", "tests", "--no-incremental"]
1010
subprocess.run(cmd, check=True)
1111

1212

13-
def pyright_src():
13+
def pyright_src() -> None:
1414
cmd = ["pyright"]
1515
subprocess.run(cmd, check=True)
1616

1717

18-
def pyright_src_strict():
18+
def pyright_src_strict() -> None:
1919
cmd = ["pyright", "--project", "pyrightconfig-strict.json"]
2020
subprocess.run(cmd, check=True)
2121

2222

23-
def pytest():
23+
def pytest() -> None:
2424
cmd = ["pytest", "--cache-clear"]
2525
subprocess.run(cmd, check=True)
2626

2727

28-
def style():
28+
def style() -> None:
2929
cmd = ["pre-commit", "run", "--all-files", "--verbose"]
3030
subprocess.run(cmd, check=True)
3131

3232

33-
def stubtest(allowlist: str = "", check_missing: bool = False):
33+
def stubtest(allowlist: str = "", check_missing: bool = False) -> None:
3434
cmd = [
3535
sys.executable,
3636
"-m",
@@ -47,47 +47,47 @@ def stubtest(allowlist: str = "", check_missing: bool = False):
4747
subprocess.run(cmd, check=True)
4848

4949

50-
def build_dist():
50+
def build_dist() -> None:
5151
cmd = ["poetry", "build", "-f", "wheel"]
5252
subprocess.run(cmd, check=True)
5353

5454

55-
def install_dist():
55+
def install_dist() -> None:
5656
path = sorted(Path("dist/").glob("pandas_stubs-*.whl"))[-1]
5757
cmd = [sys.executable, "-m", "pip", "install", "--force-reinstall", str(path)]
5858
subprocess.run(cmd, check=True)
5959

6060

61-
def rename_src():
61+
def rename_src() -> None:
6262
if Path(r"pandas-stubs").exists():
6363
Path(r"pandas-stubs").rename("_pandas-stubs")
6464
else:
6565
raise FileNotFoundError("'pandas-stubs' folder does not exists.")
6666

6767

68-
def mypy_dist():
68+
def mypy_dist() -> None:
6969
cmd = ["mypy", "tests", "--no-incremental"]
7070
subprocess.run(cmd, check=True)
7171

7272

73-
def pyright_dist():
73+
def pyright_dist() -> None:
7474
cmd = ["pyright", "tests"]
7575
subprocess.run(cmd, check=True)
7676

7777

78-
def uninstall_dist():
78+
def uninstall_dist() -> None:
7979
cmd = [sys.executable, "-m", "pip", "uninstall", "-y", "pandas-stubs"]
8080
subprocess.run(cmd, check=True)
8181

8282

83-
def restore_src():
83+
def restore_src() -> None:
8484
if Path(r"_pandas-stubs").exists():
8585
Path(r"_pandas-stubs").rename("pandas-stubs")
8686
else:
8787
raise FileNotFoundError("'_pandas-stubs' folder does not exists.")
8888

8989

90-
def nightly_pandas():
90+
def nightly_pandas() -> None:
9191
cmd = [
9292
sys.executable,
9393
"-m",
@@ -110,13 +110,13 @@ def _get_version_from_pyproject(program: str) -> str:
110110
return version_line.split('"')[1]
111111

112112

113-
def released_pandas():
113+
def released_pandas() -> None:
114114
version = _get_version_from_pyproject("pandas")
115115
cmd = [sys.executable, "-m", "pip", "install", f"pandas=={version}"]
116116
subprocess.run(cmd, check=True)
117117

118118

119-
def nightly_mypy():
119+
def nightly_mypy() -> None:
120120
cmd = [
121121
sys.executable,
122122
"-m",
@@ -138,7 +138,7 @@ def nightly_mypy():
138138
)
139139

140140

141-
def released_mypy():
141+
def released_mypy() -> None:
142142
version = _get_version_from_pyproject("mypy")
143143
cmd = [sys.executable, "-m", "pip", "install", f"mypy=={version}"]
144144
subprocess.run(cmd, check=True)
@@ -152,7 +152,7 @@ def released_mypy():
152152
)
153153

154154

155-
def ty():
155+
def ty() -> None:
156156
cmd = [
157157
"ty",
158158
"check",
@@ -163,6 +163,6 @@ def ty():
163163
subprocess.run(cmd, check=True)
164164

165165

166-
def pyrefly():
166+
def pyrefly() -> None:
167167
cmd = ["pyrefly", "check", "pandas-stubs"]
168168
subprocess.run(cmd, check=True)

tests/indexes/test_indexes.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def test_index_rename_inplace() -> None:
223223
assert ind2 is None
224224

225225

226-
def test_index_dropna():
226+
def test_index_dropna() -> None:
227227
idx = pd.Index([1, 2])
228228

229229
check(assert_type(idx.dropna(how="all"), "pd.Index[int]"), pd.Index)
@@ -235,7 +235,7 @@ def test_index_dropna():
235235
check(assert_type(midx.dropna(how="any"), pd.MultiIndex), pd.MultiIndex)
236236

237237

238-
def test_index_neg():
238+
def test_index_neg() -> None:
239239
# GH 253
240240
idx = pd.Index([1, 2])
241241
check(assert_type(-idx, "pd.Index[int]"), pd.Index)
@@ -306,7 +306,7 @@ def test_index_relops() -> None:
306306
check(assert_type(ind > 2, np_1darray[np.bool]), np_1darray[np.bool])
307307

308308

309-
def test_range_index_union():
309+
def test_range_index_union() -> None:
310310
check(
311311
assert_type(
312312
pd.RangeIndex(0, 10).union(pd.RangeIndex(10, 20)),
@@ -342,14 +342,14 @@ def test_index_union_sort() -> None:
342342
)
343343

344344

345-
def test_range_index_start_stop_step():
345+
def test_range_index_start_stop_step() -> None:
346346
idx = pd.RangeIndex(3)
347347
check(assert_type(idx.start, int), int)
348348
check(assert_type(idx.stop, int), int)
349349
check(assert_type(idx.step, int), int)
350350

351351

352-
def test_interval_range():
352+
def test_interval_range() -> None:
353353
check(
354354
assert_type(pd.interval_range(0, 10), "pd.IntervalIndex[pd.Interval[int]]"),
355355
pd.IntervalIndex,
@@ -502,7 +502,7 @@ def test_interval_range():
502502
)
503503

504504

505-
def test_interval_index_breaks():
505+
def test_interval_index_breaks() -> None:
506506
check(
507507
assert_type(
508508
pd.IntervalIndex.from_breaks([1, 2, 3, 4]),
@@ -632,7 +632,7 @@ def test_interval_index_breaks():
632632
)
633633

634634

635-
def test_interval_index_arrays():
635+
def test_interval_index_arrays() -> None:
636636
check(
637637
assert_type(
638638
pd.IntervalIndex.from_arrays([1, 2, 3, 4], [2, 3, 4, 5]),
@@ -761,7 +761,7 @@ def test_interval_index_arrays():
761761
)
762762

763763

764-
def test_interval_index_tuples():
764+
def test_interval_index_tuples() -> None:
765765
check(
766766
assert_type(
767767
pd.IntervalIndex.from_tuples([(1, 2), (2, 3)]),
@@ -1082,13 +1082,13 @@ def test_range_index_range() -> None:
10821082
check(assert_type(iri, pd.RangeIndex), pd.RangeIndex, int)
10831083

10841084

1085-
def test_multiindex_dtypes():
1085+
def test_multiindex_dtypes() -> None:
10861086
# GH-597
10871087
mi = pd.MultiIndex.from_tuples([(1, 2.0), (2, 3.0)], names=["foo", "bar"])
10881088
check(assert_type(mi.dtypes, "pd.Series[Dtype]"), pd.Series)
10891089

10901090

1091-
def test_index_constructors():
1091+
def test_index_constructors() -> None:
10921092
# See if we can pick up the different index types in 2.0
10931093
# Eventually should be using a generic index
10941094
ilist = [1, 2, 3]

tests/scalars/test_scalars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def test_interval_math() -> None:
297297
) # pyright: ignore[reportOperatorIssue]
298298

299299

300-
def test_interval_cmp():
300+
def test_interval_cmp() -> None:
301301
interval_i = pd.Interval(0, 1, closed="left")
302302
interval_f = pd.Interval(0.0, 1.0, closed="right")
303303
interval_ts = pd.Interval(

tests/series/test_series.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ def test_types_to_dict() -> None:
18191819
assert_type(s.to_dict(), dict[Any, str])
18201820

18211821

1822-
def test_categorical_codes():
1822+
def test_categorical_codes() -> None:
18231823
# GH-111
18241824
cat = pd.Categorical(["a", "b", "a"])
18251825
check(assert_type(cat.codes, np_1darray[np.signedinteger]), np_1darray[np.int8])
@@ -1942,7 +1942,7 @@ def test_squeeze() -> None:
19421942
check(assert_type(s2.squeeze(), "pd.Series[int] | Scalar"), np.integer)
19431943

19441944

1945-
def test_to_xarray():
1945+
def test_to_xarray() -> None:
19461946
s = pd.Series([1, 2])
19471947
check(assert_type(s.to_xarray(), xr.DataArray), xr.DataArray)
19481948

@@ -3525,7 +3525,7 @@ def test_diff() -> None:
35253525
# str -> TypeError: unsupported operand type(s) for -: 'str' and 'str'
35263526
pd.Series(["a", "b"]).diff() # type: ignore[misc] # pyright: ignore[reportAttributeAccessIssue]
35273527

3528-
def _diff_invalid0(): # pyright: ignore[reportUnusedFunction]
3528+
def _diff_invalid0() -> None: # pyright: ignore[reportUnusedFunction]
35293529
# interval -> TypeError: IntervalArray has no 'diff' method. Convert to a suitable dtype prior to calling 'diff'.
35303530
assert_type(pd.Series([pd.Interval(0, 2), pd.Interval(1, 4)]).diff(), Never)
35313531

tests/test_api_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def test_union_categoricals() -> None:
373373

374374
def test_check_extension_dtypes() -> None:
375375
# GH 315
376-
def check_ext_dtype(etype: type[ExtensionDtype]):
376+
def check_ext_dtype(etype: type[ExtensionDtype]) -> None:
377377
assert issubclass(etype, ExtensionDtype)
378378

379379
check_ext_dtype(pd.Int64Dtype)

0 commit comments

Comments
 (0)