diff options
author | Joris | 2020-05-31 17:47:13 +0200 |
---|---|---|
committer | Joris | 2020-05-31 17:47:14 +0200 |
commit | 74fd6f47b3683bd727a33f3312582485fa062b95 (patch) | |
tree | 87d4a3045e5585dde9e75cf957e755f47de61775 /src/gui/tasks/duration.py | |
parent | 1bed85a9b107d1b03e71b848829cb7b1f33060f4 (diff) |
Use double quotes instead of simple quotes
Follow advice from:
https://stackoverflow.com/questions/56011/single-quotes-vs-double-quotes-in-python
Diffstat (limited to 'src/gui/tasks/duration.py')
-rw-r--r-- | src/gui/tasks/duration.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gui/tasks/duration.py b/src/gui/tasks/duration.py index 3ce8203..dc948e6 100644 --- a/src/gui/tasks/duration.py +++ b/src/gui/tasks/duration.py @@ -7,21 +7,21 @@ import gui.color def format(minutes: int): if minutes >= 60 * 24: - return '' + format_decimal(minutes / 60 / 24) + 'd' + return "" + format_decimal(minutes / 60 / 24) + "d" elif minutes >= 60: - return '' + format_decimal(minutes / 60) + 'h' + return "" + format_decimal(minutes / 60) + "h" elif minutes > 0: - return '' + str(minutes) + 'm' + return "" + str(minutes) + "m" else: - return '' + return "" def format_decimal(d: float) -> str: - return '{0:.2g}'.format(d) + return "{0:.2g}".format(d) def parse(duration: str) -> Optional[int]: duration = duration.strip() if duration: - result = re.match('^(\d+)(\.(\d+))?([mhd])$', duration.strip()) + result = re.match("^(\d+)(\.(\d+))?([mhd])$", duration.strip()) if result: n = int(result.group(1)) if result.group(3): @@ -30,11 +30,11 @@ def parse(duration: str) -> Optional[int]: d = 0 num = n + d unit = result.group(4) - if unit == 'm': + if unit == "m": return math.floor(num) - elif unit == 'h': + elif unit == "h": return math.floor(num * 60) - elif unit == 'd': + elif unit == "d": return math.floor(num * 60 * 24) else: return None |