Skip to content

Commit c9b9abd

Browse files
committed
Bump ruff to 0.2.0
1 parent 05f75c6 commit c9b9abd

File tree

8 files changed

+18
-12
lines changed

8 files changed

+18
-12
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ environment = {CFLAGS="-g0"}
186186
line-length = 88
187187
target-version = "py310"
188188
fix = true
189+
190+
[tool.ruff.lint]
189191
unfixable = []
190192
typing-modules = ["pandas._typing"]
191193

@@ -274,6 +276,9 @@ ignore = [
274276
"PYI024",
275277
# No builtin `eval()` allowed
276278
"PGH001",
279+
# "S307", # flake8-bandit is not enabled yet
280+
# compare-to-empty-string
281+
"PLC1901",
277282
# while int | float can be shortened to float, the former is more explicit
278283
"PYI041",
279284
# incorrect-dict-iterator, flags valid Series.items usage
@@ -314,7 +319,7 @@ ignore = [
314319
# pairwise-over-zipped (>=PY310 only)
315320
"RUF007",
316321
# mutable-class-default
317-
"RUF012"
322+
"RUF012",
318323
]
319324

320325
exclude = [
@@ -333,6 +338,7 @@ exclude = [
333338
"urllib.request.urlopen".msg = "Use pandas.io.common.urlopen instead of urllib.request.urlopen"
334339

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

scripts/validate_min_versions_in_sync.py

Lines changed: 1 addition & 1 deletion
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)