From cc3cd394a56b361d039825a89faaebf184f24d05 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Mon, 13 Oct 2025 21:40:44 +0200 Subject: [PATCH] fix minor stuff --- src/patchodon/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/patchodon/__init__.py b/src/patchodon/__init__.py index db21732..ff96d6d 100644 --- a/src/patchodon/__init__.py +++ b/src/patchodon/__init__.py @@ -162,7 +162,7 @@ def do_post(args): files = args.patchfile if not files: trace("reading patchfile series from stdin") - files = mapl(lambda x: x.rstrip(chars="\n"), sys.stdin.readlines()) + files = mapl(lambda x: x.rstrip("\n"), sys.stdin.readlines()) n_patches = len(files) hashes = mapl( lambda x: hashlib.sha1(Path(x).read_text().encode()).hexdigest(), files @@ -254,7 +254,9 @@ def parse_matching_status(args, st, parent, account, n, total_n, short_hash): """ if st["in_reply_to_id"] != parent: - trace(f"wrong reply in status {st['id']}") + # Descendants are also transitive, which includes all subsequent + # patches. Thus we just don't trace anything here to avoid excessive + # warnings. return None if st["account"]["id"] != account: trace(f"bad account in status {st['id']}") @@ -272,7 +274,12 @@ def parse_matching_status(args, st, parent, account, n, total_n, short_hash): trace(f"patch hash mismatch in status {st['id']}") return None url = gs[3] - r = requests.get(url, timeout=args.timeout) + r = requests.get( + url, + timeout=args.timeout, + headers={"User-agent": f"patchodon v{__version__}"}, + ) + time.sleep(1.1) # dpaste ToS! if r.status_code != 200: trace(f"could not get patch from status {st['id']} via {url}") return None