Skip to content

Commit 7749ab5

Browse files
committed
fix(functions): improve regex matching in convert_to_seconds function
- Updated variable names for clarity by changing `m` to `match` in the `convert_to_seconds` function. - Enhanced readability by ensuring consistent naming conventions and improving the overall structure of the regex matching logic.
1 parent f67dff1 commit 7749ab5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/tux/shared/functions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,18 +225,18 @@ def convert_to_seconds(time_str: str) -> int:
225225
# Match (number)(unit) pairs: e.g. 1wks, 2h, 30m, 1h30m
226226
pattern = re.compile(r"^(\d+)([a-zA-Z]+)")
227227
while rest:
228-
m = pattern.match(rest)
229-
if not m:
228+
match = pattern.match(rest)
229+
if not match:
230230
return 0
231-
value = int(m[1])
232-
unit = m[2].lower()
231+
value = int(match[1])
232+
unit = match[2].lower()
233233
mult = time_units.get(unit)
234234
if mult is None:
235235
return 0
236236
if value == 0:
237237
return 0
238238
total_seconds += value * mult
239-
rest = rest[m.end() :].lstrip()
239+
rest = rest[match.end() :].lstrip()
240240
return total_seconds
241241

242242

0 commit comments

Comments
 (0)