Compare commits

..

1 Commits

Author SHA1 Message Date
Frédéric Péters c8ffe45311 misc: use a single word for each time unit (#88822)
gitea/wcs/pipeline/head This commit looks good Details
2024-03-28 21:44:44 +01:00
1 changed files with 1 additions and 0 deletions

View File

@ -56,6 +56,7 @@ def humanduration2seconds(humanduration):
raise ValueError()
seconds = 0
for (word1, word2, dummy), quantity in _humandurations:
# look for number then singular or plural forms of unit
m = re.search(r'(\d+)\s*\b(%s|%s)\b' % (word1, word2), humanduration)
if m:
seconds = seconds + int(m.group(1)) * quantity