Skip to content

Commit 2fcaa61

Browse files
committed
match micropython group; swap out group for groups for more compatability
1 parent c31fd18 commit 2fcaa61

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

src/tomli/_re_number.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
def match_to_number(match, parse_float):
1212
if match.group(7):
13-
return parse_float(match.group())
14-
return int(match.group(), 0)
13+
return parse_float(match.group(0))
14+
return int(match.group(0), 0)

src/tomli/_re_time.py

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,26 @@ def match_to_datetime(ymd_match, time_match, zone_match):
1515
Raises ValueError if the match does not correspond to a valid date
1616
or datetime.
1717
"""
18-
(
19-
year_str,
20-
month_str,
21-
day_str,
22-
) = ymd_match.groups()
18+
year_str = ymd_match.group(1)
19+
month_str = ymd_match.group(2)
20+
day_str = ymd_match.group(3)
2321

2422
if time_match:
25-
(
26-
_,
27-
hour_str,
28-
minute_str,
29-
sec_str,
30-
_,
31-
micros_str,
32-
) = time_match.groups()
23+
hour_str = time_match.group(2)
24+
minute_str = time_match.group(3)
25+
sec_str = time_match.group(4)
26+
micros_str = time_match.group(6)
3327
else:
3428
hour_str = None
3529
minute_str = None
3630
sec_str = None
3731
micros_str = None
3832

3933
if zone_match:
40-
(
41-
_,
42-
zulu_time,
43-
offset_sign_str,
44-
offset_hour_str,
45-
offset_minute_str,
46-
) = zone_match.groups()
34+
zulu_time = zone_match.group(2)
35+
offset_sign_str = zone_match.group(3)
36+
offset_hour_str = zone_match.group(4)
37+
offset_minute_str = zone_match.group(5)
4738
else:
4839
zulu_time = None
4940
offset_sign_str = None
@@ -91,6 +82,9 @@ def cached_tz(hour_str, minute_str, sign_str):
9182

9283

9384
def match_to_localtime(match):
94-
hour_str, minute_str, sec_str, micros_str = match.groups()
85+
hour_str = match.group(1)
86+
minute_str = match.group(2)
87+
sec_str = match.group(3)
88+
micros_str = match.group(4)
9589
micros = int(micros_str.ljust(6, "0")) if micros_str else 0
9690
return time(int(hour_str), int(minute_str), int(sec_str), micros)

0 commit comments

Comments
 (0)