Skip to content

Commit 596001e

Browse files
committed
MNT: fix linters
1 parent 0808b00 commit 596001e

File tree

8 files changed

+20
-13
lines changed

8 files changed

+20
-13
lines changed

pandas/tests/frame/test_query_eval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def test_query_duplicate_column_name(self, engine, parser):
168168
}
169169
).rename(columns={"B": "A"})
170170

171-
res = df.query('C == 1', engine=engine, parser=parser)
171+
res = df.query("C == 1", engine=engine, parser=parser)
172172

173173
expect = DataFrame(
174174
[[1, 1, 1]],
@@ -1411,7 +1411,7 @@ def test_expr_with_column_name_with_backtick_and_hash(self):
14111411
def test_expr_with_column_name_with_backtick(self):
14121412
# GH 59285
14131413
df = DataFrame({"a`b": (1, 2, 3), "ab": (4, 5, 6)})
1414-
result = df.query("`a``b` < 2") # noqa
1414+
result = df.query("`a``b` < 2")
14151415
# Note: Formatting checks may wrongly consider the above ``inline code``.
14161416
expected = df[df["a`b"] < 2]
14171417
tm.assert_frame_equal(result, expected)

pandas/tests/io/formats/test_to_latex.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import codecs
21
from datetime import datetime
32
from textwrap import dedent
43

pandas/tests/io/parser/test_quoting.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99
import pytest
1010

11-
from pandas.compat import PY311, PY314
11+
from pandas.compat import (
12+
PY311,
13+
PY314,
14+
)
1215
from pandas.errors import ParserError
1316

1417
from pandas import DataFrame
@@ -24,7 +27,7 @@
2427
if PY314:
2528
# TODO: write a regex that works with all new possitibilities here
2629
MSG1 = ""
27-
MSG2 = "[\s\S]*"
30+
MSG2 = r"[\s\S]*"
2831
else:
2932
MSG1 = "a(n)? 1-character string"
3033
MSG2 = "string( or None)?"

pandas/tests/reshape/merge/test_merge.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pytest
1010

1111
from pandas.compat import PY314
12+
1213
from pandas.core.dtypes.common import (
1314
is_object_dtype,
1415
is_string_dtype,
@@ -2426,7 +2427,8 @@ def test_merge_suffix_raises(suffixes):
24262427
@pytest.mark.parametrize(
24272428
"col1, col2, suffixes, msg",
24282429
[
2429-
("a", "a", ("a", "b", "c"), fr"too many values to unpack \(expected {TWO_GOT_THREE}\)"),
2430+
("a", "a", ("a", "b", "c"), (
2431+
fr"too many values to unpack \(expected {TWO_GOT_THREE}\)")),
24302432
("a", "a", tuple("a"), r"not enough values to unpack \(expected 2, got 1\)"),
24312433
],
24322434
)

pandas/tests/scalar/period/test_period.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import numpy as np
99
import pytest
1010

11-
from pandas.compat import PY314
1211
from pandas._libs.tslibs import iNaT
1312
from pandas._libs.tslibs.ccalendar import (
1413
DAYS,
@@ -17,6 +16,7 @@
1716
from pandas._libs.tslibs.np_datetime import OutOfBoundsDatetime
1817
from pandas._libs.tslibs.parsing import DateParseError
1918
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
19+
from pandas.compat import PY314
2020

2121
from pandas import (
2222
NaT,
@@ -346,7 +346,7 @@ def test_invalid_arguments(self):
346346
with pytest.raises(ValueError, match=msg):
347347
Period("-2000", "Y")
348348
if PY314:
349-
msg = 'day 0 must be in range 1..31 for month 1 in year 1: 0'
349+
msg = "day 0 must be in range 1..31 for month 1 in year 1: 0"
350350
else:
351351
msg = "day is out of range for month"
352352
with pytest.raises(DateParseError, match=msg):

pandas/tests/scalar/timestamp/test_constructors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import numpy as np
1717
import pytest
1818

19-
from pandas.compat import PY314
2019
from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
20+
from pandas.compat import PY314
2121
from pandas.errors import OutOfBoundsDatetime
2222

2323
from pandas import (
@@ -214,7 +214,7 @@ def test_constructor_positional(self):
214214
Timestamp(2000, 1)
215215

216216
if PY314:
217-
msg = 'month must be in 1..12, not'
217+
msg = "month must be in 1..12, not"
218218
else:
219219
msg = "day is out of range for month"
220220
with pytest.raises(ValueError, match=msg):

pandas/tests/tools/test_to_datetime.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
iNaT,
2222
parsing,
2323
)
24-
from pandas.compat import WASM, PY314
24+
from pandas.compat import (
25+
PY314,
26+
WASM,
27+
)
2528
from pandas.errors import (
2629
OutOfBoundsDatetime,
2730
OutOfBoundsTimedelta,
@@ -59,7 +62,8 @@
5962

6063
if PY314:
6164
NOT_99 = ", not 99"
62-
DAY_IS_OUT_OF_RANGE = "day \d{1,2} must be in range 1\.\.\d{1,2} for month \d{1,2} in year \d{4}"
65+
DAY_IS_OUT_OF_RANGE = (r"day \d{1,2} must be in range 1\.\.\d{1,2} for "
66+
r"month \d{1,2} in year \d{4}")
6367
else:
6468
NOT_99 = ""
6569
DAY_IS_OUT_OF_RANGE = "day is out of range for month"

pandas/util/_print_versions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import codecs
43
import json
54
import locale
65
import os

0 commit comments

Comments
 (0)