Skip to content

Commit 51c6e79

Browse files
⬆️ UPGRADE: Autoupdate pre-commit config (#54043)
* ⬆️ UPGRADE: Autoupdate pre-commit config * add codespell, ignore RUF012 * noqa RUF011, ignore another ruff code * Rename --------- Co-authored-by: MarcoGorelli <[email protected]>
1 parent 76854ce commit 51c6e79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+202
-173
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
hooks:
2222
- id: black
2323
- repo: https://github.com/astral-sh/ruff-pre-commit
24-
rev: v0.0.270
24+
rev: v0.0.275
2525
hooks:
2626
- id: ruff
2727
args: [--exit-non-zero-on-fix]
@@ -33,7 +33,7 @@ repos:
3333
pass_filenames: true
3434
require_serial: false
3535
- repo: https://github.com/codespell-project/codespell
36-
rev: v2.2.4
36+
rev: v2.2.5
3737
hooks:
3838
- id: codespell
3939
types_or: [python, rst, markdown, cython, c]
@@ -91,7 +91,7 @@ repos:
9191
hooks:
9292
- id: isort
9393
- repo: https://github.com/asottile/pyupgrade
94-
rev: v3.4.0
94+
rev: v3.7.0
9595
hooks:
9696
- id: pyupgrade
9797
args: [--py39-plus]

pandas/_libs/algos.pyi

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import numpy as np
55
from pandas._typing import npt
66

77
class Infinity:
8-
"""
9-
Provide a positive Infinity comparison method for ranking.
10-
"""
11-
128
def __eq__(self, other) -> bool: ...
139
def __ne__(self, other) -> bool: ...
1410
def __lt__(self, other) -> bool: ...
@@ -17,10 +13,6 @@ class Infinity:
1713
def __ge__(self, other) -> bool: ...
1814

1915
class NegInfinity:
20-
"""
21-
Provide a negative Infinity comparison method for ranking.
22-
"""
23-
2416
def __eq__(self, other) -> bool: ...
2517
def __ne__(self, other) -> bool: ...
2618
def __lt__(self, other) -> bool: ...

pandas/core/algorithms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ def searchsorted(
13221322
arr: ArrayLike,
13231323
value: NumpyValueArrayLike | ExtensionArray,
13241324
side: Literal["left", "right"] = "left",
1325-
sorter: NumpySorter = None,
1325+
sorter: NumpySorter | None = None,
13261326
) -> npt.NDArray[np.intp] | np.intp:
13271327
"""
13281328
Find indices where elements should be inserted to maintain order.

pandas/core/arrays/_mixins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def searchsorted(
233233
self,
234234
value: NumpyValueArrayLike | ExtensionArray,
235235
side: Literal["left", "right"] = "left",
236-
sorter: NumpySorter = None,
236+
sorter: NumpySorter | None = None,
237237
) -> npt.NDArray[np.intp] | np.intp:
238238
npvalue = self._validate_setitem_value(value)
239239
return self._ndarray.searchsorted(npvalue, side=side, sorter=sorter)

pandas/core/arrays/arrow/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ def searchsorted(
10561056
self,
10571057
value: NumpyValueArrayLike | ExtensionArray,
10581058
side: Literal["left", "right"] = "left",
1059-
sorter: NumpySorter = None,
1059+
sorter: NumpySorter | None = None,
10601060
) -> npt.NDArray[np.intp] | np.intp:
10611061
if self._hasna:
10621062
raise ValueError(

pandas/core/arrays/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ def searchsorted(
926926
self,
927927
value: NumpyValueArrayLike | ExtensionArray,
928928
side: Literal["left", "right"] = "left",
929-
sorter: NumpySorter = None,
929+
sorter: NumpySorter | None = None,
930930
) -> npt.NDArray[np.intp] | np.intp:
931931
"""
932932
Find indices where elements should be inserted to maintain order.

pandas/core/arrays/masked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ def searchsorted(
922922
self,
923923
value: NumpyValueArrayLike | ExtensionArray,
924924
side: Literal["left", "right"] = "left",
925-
sorter: NumpySorter = None,
925+
sorter: NumpySorter | None = None,
926926
) -> npt.NDArray[np.intp] | np.intp:
927927
if self._hasna:
928928
raise ValueError(

pandas/core/arrays/period.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ def searchsorted(
781781
self,
782782
value: NumpyValueArrayLike | ExtensionArray,
783783
side: Literal["left", "right"] = "left",
784-
sorter: NumpySorter = None,
784+
sorter: NumpySorter | None = None,
785785
) -> npt.NDArray[np.intp] | np.intp:
786786
npvalue = self._validate_setitem_value(value).view("M8[ns]")
787787

pandas/core/arrays/sparse/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ def searchsorted(
11341134
self,
11351135
v: ArrayLike | object,
11361136
side: Literal["left", "right"] = "left",
1137-
sorter: NumpySorter = None,
1137+
sorter: NumpySorter | None = None,
11381138
) -> npt.NDArray[np.intp] | np.intp:
11391139
msg = "searchsorted requires high memory usage."
11401140
warnings.warn(msg, PerformanceWarning, stacklevel=find_stack_level())

pandas/core/arrays/string_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def searchsorted(
513513
self,
514514
value: NumpyValueArrayLike | ExtensionArray,
515515
side: Literal["left", "right"] = "left",
516-
sorter: NumpySorter = None,
516+
sorter: NumpySorter | None = None,
517517
) -> npt.NDArray[np.intp] | np.intp:
518518
if self._hasna:
519519
raise ValueError(

pandas/core/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ def searchsorted(
13071307
self,
13081308
value: NumpyValueArrayLike | ExtensionArray,
13091309
side: Literal["left", "right"] = "left",
1310-
sorter: NumpySorter = None,
1310+
sorter: NumpySorter | None = None,
13111311
) -> npt.NDArray[np.intp] | np.intp:
13121312
if isinstance(value, ABCDataFrame):
13131313
msg = (

pandas/core/dtypes/dtypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _from_fastpath(
219219

220220
@classmethod
221221
def _from_categorical_dtype(
222-
cls, dtype: CategoricalDtype, categories=None, ordered: Ordered = None
222+
cls, dtype: CategoricalDtype, categories=None, ordered: Ordered | None = None
223223
) -> CategoricalDtype:
224224
if categories is ordered is None:
225225
return dtype

pandas/core/frame.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,7 +2563,7 @@ def to_stata(
25632563
version: int | None = 114,
25642564
convert_strl: Sequence[Hashable] | None = None,
25652565
compression: CompressionOptions = "infer",
2566-
storage_options: StorageOptions = None,
2566+
storage_options: StorageOptions | None = None,
25672567
value_labels: dict[Hashable, dict[float, str]] | None = None,
25682568
) -> None:
25692569
"""
@@ -2758,7 +2758,7 @@ def to_markdown(
27582758
buf: FilePath | WriteBuffer[str] | None = None,
27592759
mode: str = "wt",
27602760
index: bool = True,
2761-
storage_options: StorageOptions = None,
2761+
storage_options: StorageOptions | None = None,
27622762
**kwargs,
27632763
) -> str | None:
27642764
if "showindex" in kwargs:
@@ -2810,7 +2810,7 @@ def to_parquet(
28102810
compression: str | None = "snappy",
28112811
index: bool | None = None,
28122812
partition_cols: list[str] | None = None,
2813-
storage_options: StorageOptions = None,
2813+
storage_options: StorageOptions | None = None,
28142814
**kwargs,
28152815
) -> bytes | None:
28162816
"""
@@ -3179,7 +3179,7 @@ def to_xml(
31793179
parser: XMLParsers | None = "lxml",
31803180
stylesheet: FilePath | ReadBuffer[str] | ReadBuffer[bytes] | None = None,
31813181
compression: CompressionOptions = "infer",
3182-
storage_options: StorageOptions = None,
3182+
storage_options: StorageOptions | None = None,
31833183
) -> str | None:
31843184
"""
31853185
Render a DataFrame to an XML document.
@@ -5080,12 +5080,12 @@ def drop(
50805080

50815081
def drop(
50825082
self,
5083-
labels: IndexLabel = None,
5083+
labels: IndexLabel | None = None,
50845084
*,
50855085
axis: Axis = 0,
5086-
index: IndexLabel = None,
5087-
columns: IndexLabel = None,
5088-
level: Level = None,
5086+
index: IndexLabel | None = None,
5087+
columns: IndexLabel | None = None,
5088+
level: Level | None = None,
50895089
inplace: bool = False,
50905090
errors: IgnoreRaise = "raise",
50915091
) -> DataFrame | None:
@@ -5290,7 +5290,7 @@ def rename(
52905290
axis: Axis | None = None,
52915291
copy: bool | None = None,
52925292
inplace: bool = False,
5293-
level: Level = None,
5293+
level: Level | None = None,
52945294
errors: IgnoreRaise = "ignore",
52955295
) -> DataFrame | None:
52965296
"""
@@ -5805,7 +5805,7 @@ def reset_index(
58055805
col_level: Hashable = ...,
58065806
col_fill: Hashable = ...,
58075807
allow_duplicates: bool | lib.NoDefault = ...,
5808-
names: Hashable | Sequence[Hashable] = None,
5808+
names: Hashable | Sequence[Hashable] | None = None,
58095809
) -> DataFrame:
58105810
...
58115811

@@ -5819,7 +5819,7 @@ def reset_index(
58195819
col_level: Hashable = ...,
58205820
col_fill: Hashable = ...,
58215821
allow_duplicates: bool | lib.NoDefault = ...,
5822-
names: Hashable | Sequence[Hashable] = None,
5822+
names: Hashable | Sequence[Hashable] | None = None,
58235823
) -> None:
58245824
...
58255825

@@ -5833,20 +5833,20 @@ def reset_index(
58335833
col_level: Hashable = ...,
58345834
col_fill: Hashable = ...,
58355835
allow_duplicates: bool | lib.NoDefault = ...,
5836-
names: Hashable | Sequence[Hashable] = None,
5836+
names: Hashable | Sequence[Hashable] | None = None,
58375837
) -> DataFrame | None:
58385838
...
58395839

58405840
def reset_index(
58415841
self,
5842-
level: IndexLabel = None,
5842+
level: IndexLabel | None = None,
58435843
*,
58445844
drop: bool = False,
58455845
inplace: bool = False,
58465846
col_level: Hashable = 0,
58475847
col_fill: Hashable = "",
58485848
allow_duplicates: bool | lib.NoDefault = lib.no_default,
5849-
names: Hashable | Sequence[Hashable] = None,
5849+
names: Hashable | Sequence[Hashable] | None = None,
58505850
) -> DataFrame | None:
58515851
"""
58525852
Reset the index, or a level of it.
@@ -6142,7 +6142,7 @@ def dropna(
61426142
axis: Axis = 0,
61436143
how: AnyAll | lib.NoDefault = lib.no_default,
61446144
thresh: int | lib.NoDefault = lib.no_default,
6145-
subset: IndexLabel = None,
6145+
subset: IndexLabel | None = None,
61466146
inplace: bool = False,
61476147
ignore_index: bool = False,
61486148
) -> DataFrame | None:
@@ -6579,7 +6579,7 @@ def sort_values(
65796579
kind: SortKind = "quicksort",
65806580
na_position: str = "last",
65816581
ignore_index: bool = False,
6582-
key: ValueKeyFunc = None,
6582+
key: ValueKeyFunc | None = None,
65836583
) -> DataFrame | None:
65846584
"""
65856585
Sort by the values along either axis.
@@ -6858,14 +6858,14 @@ def sort_index(
68586858
self,
68596859
*,
68606860
axis: Axis = 0,
6861-
level: IndexLabel = None,
6861+
level: IndexLabel | None = None,
68626862
ascending: bool | Sequence[bool] = True,
68636863
inplace: bool = False,
68646864
kind: SortKind = "quicksort",
68656865
na_position: NaPosition = "last",
68666866
sort_remaining: bool = True,
68676867
ignore_index: bool = False,
6868-
key: IndexKeyFunc = None,
6868+
key: IndexKeyFunc | None = None,
68696869
) -> DataFrame | None:
68706870
"""
68716871
Sort object by labels (along an axis).
@@ -7633,7 +7633,11 @@ def _should_reindex_frame_op(self, right, op, axis: int, fill_value, level) -> b
76337633
return False
76347634

76357635
def _align_for_op(
7636-
self, other, axis: AxisInt, flex: bool | None = False, level: Level = None
7636+
self,
7637+
other,
7638+
axis: AxisInt,
7639+
flex: bool | None = False,
7640+
level: Level | None = None,
76377641
):
76387642
"""
76397643
Convert rhs to meet lhs dims if input is list, tuple or np.ndarray.
@@ -9387,7 +9391,7 @@ def melt(
93879391
value_vars=None,
93889392
var_name=None,
93899393
value_name: Hashable = "value",
9390-
col_level: Level = None,
9394+
col_level: Level | None = None,
93919395
ignore_index: bool = True,
93929396
) -> DataFrame:
93939397
return melt(

0 commit comments

Comments
 (0)