mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-04-15 23:47:24 +02:00
Fixed UP032 (f-string): Use f-string instead of format call
This commit is contained in:
@@ -302,7 +302,7 @@ def scan_mail_log(env):
|
||||
for date, sender, message in user_data["blocked"]:
|
||||
if len(sender) > 64:
|
||||
sender = sender[:32] + "…" + sender[-32:]
|
||||
user_rejects.extend((f'{date} - {sender} ', ' {}'.format(message)))
|
||||
user_rejects.extend((f'{date} - {sender} ', f' {message}'))
|
||||
rejects.append(user_rejects)
|
||||
|
||||
print_user_table(
|
||||
@@ -608,7 +608,7 @@ def valid_date(string):
|
||||
try:
|
||||
date = dateutil.parser.parse(string)
|
||||
except ValueError:
|
||||
raise argparse.ArgumentTypeError("Unrecognized date and/or time '{}'".format(string))
|
||||
raise argparse.ArgumentTypeError(f"Unrecognized date and/or time '{string}'")
|
||||
return date
|
||||
|
||||
|
||||
@@ -669,7 +669,7 @@ def print_user_table(users, data=None, sub_data=None, activity=None, latest=None
|
||||
col_str = f"{d[row]!s:<20}"
|
||||
col_left[col] = True
|
||||
else:
|
||||
temp = "{{:>{}}}".format(max(5, len(l) + 1, len(str(d[row])) + 1))
|
||||
temp = f"{{:>{max(5, len(l) + 1, len(str(d[row])) + 1)}}}"
|
||||
col_str = temp.format(str(d[row]))
|
||||
col_widths[col] = max(col_widths[col], len(col_str))
|
||||
line += col_str
|
||||
@@ -706,10 +706,10 @@ def print_user_table(users, data=None, sub_data=None, activity=None, latest=None
|
||||
if sub_data is not None:
|
||||
for l, d in sub_data:
|
||||
if d[row]:
|
||||
lines.extend(('┬', '│ {}'.format(l), '├─%s─' % (len(l) * '─'), '│'))
|
||||
lines.extend(('┬', f'│ {l}', '├─%s─' % (len(l) * '─'), '│'))
|
||||
max_len = 0
|
||||
for v in list(d[row]):
|
||||
lines.append("│ {}".format(v))
|
||||
lines.append(f"│ {v}")
|
||||
max_len = max(max_len, len(v))
|
||||
lines.append("└" + (max_len + 1) * "─")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user