From 80313dbf0b5b44ab2fe981bbfa47470baed51f31 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 7 Aug 2026 09:37:47 +0000 Subject: [PATCH] ruff FURB192 (prefer `max` over `sorted()[-1]`) --- mmgen/xmrwallet/ops/submit.py | 5 +++-- pyproject.toml | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mmgen/xmrwallet/ops/submit.py b/mmgen/xmrwallet/ops/submit.py index 6bfe9501..5612b173 100755 --- a/mmgen/xmrwallet/ops/submit.py +++ b/mmgen/xmrwallet/ops/submit.py @@ -115,11 +115,12 @@ class OpResubmit(OpSubmit): die(1, '--autosign is required for this operation') def get_tx(self): + def keyfunc(x): + return getattr(x.data, 'submit_time', None) or x.data.create_time from ...autosign.signable import Signable fns = Signable.xmr_transaction(self.asi).get_submitted() cls = self.get_tx_cls('Submitted') - return sorted((cls(self.cfg, Path(fn)) for fn in fns), - key = lambda x: getattr(x.data, 'submit_time', None) or x.data.create_time)[-1] + return max((cls(self.cfg, Path(fn)) for fn in fns), key=keyfunc) class OpAbort(OpBase): opts = ('watch_only', 'autosign') diff --git a/pyproject.toml b/pyproject.toml index dde68724..a0cbed7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,6 @@ ignore = [ "B026", # Star-arg unpacking after a keyword argument is strongly discouraged "BLE001", # Do not catch blind exception: `Exception` "E722", # bare except - "FURB192", # Prefer `max` over `sorted()` to compute the maximum value in a sequence "I001", # Import block is un-sorted or un-formatted "ISC004", # Unparenthesized implicit string concatenation in collection "N999", # Invalid module name: 'import'