From 0eaeca8f839150f0e224030f083a75cad1e7f665 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 21 Mar 2019 17:59:42 +0000 Subject: [PATCH] Put spaces between units in output from utils.to_pretty_time --- src/utils/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 3b3ab9f4..22cff3b1 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -79,25 +79,25 @@ def to_pretty_time(total_seconds: int, minimum_unit: int=UNIT_SECOND, hours, minutes = divmod(minutes, 60) days, hours = divmod(hours, 24) weeks, days = divmod(days, 7) - out = "" + out = [] units = 0 if weeks and minimum_unit >= UNIT_WEEK and units < max_units: - out += "%dw" % weeks + out.append("%dw" % weeks) units += 1 if days and minimum_unit >= UNIT_DAY and units < max_units: - out += "%dd" % days + out.append("%dd" % days) units += 1 if hours and minimum_unit >= UNIT_HOUR and units < max_units: - out += "%dh" % hours + out.append("%dh" % hours) units += 1 if minutes and minimum_unit >= UNIT_MINUTE and units < max_units: - out += "%dm" % minutes + out.append("%dm" % minutes) units += 1 if seconds and minimum_unit >= UNIT_SECOND and units < max_units: - out += "%ds" % seconds + out.append("%ds" % seconds) units += 1 - return out + return " ".join(out) def parse_number(s: str) -> str: try: