Use divmod

This commit is contained in:
George Lacey 2021-05-06 08:37:29 +01:00
parent c1d4b26c6c
commit d68d77e6d5

View File

@ -92,15 +92,14 @@ class Summary(object):
if remainder < s or remainder == 0: if remainder < s or remainder == 0:
continue continue
else: else:
exact = remainder // s exact, remainder = divmod(remainder, s)
remainder = remainder % s
if exact > 1: if exact > 1:
time_string += f"{exact} {st}s, " time_string += f"{exact} {st}s, "
else: else:
time_string += f"{exact} {st}, " time_string += f"{exact} {st}, "
if truncate: if truncate:
break break
return time_string.strip().strip(',')[::-1].replace(' ,', ' dna ', 1)[::-1] return time_string.strip().strip(',')[::-1].replace(' ,', ' dna ', 1)[::-1] # lmao
@staticmethod @staticmethod
def bytes_to_string(bytes: int): def bytes_to_string(bytes: int):