Skip to content

Commit bfeb2ae

Browse files
committed
style: fix things so pylint is happy with ruff
1 parent 82467f7 commit bfeb2ae

File tree

5 files changed

+39
-33
lines changed

5 files changed

+39
-33
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ e4e238a9ed8f2ad2b9060247591b4c057c2953bf
3030

3131
# 2025-08-09 style: ruff check --fix --fixable=I001,Q000 coverage/*.py
3232
a32cd74bc0aaf0714acaf37beb21c84cbe2ee3ff
33+
34+
# 2025-08-21 chore: `ruff format .`
35+
82467f72306efdb207af09ace27b6b3ed4c7ad6f

coverage/phystokens.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def _phys_tokens(toks: TokenInfos) -> TokenInfos:
5555
if last_ttext.endswith("\\"):
5656
inject_backslash = False
5757
elif ttype == token.STRING:
58-
if (
59-
last_line.endswith("\\\n") # pylint: disable=simplifiable-if-statement
58+
if ( # pylint: disable=simplifiable-if-statement
59+
last_line.endswith("\\\n")
6060
and last_line.rstrip(" \\\n").endswith(last_ttext)
6161
):
6262
# Deal with special cases like such code::

coverage/pytracer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def log(self, marker: str, *args: Any) -> None:
128128
with open("/tmp/debug_trace.txt", "a", encoding="utf-8") as f:
129129
f.write(f"{marker} {self.id}[{len(self.data_stack)}]")
130130
if 0: # if you want thread ids..
131-
f.write(
132-
".{:x}.{:x}".format( # type: ignore[unreachable]
131+
f.write( # type: ignore[unreachable]
132+
".{:x}.{:x}".format(
133133
self.thread.ident,
134134
self.threading.current_thread().ident,
135135
)

tests/test_debug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def test_debug_write_exceptions(self) -> None:
338338
lines = debug.get_output().splitlines()
339339
assert "Something happened" == lines[0]
340340
assert "Traceback (most recent call last):" == lines[1]
341-
assert " raise RuntimeError('Oops') # This is in the traceback" in lines
341+
assert ' raise RuntimeError("Oops") # This is in the traceback' in lines
342342
assert "RuntimeError: Oops" == lines[-1]
343343

344344
def test_debug_write_self(self) -> None:

tests/test_parser.py

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -547,87 +547,90 @@ def very_long_function_to_exclude_name(
547547
exclude="function_to_exclude",
548548
)
549549
assert parser.statements == {1, 7}
550+
# linters and formatters can't agree about whether strings are too
551+
# long, so format in the long variable names that make them too long.
552+
long_arg = "super_long_input_argument"
550553
parser = self.parse_text(
551-
"""\
554+
f"""\
552555
def my_func(
553-
super_long_input_argument_0=0,
554-
super_long_input_argument_1=1,
555-
super_long_input_argument_2=2):
556+
{long_arg}_0=0,
557+
{long_arg}_1=1,
558+
{long_arg}_2=2):
556559
pass
557560
558-
def my_func_2(super_long_input_argument_0=0, super_long_input_argument_1=1, super_long_input_argument_2=2):
561+
def my_func_2({long_arg}_0=0, {long_arg}_1=1, {long_arg}_2=2):
559562
pass
560563
""",
561564
exclude="my_func",
562565
)
563566
assert parser.statements == set()
564567
parser = self.parse_text(
565-
"""\
568+
f"""\
566569
def my_func(
567-
super_long_input_argument_0=0,
568-
super_long_input_argument_1=1,
569-
super_long_input_argument_2=2):
570+
{long_arg}_0=0,
571+
{long_arg}_1=1,
572+
{long_arg}_2=2):
570573
pass
571574
572-
def my_func_2(super_long_input_argument_0=0, super_long_input_argument_1=1, super_long_input_argument_2=2):
575+
def my_func_2({long_arg}_0=0, {long_arg}_1=1, {long_arg}_2=2):
573576
pass
574577
""",
575578
exclude="my_func_2",
576579
)
577580
assert parser.statements == {1, 5}
578581
parser = self.parse_text(
579-
"""\
582+
f"""\
580583
def my_func (
581-
super_long_input_argument_0=0,
582-
super_long_input_argument_1=1,
583-
super_long_input_argument_2=2):
584+
{long_arg}_0=0,
585+
{long_arg}_1=1,
586+
{long_arg}_2=2):
584587
pass
585588
586-
def my_func_2 (super_long_input_argument_0=0, super_long_input_argument_1=1, super_long_input_argument_2=2):
589+
def my_func_2 ({long_arg}_0=0, {long_arg}_1=1, {long_arg}_2=2):
587590
pass
588591
""",
589592
exclude="my_func_2",
590593
)
591594
assert parser.statements == {1, 5}
592595
parser = self.parse_text(
593-
"""\
596+
f"""\
594597
def my_func (
595-
super_long_input_argument_0=0,
596-
super_long_input_argument_1=1,
597-
super_long_input_argument_2=2):
598+
{long_arg}_0=0,
599+
{long_arg}_1=1,
600+
{long_arg}_2=2):
598601
pass
599602
600-
def my_func_2 (super_long_input_argument_0=0, super_long_input_argument_1=1, super_long_input_argument_2=2):
603+
def my_func_2 ({long_arg}_0=0, {long_arg}_1=1, {long_arg}_2=2):
601604
pass
602605
""",
603606
exclude="my_func",
604607
)
605608
assert parser.statements == set()
606609
parser = self.parse_text(
607-
"""\
610+
f"""\
608611
def my_func \
609612
(
610-
super_long_input_argument_0=0,
611-
super_long_input_argument_1=1
613+
{long_arg}_0=0,
614+
{long_arg}_1=1
612615
):
613616
pass
614617
615-
def my_func_2(super_long_input_argument_0=0, super_long_input_argument_1=1, super_long_input_argument_2=2):
618+
def my_func_2({long_arg}_0=0, {long_arg}_1=1, {long_arg}_2=2):
616619
pass
617620
""",
618621
exclude="my_func_2",
619622
)
620623
assert parser.statements == {1, 5}
621624
parser = self.parse_text(
622-
"""\
625+
f"""\
623626
def my_func \
624627
(
625-
super_long_input_argument_0=0,
626-
super_long_input_argument_1=1
628+
{long_arg}_0=0,
629+
{long_arg}_1=1
627630
):
628631
pass
629632
630-
def my_func_2(super_long_input_argument_0=0, super_long_input_argument_1=1, super_long_input_argument_2=2):
633+
def my_func_2({long_arg}_0=0, {long_arg}_1=1, {long_arg}_2=2):
631634
pass
632635
""",
633636
exclude="my_func",

0 commit comments

Comments
 (0)