Skip to content

Commit 07f4523

Browse files
committed
Bump ruff to 0.2.0
1 parent 8baee5d commit 07f4523

File tree

8 files changed

+18
-12
lines changed

8 files changed

+18
-12
lines changed

.pre-commit-config.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ci:
1919
skip: [pylint, pyright, mypy]
2020
repos:
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.1.6
22+
rev: v0.2.1
2323
hooks:
2424
- id: ruff
2525
args: [--exit-non-zero-on-fix]
@@ -31,10 +31,8 @@ repos:
3131
exclude: ^pandas/tests
3232
args: [--select, "ANN001,ANN2", --fix-only, --exit-non-zero-on-fix]
3333
- id: ruff-format
34-
# TODO: "." not needed in ruff 0.1.8
35-
args: ["."]
3634
- repo: https://github.com/jendrikseipp/vulture
37-
rev: 'v2.10'
35+
rev: v2.11
3836
hooks:
3937
- id: vulture
4038
entry: python scripts/run_vulture.py

pandas/core/apply.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,7 @@ def normalize_keyword_aggregation(
17941794

17951795

17961796
def _make_unique_kwarg_list(
1797-
seq: Sequence[tuple[Any, Any]]
1797+
seq: Sequence[tuple[Any, Any]],
17981798
) -> Sequence[tuple[Any, Any]]:
17991799
"""
18001800
Uniquify aggfunc name of the pairs in the order list

pandas/io/parsers/c_parser_wrapper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def _concatenate_chunks(chunks: list[dict[int, ArrayLike]]) -> dict:
396396

397397

398398
def ensure_dtype_objs(
399-
dtype: DtypeArg | dict[Hashable, DtypeArg] | None
399+
dtype: DtypeArg | dict[Hashable, DtypeArg] | None,
400400
) -> DtypeObj | dict[Hashable, DtypeObj] | None:
401401
"""
402402
Ensure we have either None, a dtype object, or a dictionary mapping to

pandas/plotting/_matplotlib/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def _validate_color_args(self, color, colormap):
465465
@final
466466
@staticmethod
467467
def _iter_data(
468-
data: DataFrame | dict[Hashable, Series | DataFrame]
468+
data: DataFrame | dict[Hashable, Series | DataFrame],
469469
) -> Iterator[tuple[Hashable, np.ndarray]]:
470470
for col, values in data.items():
471471
# This was originally written to use values.values before EAs

pandas/plotting/_matplotlib/tools.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,15 @@ def _get_layout(
9898
nrows, ncols = layout
9999

100100
if nrows == -1 and ncols > 0:
101-
layout = nrows, ncols = (ceil(nplots / ncols), ncols)
101+
layout = (ceil(nplots / ncols), ncols)
102102
elif ncols == -1 and nrows > 0:
103-
layout = nrows, ncols = (nrows, ceil(nplots / nrows))
103+
layout = (nrows, ceil(nplots / nrows))
104104
elif ncols <= 0 and nrows <= 0:
105105
msg = "At least one dimension of layout must be positive"
106106
raise ValueError(msg)
107107

108+
nrows, ncols = layout
109+
108110
if nrows * ncols < nplots:
109111
raise ValueError(
110112
f"Layout of {nrows}x{ncols} must be larger than required size {nplots}"

pandas/tests/indexes/multi/test_join.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def test_join_dtypes_all_nan(any_numeric_ea_dtype):
260260

261261
def test_join_index_levels():
262262
# GH#53093
263-
midx = midx = MultiIndex.from_tuples([("a", "2019-02-01"), ("a", "2019-02-01")])
263+
midx = MultiIndex.from_tuples([("a", "2019-02-01"), ("a", "2019-02-01")])
264264
midx2 = MultiIndex.from_tuples([("a", "2019-01-31")])
265265
result = midx.join(midx2, how="outer")
266266
expected = MultiIndex.from_tuples(

pyproject.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ environment = {CFLAGS="-g0"}
187187
line-length = 88
188188
target-version = "py310"
189189
fix = true
190+
191+
[tool.ruff.lint]
190192
unfixable = []
191193
typing-modules = ["pandas._typing"]
192194

@@ -275,6 +277,9 @@ ignore = [
275277
"PYI024",
276278
# No builtin `eval()` allowed
277279
"PGH001",
280+
# "S307", # flake8-bandit is not enabled yet
281+
# compare-to-empty-string
282+
"PLC1901",
278283
# while int | float can be shortened to float, the former is more explicit
279284
"PYI041",
280285
# incorrect-dict-iterator, flags valid Series.items usage
@@ -315,7 +320,7 @@ ignore = [
315320
# pairwise-over-zipped (>=PY310 only)
316321
"RUF007",
317322
# mutable-class-default
318-
"RUF012"
323+
"RUF012",
319324
]
320325

321326
exclude = [
@@ -334,6 +339,7 @@ exclude = [
334339
"urllib.request.urlopen".msg = "Use pandas.io.common.urlopen instead of urllib.request.urlopen"
335340

336341
[tool.ruff.per-file-ignores]
342+
[tool.ruff.lint.per-file-ignores]
337343
# relative imports allowed for asv_bench
338344
"asv_bench/*" = ["TID", "NPY002"]
339345
# to be enabled gradually

scripts/validate_min_versions_in_sync.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def get_operator_from(dependency: str) -> str | None:
105105

106106

107107
def get_yaml_map_from(
108-
yaml_dic: list[str | dict[str, list[str]]]
108+
yaml_dic: list[str | dict[str, list[str]]],
109109
) -> dict[str, list[str] | None]:
110110
yaml_map: dict[str, list[str] | None] = {}
111111
for dependency in yaml_dic:

0 commit comments

Comments
 (0)