Skip to content

Commit 4df1cac

Browse files
authored
Update black (#579)
1 parent de06d14 commit 4df1cac

File tree

9 files changed

+150
-357
lines changed

9 files changed

+150
-357
lines changed

diff_cover/git_diff.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,10 @@ def diff_committed(self, compare_branch="origin/main"):
7272
)[0]
7373
except CommandError as e:
7474
if "unknown revision" in str(e):
75-
raise ValueError(
76-
dedent(
77-
f"""
75+
raise ValueError(dedent(f"""
7876
Could not find the branch to compare to. Does '{compare_branch}' exist?
7977
the `--compare-branch` argument allows you to set a different branch.
80-
"""
81-
)
82-
) from e
78+
""")) from e
8379
raise
8480

8581
def diff_unstaged(self):

diff_cover/violationsreporters/violations_reporter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ def parse_reports(self, reports):
831831
# Ignore any line that isn't matched
832832
# (for example, snippets from the source code)
833833
if match is not None:
834-
(cppcheck_src_path, line_number, message) = match.groups()
834+
cppcheck_src_path, line_number, message = match.groups()
835835

836836
violation = Violation(int(line_number), message)
837837
violations_dict[util.to_unix_path(cppcheck_src_path)].append(

poetry.lock

Lines changed: 45 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pyflakes = "^3.3.2"
5858
pylint = ">=3.3.4,<5.0.0"
5959
pylint-pytest = "^1.1.8"
6060
pydocstyle = "^6.1.1"
61-
black = "^25.1.0"
61+
black = "^26.1.0"
6262
isort = ">=6.0.1,<8.0.0"
6363
doc8 = "2.0.0"
6464
ruff = ">=0.11.10,<0.15.0"

tests/test_diff_reporter.py

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ def test_ignore_lines_outside_src(diff, git_diff):
246246
def test_one_line_file(diff, git_diff):
247247
# Files with only one line have a special format
248248
# in which the "length" part of the hunk is not specified
249-
diff_str = dedent(
250-
"""
249+
diff_str = dedent("""
251250
diff --git a/diff_cover/one_line.txt b/diff_cover/one_line.txt
252251
index 0867e73..9daeafb 100644
253252
--- a/diff_cover/one_line.txt
@@ -256,8 +255,7 @@ def test_one_line_file(diff, git_diff):
256255
test
257256
-test
258257
-test
259-
"""
260-
).strip()
258+
""").strip()
261259

262260
# Configure the git diff output
263261
_set_git_diff_output(diff, git_diff, diff_str, "", "")
@@ -291,8 +289,7 @@ def test_git_deleted_lines(diff, git_diff):
291289
def test_git_unicode_filename(diff, git_diff):
292290
# Filenames with unicode characters have double quotes surrounding them
293291
# in the git diff output.
294-
diff_str = dedent(
295-
"""
292+
diff_str = dedent("""
296293
diff --git "a/unic\303\270\342\210\202e\314\201.txt" "b/unic\303\270\342\210\202e\314\201.txt"
297294
new file mode 100644
298295
index 0000000..248ebea
@@ -302,8 +299,7 @@ def test_git_unicode_filename(diff, git_diff):
302299
+μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος
303300
+οὐλομένην, ἣ μυρί᾽ Ἀχαιοῖς ἄλγε᾽ ἔθηκε,
304301
+πολλὰς δ᾽ ἰφθίμους ψυχὰς Ἄϊδι προΐαψεν
305-
"""
306-
).strip()
302+
""").strip()
307303

308304
_set_git_diff_output(diff, git_diff, diff_str, "", "")
309305
# Get the lines changed in the diff
@@ -429,28 +425,22 @@ def test_git_diff_error(
429425
diff,
430426
git_diff,
431427
):
432-
invalid_hunk_str = dedent(
433-
"""
428+
invalid_hunk_str = dedent("""
434429
diff --git a/subdir/file1.py b/subdir/file1.py
435430
@@ invalid @@ Text
436-
"""
437-
).strip()
431+
""").strip()
438432

439433
no_src_line_str = "@@ -33,10 +34,13 @@ Text"
440434

441-
non_numeric_lines = dedent(
442-
"""
435+
non_numeric_lines = dedent("""
443436
diff --git a/subdir/file1.py b/subdir/file1.py
444437
@@ -1,2 +a,b @@
445-
"""
446-
).strip()
438+
""").strip()
447439

448-
missing_line_num = dedent(
449-
"""
440+
missing_line_num = dedent("""
450441
diff --git a/subdir/file1.py b/subdir/file1.py
451442
@@ -1,2 + @@
452-
"""
453-
).strip()
443+
""").strip()
454444

455445
missing_src_str = "diff --git "
456446

@@ -478,16 +468,14 @@ def test_git_diff_error(
478468

479469
def test_plus_sign_in_hunk_bug(diff, git_diff):
480470
# This was a bug that caused a parse error
481-
diff_str = dedent(
482-
"""
471+
diff_str = dedent("""
483472
diff --git a/file.py b/file.py
484473
@@ -16,16 +16,7 @@ 1 + 2
485474
+ test
486475
+ test
487476
+ test
488477
+ test
489-
"""
490-
)
478+
""")
491479

492480
_set_git_diff_output(diff, git_diff, diff_str, "", "")
493481

@@ -498,16 +486,14 @@ def test_plus_sign_in_hunk_bug(diff, git_diff):
498486
def test_terminating_chars_in_hunk(diff, git_diff):
499487
# Check what happens when there's an @@ symbol after the
500488
# first terminating @@ symbol
501-
diff_str = dedent(
502-
"""
489+
diff_str = dedent("""
503490
diff --git a/file.py b/file.py
504491
@@ -16,16 +16,7 @@ and another +23,2 @@ symbol
505492
+ test
506493
+ test
507494
+ test
508495
+ test
509-
"""
510-
)
496+
""")
511497

512498
_set_git_diff_output(diff, git_diff, diff_str, "", "")
513499

@@ -518,8 +504,7 @@ def test_terminating_chars_in_hunk(diff, git_diff):
518504
def test_merge_conflict_diff(diff, git_diff):
519505
# Handle different git diff format when in the middle
520506
# of a merge conflict
521-
diff_str = dedent(
522-
"""
507+
diff_str = dedent("""
523508
diff --cc subdir/src.py
524509
index d2034c0,e594d54..0000000
525510
diff --cc subdir/src.py
@@ -531,8 +516,7 @@ def test_merge_conflict_diff(diff, git_diff):
531516
++<<<<<< HEAD
532517
+ test
533518
++=======
534-
"""
535-
)
519+
""")
536520

537521
_set_git_diff_output(diff, git_diff, diff_str, "", "")
538522

0 commit comments

Comments
 (0)