Skip to content

Commit 567de07

Browse files
CLN: Apply ruff format to scripts/ (#62269)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 3168604 commit 567de07

15 files changed

+52
-62
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ repos:
3232
exclude: ^pandas/tests
3333
args: [--select, "ANN001,ANN2", --fix-only, --exit-non-zero-on-fix]
3434
- id: ruff-format
35-
exclude: ^scripts|^pandas/tests/frame/test_query_eval.py
35+
exclude: ^pandas/tests/frame/test_query_eval.py
3636
- repo: https://github.com/jendrikseipp/vulture
3737
rev: v2.14
3838
hooks:

scripts/check_for_inconsistent_pandas_namespace.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
from typing import NamedTuple
3131

3232
ERROR_MESSAGE = (
33-
"{path}:{lineno}:{col_offset}: "
34-
"Found both '{prefix}.{name}' and '{name}' in {path}"
33+
"{path}:{lineno}:{col_offset}: Found both '{prefix}.{name}' and '{name}' in {path}"
3534
)
3635

3736

scripts/check_test_naming.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
NOTE: if this finds a false positive, you can add the comment `# not a test` to the
99
class or function definition. Though hopefully that shouldn't be necessary.
1010
"""
11+
1112
from __future__ import annotations
1213

1314
import argparse

scripts/generate_pip_deps_from_conda.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
generated with this script:
1313
$ python scripts/generate_pip_deps_from_conda.py --compare
1414
"""
15+
1516
import argparse
1617
import pathlib
1718
import re

scripts/pandas_errors_documented.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
pre-commit run pandas-errors-documented --all-files
88
"""
9+
910
from __future__ import annotations
1011

1112
import argparse

scripts/sort_whatsnew_note.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
2424
pre-commit run sort-whatsnew-items --all-files
2525
"""
26+
2627
from __future__ import annotations
2728

2829
import argparse

scripts/tests/test_check_test_naming.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
0,
2525
),
2626
(
27-
"class Foo: # not a test\n"
28-
" pass\n"
29-
"def test_foo():\n"
30-
" Class.foo()\n",
27+
"class Foo: # not a test\n pass\ndef test_foo():\n Class.foo()\n",
3128
"",
3229
0,
3330
),

scripts/tests/test_inconsistent_namespace_check.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@
55
)
66

77
BAD_FILE_0 = (
8-
"from pandas import Categorical\n"
9-
"cat_0 = Categorical()\n"
10-
"cat_1 = pd.Categorical()"
8+
"from pandas import Categorical\ncat_0 = Categorical()\ncat_1 = pd.Categorical()"
119
)
1210
BAD_FILE_1 = (
13-
"from pandas import Categorical\n"
14-
"cat_0 = pd.Categorical()\n"
15-
"cat_1 = Categorical()"
11+
"from pandas import Categorical\ncat_0 = pd.Categorical()\ncat_1 = Categorical()"
1612
)
1713
BAD_FILE_2 = (
1814
"from pandas import Categorical\n"

scripts/tests/test_validate_docstrings.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from scripts import validate_docstrings
77

88

9+
# fmt: off
910
class BadDocstrings:
1011
"""Everything here has a bad docstring"""
1112

@@ -88,6 +89,7 @@ def leftover_files(self) -> None:
8889
>>> import pathlib
8990
>>> pathlib.Path("foo.txt").touch()
9091
"""
92+
# fmt: on
9193

9294

9395
class TestValidator:
@@ -227,13 +229,13 @@ def test_validate_all_ignore_errors(self, monkeypatch):
227229
"errors": [
228230
("ER01", "err desc"),
229231
("ER02", "err desc"),
230-
("ER03", "err desc")
232+
("ER03", "err desc"),
231233
],
232234
"warnings": [],
233235
"examples_errors": "",
234236
"deprecated": True,
235237
"file": "file1",
236-
"file_line": "file_line1"
238+
"file_line": "file_line1",
237239
},
238240
)
239241
monkeypatch.setattr(
@@ -272,14 +274,13 @@ def test_validate_all_ignore_errors(self, monkeypatch):
272274
None: {"ER03"},
273275
"pandas.DataFrame.align": {"ER01"},
274276
# ignoring an error that is not requested should be of no effect
275-
"pandas.Index.all": {"ER03"}
276-
}
277+
"pandas.Index.all": {"ER03"},
278+
},
277279
)
278280
# two functions * two not global ignored errors - one function ignored error
279281
assert exit_status == 2 * 2 - 1
280282

281283

282-
283284
class TestApiItems:
284285
@property
285286
def api_doc(self):

scripts/tests/test_validate_unwanted_patterns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def test_nodefault_used_not_only_for_typing_raises(self, data, expected) -> None
307307
"DeprecationWarning",
308308
"PendingDeprecationWarning",
309309
"Pandas4Warning",
310-
"RuntimeWarning"
310+
"RuntimeWarning",
311311
],
312312
)
313313
@pytest.mark.parametrize("pdlint_ignore", [True, False])

0 commit comments

Comments
 (0)