Skip to content

Commit 40131a6

Browse files
[pre-commit.ci] pre-commit autoupdate (#60470)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.7.2 → v0.8.1](astral-sh/ruff-pre-commit@v0.7.2...v0.8.1) - [github.com/MarcoGorelli/cython-lint: v0.16.2 → v0.16.6](MarcoGorelli/cython-lint@v0.16.2...v0.16.6) - [github.com/pre-commit/mirrors-clang-format: v19.1.3 → v19.1.4](pre-commit/mirrors-clang-format@v19.1.3...v19.1.4) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Apply ruff changes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
1 parent a14a8be commit 40131a6

Some content is hidden

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

66 files changed

+276
-307
lines changed

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ci:
1919
skip: [pyright, mypy]
2020
repos:
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.7.2
22+
rev: v0.8.1
2323
hooks:
2424
- id: ruff
2525
args: [--exit-non-zero-on-fix]
@@ -47,7 +47,7 @@ repos:
4747
types_or: [python, rst, markdown, cython, c]
4848
additional_dependencies: [tomli]
4949
- repo: https://github.com/MarcoGorelli/cython-lint
50-
rev: v0.16.2
50+
rev: v0.16.6
5151
hooks:
5252
- id: cython-lint
5353
- id: double-quote-cython-strings
@@ -95,7 +95,7 @@ repos:
9595
- id: sphinx-lint
9696
args: ["--enable", "all", "--disable", "line-too-long"]
9797
- repo: https://github.com/pre-commit/mirrors-clang-format
98-
rev: v19.1.3
98+
rev: v19.1.4
9999
hooks:
100100
- id: clang-format
101101
files: ^pandas/_libs/src|^pandas/_libs/include

asv_bench/benchmarks/groupby.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,7 @@ def setup(self, dtype, method, application, ncols, engine):
511511
# grouping on multiple columns
512512
# and we lack kernels for a bunch of methods
513513
if (
514-
engine == "numba"
515-
and method in _numba_unsupported_methods
514+
(engine == "numba" and method in _numba_unsupported_methods)
516515
or ncols > 1
517516
or application == "transformation"
518517
or dtype == "datetime"

pandas/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@
235235
# Pandas is not (yet) a py.typed library: the public API is determined
236236
# based on the documentation.
237237
__all__ = [
238+
"NA",
238239
"ArrowDtype",
239240
"BooleanDtype",
240241
"Categorical",
@@ -253,15 +254,14 @@
253254
"HDFStore",
254255
"Index",
255256
"IndexSlice",
257+
"Int8Dtype",
256258
"Int16Dtype",
257259
"Int32Dtype",
258260
"Int64Dtype",
259-
"Int8Dtype",
260261
"Interval",
261262
"IntervalDtype",
262263
"IntervalIndex",
263264
"MultiIndex",
264-
"NA",
265265
"NaT",
266266
"NamedAgg",
267267
"Period",
@@ -274,10 +274,10 @@
274274
"Timedelta",
275275
"TimedeltaIndex",
276276
"Timestamp",
277+
"UInt8Dtype",
277278
"UInt16Dtype",
278279
"UInt32Dtype",
279280
"UInt64Dtype",
280-
"UInt8Dtype",
281281
"api",
282282
"array",
283283
"arrays",
@@ -290,8 +290,8 @@
290290
"errors",
291291
"eval",
292292
"factorize",
293-
"get_dummies",
294293
"from_dummies",
294+
"get_dummies",
295295
"get_option",
296296
"infer_freq",
297297
"interval_range",

pandas/_config/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
__all__ = [
1010
"config",
11+
"describe_option",
1112
"detect_console_encoding",
1213
"get_option",
13-
"set_option",
14-
"reset_option",
15-
"describe_option",
1614
"option_context",
1715
"options",
16+
"reset_option",
17+
"set_option",
1818
]
1919
from pandas._config import config
2020
from pandas._config import dates # pyright: ignore[reportUnusedImport] # noqa: F401

pandas/_libs/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
__all__ = [
2+
"Interval",
23
"NaT",
34
"NaTType",
45
"OutOfBoundsDatetime",
56
"Period",
67
"Timedelta",
78
"Timestamp",
89
"iNaT",
9-
"Interval",
1010
]
1111

1212

pandas/_libs/tslibs/__init__.py

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
__all__ = [
2-
"dtypes",
3-
"localize_pydatetime",
2+
"BaseOffset",
3+
"IncompatibleFrequency",
44
"NaT",
55
"NaTType",
6-
"iNaT",
7-
"nat_strings",
86
"OutOfBoundsDatetime",
97
"OutOfBoundsTimedelta",
10-
"IncompatibleFrequency",
118
"Period",
129
"Resolution",
10+
"Tick",
1311
"Timedelta",
14-
"normalize_i8_timestamps",
15-
"is_date_array_normalized",
16-
"dt64arr_to_periodarr",
12+
"Timestamp",
13+
"add_overflowsafe",
14+
"astype_overflowsafe",
1715
"delta_to_nanoseconds",
16+
"dt64arr_to_periodarr",
17+
"dtypes",
18+
"get_resolution",
19+
"get_supported_dtype",
20+
"get_unit_from_dtype",
21+
"guess_datetime_format",
22+
"iNaT",
1823
"ints_to_pydatetime",
1924
"ints_to_pytimedelta",
20-
"get_resolution",
21-
"Timestamp",
22-
"tz_convert_from_utc_single",
23-
"tz_convert_from_utc",
24-
"to_offset",
25-
"Tick",
26-
"BaseOffset",
27-
"tz_compare",
25+
"is_date_array_normalized",
26+
"is_supported_dtype",
2827
"is_unitless",
29-
"astype_overflowsafe",
30-
"get_unit_from_dtype",
28+
"localize_pydatetime",
29+
"nat_strings",
30+
"normalize_i8_timestamps",
3131
"periods_per_day",
3232
"periods_per_second",
33-
"guess_datetime_format",
34-
"add_overflowsafe",
35-
"get_supported_dtype",
36-
"is_supported_dtype",
33+
"to_offset",
34+
"tz_compare",
35+
"tz_convert_from_utc",
36+
"tz_convert_from_utc_single",
3737
]
3838

3939
from pandas._libs.tslibs import dtypes

pandas/_testing/__init__.py

+22-22
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,25 @@ def shares_memory(left, right) -> bool:
540540
"ALL_INT_NUMPY_DTYPES",
541541
"ALL_NUMPY_DTYPES",
542542
"ALL_REAL_NUMPY_DTYPES",
543+
"BOOL_DTYPES",
544+
"BYTES_DTYPES",
545+
"COMPLEX_DTYPES",
546+
"DATETIME64_DTYPES",
547+
"ENDIAN",
548+
"FLOAT_EA_DTYPES",
549+
"FLOAT_NUMPY_DTYPES",
550+
"NARROW_NP_DTYPES",
551+
"NP_NAT_OBJECTS",
552+
"NULL_OBJECTS",
553+
"OBJECT_DTYPES",
554+
"SIGNED_INT_EA_DTYPES",
555+
"SIGNED_INT_NUMPY_DTYPES",
556+
"STRING_DTYPES",
557+
"TIMEDELTA64_DTYPES",
558+
"UNSIGNED_INT_EA_DTYPES",
559+
"UNSIGNED_INT_NUMPY_DTYPES",
560+
"SubclassedDataFrame",
561+
"SubclassedSeries",
543562
"assert_almost_equal",
544563
"assert_attr_equal",
545564
"assert_categorical_equal",
@@ -563,51 +582,32 @@ def shares_memory(left, right) -> bool:
563582
"assert_sp_array_equal",
564583
"assert_timedelta_array_equal",
565584
"at",
566-
"BOOL_DTYPES",
567585
"box_expected",
568-
"BYTES_DTYPES",
569586
"can_set_locale",
570-
"COMPLEX_DTYPES",
571587
"convert_rows_list_to_csv_str",
572-
"DATETIME64_DTYPES",
573588
"decompress_file",
574-
"ENDIAN",
575589
"ensure_clean",
576590
"external_error_raised",
577-
"FLOAT_EA_DTYPES",
578-
"FLOAT_NUMPY_DTYPES",
579591
"get_cython_table_params",
580592
"get_dtype",
581-
"getitem",
582-
"get_locales",
583593
"get_finest_unit",
594+
"get_locales",
584595
"get_obj",
585596
"get_op_from_name",
597+
"getitem",
586598
"iat",
587599
"iloc",
588600
"loc",
589601
"maybe_produces_warning",
590-
"NARROW_NP_DTYPES",
591-
"NP_NAT_OBJECTS",
592-
"NULL_OBJECTS",
593-
"OBJECT_DTYPES",
594602
"raise_assert_detail",
595603
"raises_chained_assignment_error",
596604
"round_trip_pathlib",
597605
"round_trip_pickle",
598-
"setitem",
599606
"set_locale",
600607
"set_timezone",
608+
"setitem",
601609
"shares_memory",
602-
"SIGNED_INT_EA_DTYPES",
603-
"SIGNED_INT_NUMPY_DTYPES",
604-
"STRING_DTYPES",
605-
"SubclassedDataFrame",
606-
"SubclassedSeries",
607-
"TIMEDELTA64_DTYPES",
608610
"to_array",
609-
"UNSIGNED_INT_EA_DTYPES",
610-
"UNSIGNED_INT_NUMPY_DTYPES",
611611
"with_csv_dialect",
612612
"write_to_compressed",
613613
]

pandas/_testing/asserters.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -755,11 +755,8 @@ def assert_extension_array_equal(
755755
and atol is lib.no_default
756756
):
757757
check_exact = (
758-
is_numeric_dtype(left.dtype)
759-
and not is_float_dtype(left.dtype)
760-
or is_numeric_dtype(right.dtype)
761-
and not is_float_dtype(right.dtype)
762-
)
758+
is_numeric_dtype(left.dtype) and not is_float_dtype(left.dtype)
759+
) or (is_numeric_dtype(right.dtype) and not is_float_dtype(right.dtype))
763760
elif check_exact is lib.no_default:
764761
check_exact = False
765762

@@ -944,11 +941,8 @@ def assert_series_equal(
944941
and atol is lib.no_default
945942
):
946943
check_exact = (
947-
is_numeric_dtype(left.dtype)
948-
and not is_float_dtype(left.dtype)
949-
or is_numeric_dtype(right.dtype)
950-
and not is_float_dtype(right.dtype)
951-
)
944+
is_numeric_dtype(left.dtype) and not is_float_dtype(left.dtype)
945+
) or (is_numeric_dtype(right.dtype) and not is_float_dtype(right.dtype))
952946
left_index_dtypes = (
953947
[left.index.dtype] if left.index.nlevels == 1 else left.index.dtypes
954948
)

pandas/_typing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def mode(self) -> str:
273273
# for _get_filepath_or_buffer
274274
...
275275

276-
def seek(self, __offset: int, __whence: int = ...) -> int:
276+
def seek(self, offset: int, whence: int = ..., /) -> int:
277277
# with one argument: gzip.GzipFile, bz2.BZ2File
278278
# with two arguments: zip.ZipFile, read_sas
279279
...
@@ -288,13 +288,13 @@ def tell(self) -> int:
288288

289289

290290
class ReadBuffer(BaseBuffer, Protocol[AnyStr_co]):
291-
def read(self, __n: int = ...) -> AnyStr_co:
291+
def read(self, n: int = ..., /) -> AnyStr_co:
292292
# for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File
293293
...
294294

295295

296296
class WriteBuffer(BaseBuffer, Protocol[AnyStr_contra]):
297-
def write(self, __b: AnyStr_contra) -> Any:
297+
def write(self, b: AnyStr_contra, /) -> Any:
298298
# for gzip.GzipFile, bz2.BZ2File
299299
...
300300

pandas/api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
)
1010

1111
__all__ = [
12-
"interchange",
1312
"extensions",
1413
"indexers",
14+
"interchange",
1515
"types",
1616
"typing",
1717
]

pandas/api/extensions/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
)
2222

2323
__all__ = [
24-
"no_default",
24+
"ExtensionArray",
2525
"ExtensionDtype",
26-
"register_extension_dtype",
26+
"ExtensionScalarOpsMixin",
27+
"no_default",
2728
"register_dataframe_accessor",
29+
"register_extension_dtype",
2830
"register_index_accessor",
2931
"register_series_accessor",
3032
"take",
31-
"ExtensionArray",
32-
"ExtensionScalarOpsMixin",
3333
]

pandas/api/indexers/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
)
1111

1212
__all__ = [
13-
"check_array_indexer",
1413
"BaseIndexer",
1514
"FixedForwardWindowIndexer",
1615
"VariableOffsetWindowIndexer",
16+
"check_array_indexer",
1717
]

pandas/api/interchange/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
from pandas.core.interchange.dataframe_protocol import DataFrame
66
from pandas.core.interchange.from_dataframe import from_dataframe
77

8-
__all__ = ["from_dataframe", "DataFrame"]
8+
__all__ = ["DataFrame", "from_dataframe"]

pandas/api/types/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
)
1515

1616
__all__ = [
17-
"infer_dtype",
18-
"union_categoricals",
1917
"CategoricalDtype",
2018
"DatetimeTZDtype",
2119
"IntervalDtype",
2220
"PeriodDtype",
21+
"infer_dtype",
22+
"union_categoricals",
2323
]

pandas/api/typing/__init__.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,16 @@
4242
"ExponentialMovingWindowGroupby",
4343
"FrozenList",
4444
"JsonReader",
45-
"NaTType",
4645
"NAType",
46+
"NaTType",
4747
"PeriodIndexResamplerGroupby",
4848
"Resampler",
4949
"Rolling",
5050
"RollingGroupby",
51+
"SASReader",
5152
"SeriesGroupBy",
5253
"StataReader",
53-
"SASReader",
54-
# See TODO above
55-
# "Styler",
56-
"TimedeltaIndexResamplerGroupby",
5754
"TimeGrouper",
55+
"TimedeltaIndexResamplerGroupby",
5856
"Window",
5957
]

0 commit comments

Comments
 (0)