1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-16 17:47:23 +01:00

Fixed UP031 (printf-string-formatting): Use format specifiers instead of percent format

This commit is contained in:
Teal Dulcet
2025-01-12 06:36:07 -08:00
parent 1782b69405
commit 1d1a1a09c4
8 changed files with 29 additions and 29 deletions

View File

@@ -33,14 +33,14 @@ def backup_status(env):
def reldate(date, ref, clip):
if ref < date: return clip
rd = dateutil.relativedelta.relativedelta(ref, date)
if rd.years > 1: return "%d years, %d months" % (rd.years, rd.months)
if rd.years == 1: return "%d year, %d months" % (rd.years, rd.months)
if rd.months > 1: return "%d months, %d days" % (rd.months, rd.days)
if rd.months == 1: return "%d month, %d days" % (rd.months, rd.days)
if rd.days >= 7: return "%d days" % rd.days
if rd.days > 1: return "%d days, %d hours" % (rd.days, rd.hours)
if rd.days == 1: return "%d day, %d hours" % (rd.days, rd.hours)
return "%d hours, %d minutes" % (rd.hours, rd.minutes)
if rd.years > 1: return "{:d} years, {:d} months".format(rd.years, rd.months)
if rd.years == 1: return "{:d} year, {:d} months".format(rd.years, rd.months)
if rd.months > 1: return "{:d} months, {:d} days".format(rd.months, rd.days)
if rd.months == 1: return "{:d} month, {:d} days".format(rd.months, rd.days)
if rd.days >= 7: return "{:d} days".format(rd.days)
if rd.days > 1: return "{:d} days, {:d} hours".format(rd.days, rd.hours)
if rd.days == 1: return "{:d} day, {:d} hours".format(rd.days, rd.hours)
return "{:d} hours, {:d} minutes".format(rd.hours, rd.minutes)
# Get duplicity collection status and parse for a list of backups.
def parse_line(line):
@@ -130,7 +130,7 @@ def backup_status(env):
# It still can't be deleted until it's old enough.
est_deleted_on = max(est_time_of_next_full, first_date + datetime.timedelta(days=config["min_age_in_days"]))
deleted_in = "approx. %d days" % round((est_deleted_on-now).total_seconds()/60/60/24 + .5)
deleted_in = "approx. {:d} days".format(round((est_deleted_on-now).total_seconds()/60/60/24 + .5))
# When will a backup be deleted? Set the deleted_in field of each backup.
saw_full = False
@@ -346,7 +346,7 @@ def perform_backup(full_backup):
shell('check_call', [
"/usr/bin/duplicity",
"remove-older-than",
"%dD" % config["min_age_in_days"],
"{:d}D".format(config["min_age_in_days"]),
"--verbosity", "error",
"--archive-dir", backup_cache_dir,
"--force",