ruff FURB192 (prefer max over sorted()[-1])

This commit is contained in:
The MMGen Project 2026-08-07 09:37:47 +00:00
commit 80313dbf0b
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 3 additions and 3 deletions

View file

@ -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')

View file

@ -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'