From 6bc72b93b5db3a248d70442381e98929488054c0 Mon Sep 17 00:00:00 2001 From: Vivian Wang Date: Thu, 27 Aug 2026 11:13:02 +0800 Subject: [PATCH 1/3] tools: patchoulene: Clean up imports This is a ruff check fix. Signed-off-by: Vivian Wang --- patchoulene/src/patchoulene/__init__.py | 6 +----- patchoulene/src/patchoulene/git.py | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/patchoulene/src/patchoulene/__init__.py b/patchoulene/src/patchoulene/__init__.py index d3fa683..fc8da79 100644 --- a/patchoulene/src/patchoulene/__init__.py +++ b/patchoulene/src/patchoulene/__init__.py @@ -1,15 +1,11 @@ -import difflib import json import os -import pathlib import re -import shlex -import subprocess import sys from . import b4 -from .message import * from .git import GitCommit, GitRepo +from .message import * def series_entry(c: GitCommit): diff --git a/patchoulene/src/patchoulene/git.py b/patchoulene/src/patchoulene/git.py index 497bf87..a006304 100644 --- a/patchoulene/src/patchoulene/git.py +++ b/patchoulene/src/patchoulene/git.py @@ -2,8 +2,6 @@ import shlex import subprocess -from .message import message_subject, clean_subject - RE_HASH_LIKE = re.compile(r"[0-9a-f]+") From 3a000b176f1b8c8d6ce0d30f69fdc696043c09f9 Mon Sep 17 00:00:00 2001 From: Vivian Wang Date: Thu, 27 Aug 2026 11:13:17 +0800 Subject: [PATCH 2/3] tools: patchoulene: Clean up f-strings This is a ruff check fix. Signed-off-by: Vivian Wang --- patchoulene/src/patchoulene/__init__.py | 18 +++++++++--------- patchoulene/src/patchoulene/git.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/patchoulene/src/patchoulene/__init__.py b/patchoulene/src/patchoulene/__init__.py index fc8da79..2d50fa0 100644 --- a/patchoulene/src/patchoulene/__init__.py +++ b/patchoulene/src/patchoulene/__init__.py @@ -265,7 +265,7 @@ def msg_possible_match( msgs = [f"... the replacement of patch {possible}?"] if not is_id_match: - msgs.append(f"* (weak match)") + msgs.append("* (weak match)") msgs.append(f' "{old_subject}"{is_identical}') return "\n".join(msgs) @@ -399,7 +399,7 @@ def msg_replacement_header(commit: GitCommit) -> str: msgs = [ f'Commit {commit.commit[:12]} ("{clean}"):', f" {dim(primary)}", - f" has replacement:", + " has replacement:", ] return "\n".join(msgs) @@ -444,12 +444,12 @@ def do_mail_check(db: dict[str, dict]) -> list[dict[str, list[dict[str, str]]]]: def msg_thread_replacement( this_thread: list[b4.PatchHeader], latest_thread: list[b4.PatchHeader] ) -> str: - msgs = [f"Patches:"] + msgs = ["Patches:"] for m in this_thread: msgs.append(f" {m.clean_subject()}") msgs.append(f" https://patch.msgid.link/{m.message_id()}") - msgs.append(f"... may have replacement:") + msgs.append("... may have replacement:") for m in latest_thread: msgs.append(f" {m.clean_subject()}") msgs.append(f" https://patch.msgid.link/{m.message_id()}") @@ -564,7 +564,7 @@ def do_mail_match(data: list[dict]): subj_b = replacement[idxb].subject() print(f" -> (B{idxb + 1}) {subj_b}", file=sys.stderr) else: - print(f" (no replacement)", file=sys.stderr) + print(" (no replacement)", file=sys.stderr) print(file=sys.stderr) print("Replacement version:", file=sys.stderr) @@ -665,7 +665,7 @@ def do_mail_match(data: list[dict]): match key: case "y": - print(f"(Accepted)", file=sys.stderr) + print("(Accepted)", file=sys.stderr) for i in range(len(current)): row = matrix[i] @@ -688,7 +688,7 @@ def do_mail_match(data: list[dict]): db[cur_pid]["replacement"] = rids break case "n": - print(f"(Ignored)", file=sys.stderr) + print("(Ignored)", file=sys.stderr) break case "c": for i in range(len(current)): @@ -781,7 +781,7 @@ def main(): print(f' "{clean}"', file=sys.stderr) print(f"... the replacement of patch {possible}?", file=sys.stderr) if possible not in id_matches: - print(f"* (weak match)", file=sys.stderr) + print("* (weak match)", file=sys.stderr) print(f' "{old_subject}"{is_identical}', file=sys.stderr) if prompt_yn(): db[possible]["replacement"] = primary @@ -799,5 +799,5 @@ def main(): write_patch_db(db) case _: - print(f"Bad usage", file=sys.stderr) + print("Bad usage", file=sys.stderr) sys.exit(1) diff --git a/patchoulene/src/patchoulene/git.py b/patchoulene/src/patchoulene/git.py index a006304..fa6e189 100644 --- a/patchoulene/src/patchoulene/git.py +++ b/patchoulene/src/patchoulene/git.py @@ -16,7 +16,7 @@ def __init__(self, commit: str, message: str): assert RE_HASH_LIKE.fullmatch(self.commit) def __repr__(self) -> str: - return f"GitCommit(commit={repr(self.commit)}, message={repr(self.message)})" + return f"GitCommit(commit={self.commit!r}, message={self.message!r})" class GitRepo: From 66b26f2aabd568039eed4ae2090821da23a804be Mon Sep 17 00:00:00 2001 From: Vivian Wang Date: Thu, 27 Aug 2026 11:14:44 +0800 Subject: [PATCH 3/3] tools: patchoulene: Use set comprehensions This is a ruff check fix. Signed-off-by: Vivian Wang --- patchoulene/src/patchoulene/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patchoulene/src/patchoulene/__init__.py b/patchoulene/src/patchoulene/__init__.py index 2d50fa0..f3ec40d 100644 --- a/patchoulene/src/patchoulene/__init__.py +++ b/patchoulene/src/patchoulene/__init__.py @@ -298,7 +298,7 @@ def msg_merged(commit: GitCommit, primary: str) -> str: if db.get(primary, {}).get("replacement", None) is not None: continue - possible_matches = set(pid for pid in upstream[1:] if pid in db) + possible_matches = {pid for pid in upstream[1:] if pid in db} possible_matches |= set(by_subject.get(clean, [])) possible_matches -= {primary} @@ -760,7 +760,7 @@ def main(): "subject": clean, } - id_matches = set(pid for pid in guess[1:] if pid in db) + id_matches = {pid for pid in guess[1:] if pid in db} possible_matches = id_matches | set(by_subject.get(clean, [])) possible_matches -= {primary}