From d68d77e6d58a4df58f8cf609f830cb41ed9f8679 Mon Sep 17 00:00:00 2001 From: George Lacey Date: Thu, 6 May 2021 08:37:29 +0100 Subject: [PATCH] Use divmod --- src/borgmanager/summary/summary.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/borgmanager/summary/summary.py b/src/borgmanager/summary/summary.py index 96d754c..e536f99 100644 --- a/src/borgmanager/summary/summary.py +++ b/src/borgmanager/summary/summary.py @@ -92,15 +92,14 @@ class Summary(object): if remainder < s or remainder == 0: continue else: - exact = remainder // s - remainder = remainder % s + exact, remainder = divmod(remainder, s) if exact > 1: time_string += f"{exact} {st}s, " else: time_string += f"{exact} {st}, " if truncate: break - return time_string.strip().strip(',')[::-1].replace(' ,', ' dna ', 1)[::-1] + return time_string.strip().strip(',')[::-1].replace(' ,', ' dna ', 1)[::-1] # lmao @staticmethod def bytes_to_string(bytes: int):