Skip to content

Commit 0128a5b

Browse files
[pre-commit.ci] pre-commit autoupdate (#54450)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/hauntsaninja/black-pre-commit-mirror: 23.3.0 → 23.7.0](psf/black-pre-commit-mirror@23.3.0...23.7.0) - [github.com/astral-sh/ruff-pre-commit: v0.0.277 → v0.0.282](astral-sh/ruff-pre-commit@v0.0.277...v0.0.282) - [github.com/asottile/pyupgrade: v3.7.0 → v3.10.1](asottile/pyupgrade@v3.7.0...v3.10.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update black, address ruff --------- 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 80753e2 commit 0128a5b

File tree

25 files changed

+43
-39
lines changed

25 files changed

+43
-39
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ ci:
2020
repos:
2121
- repo: https://github.com/hauntsaninja/black-pre-commit-mirror
2222
# black compiled with mypyc
23-
rev: 23.3.0
23+
rev: 23.7.0
2424
hooks:
2525
- id: black
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: v0.0.277
27+
rev: v0.0.282
2828
hooks:
2929
- id: ruff
3030
args: [--exit-non-zero-on-fix]
@@ -107,7 +107,7 @@ repos:
107107
hooks:
108108
- id: isort
109109
- repo: https://github.com/asottile/pyupgrade
110-
rev: v3.7.0
110+
rev: v3.10.1
111111
hooks:
112112
- id: pyupgrade
113113
args: [--py39-plus]

pandas/_config/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def _set_option(*args, **kwargs) -> None:
160160
silent = kwargs.pop("silent", False)
161161

162162
if kwargs:
163-
kwarg = list(kwargs.keys())[0]
163+
kwarg = next(iter(kwargs.keys()))
164164
raise TypeError(f'_set_option() got an unexpected keyword argument "{kwarg}"')
165165

166166
for k, v in zip(args[::2], args[1::2]):

pandas/_libs/lib.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ from typing import (
88
Generator,
99
Hashable,
1010
Literal,
11+
TypeAlias,
1112
overload,
1213
)
1314

@@ -31,7 +32,7 @@ class _NoDefault(Enum):
3132
no_default = ...
3233

3334
no_default: Final = _NoDefault.no_default
34-
NoDefault = Literal[_NoDefault.no_default]
35+
NoDefault: TypeAlias = Literal[_NoDefault.no_default]
3536

3637
i8max: int
3738
u8max: int

pandas/_libs/ops.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ from typing import (
33
Callable,
44
Iterable,
55
Literal,
6+
TypeAlias,
67
overload,
78
)
89

910
import numpy as np
1011

1112
from pandas._typing import npt
1213

13-
_BinOp = Callable[[Any, Any], Any]
14-
_BoolOp = Callable[[Any, Any], bool]
14+
_BinOp: TypeAlias = Callable[[Any, Any], Any]
15+
_BoolOp: TypeAlias = Callable[[Any, Any], bool]
1516

1617
def scalar_compare(
1718
values: np.ndarray, # object[:]

pandas/_libs/tslibs/nattype.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from datetime import (
33
timedelta,
44
tzinfo as _tzinfo,
55
)
6+
import typing
67

78
import numpy as np
89

@@ -12,7 +13,9 @@ NaT: NaTType
1213
iNaT: int
1314
nat_strings: set[str]
1415

15-
_NaTComparisonTypes = datetime | timedelta | Period | np.datetime64 | np.timedelta64
16+
_NaTComparisonTypes: typing.TypeAlias = (
17+
datetime | timedelta | Period | np.datetime64 | np.timedelta64
18+
)
1619

1720
class _NatComparison:
1821
def __call__(self, other: _NaTComparisonTypes) -> bool: ...

pandas/_libs/tslibs/timedeltas.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ from datetime import timedelta
22
from typing import (
33
ClassVar,
44
Literal,
5+
TypeAlias,
56
TypeVar,
67
overload,
78
)
@@ -19,7 +20,7 @@ from pandas._typing import (
1920

2021
# This should be kept consistent with the keys in the dict timedelta_abbrevs
2122
# in pandas/_libs/tslibs/timedeltas.pyx
22-
UnitChoices = Literal[
23+
UnitChoices: TypeAlias = Literal[
2324
"Y",
2425
"y",
2526
"M",

pandas/core/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def to_numpy(
636636
if isinstance(self.dtype, ExtensionDtype):
637637
return self.array.to_numpy(dtype, copy=copy, na_value=na_value, **kwargs)
638638
elif kwargs:
639-
bad_keys = list(kwargs.keys())[0]
639+
bad_keys = next(iter(kwargs.keys()))
640640
raise TypeError(
641641
f"to_numpy() got an unexpected keyword argument '{bad_keys}'"
642642
)

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ def from_dict(
17811781
if orient == "index":
17821782
if len(data) > 0:
17831783
# TODO speed up Series case
1784-
if isinstance(list(data.values())[0], (Series, dict)):
1784+
if isinstance(next(iter(data.values())), (Series, dict)):
17851785
data = _from_nested_dict(data)
17861786
else:
17871787
index = list(data.keys())

pandas/core/groupby/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ def _wrap_applied_output_series(
16681668
# GH6124 - propagate name of Series when it's consistent
16691669
names = {v.name for v in values}
16701670
if len(names) == 1:
1671-
columns.name = list(names)[0]
1671+
columns.name = next(iter(names))
16721672
else:
16731673
index = first_not_none.index
16741674
columns = key_index

pandas/core/indexes/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4788,7 +4788,7 @@ def _join_multi(self, other: Index, how: JoinHow):
47884788

47894789
return multi_join_idx, lidx, ridx
47904790

4791-
jl = list(overlap)[0]
4791+
jl = next(iter(overlap))
47924792

47934793
# Case where only one index is multi
47944794
# make the indices into mi's that match

0 commit comments

Comments
 (0)