From 9e33920db10cc60bddef6c8861c5dc1420e59962 Mon Sep 17 00:00:00 2001 From: Teal Dulcet Date: Wed, 8 Jan 2025 05:09:23 -0800 Subject: [PATCH] Fixed FURB118 (reimplemented-operator) --- management/backup.py | 3 ++- management/mailconfig.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/management/backup.py b/management/backup.py index ac16eade..8a92cc78 100755 --- a/management/backup.py +++ b/management/backup.py @@ -14,6 +14,7 @@ import rtyaml from exclusiveprocess import Lock from utils import load_environment, shell, wait_for_service +import operator def backup_status(env): # If backups are disabled, return no status. @@ -91,7 +92,7 @@ def backup_status(env): # Ensure the rows are sorted reverse chronologically. # This is relied on by should_force_full() and the next step. - backups = sorted(backups.values(), key = lambda b : b["date"], reverse=True) + backups = sorted(backups.values(), key = operator.itemgetter("date"), reverse=True) # Get the average size of incremental backups, the size of the # most recent full backup, and the date of the most recent diff --git a/management/mailconfig.py b/management/mailconfig.py index ffa3b8d1..9fdd1d33 100755 --- a/management/mailconfig.py +++ b/management/mailconfig.py @@ -13,6 +13,7 @@ import os, sqlite3, re import utils from email_validator import validate_email as validate_email_, EmailNotValidError import idna +import operator def validate_email(email, mode=None): # Checks that an email address is syntactically valid. Returns True/False. @@ -239,7 +240,7 @@ def get_mail_aliases_ex(env): # Sort aliases within each domain first by required-ness then lexicographically by address. for domain in domains: - domain["aliases"].sort(key = lambda alias : (alias["auto"], alias["address"])) + domain["aliases"].sort(key = operator.itemgetter("auto", "address")) return domains def get_domain(emailaddr, as_unicode=True):