@@ -15,35 +15,26 @@ def match_to_datetime(ymd_match, time_match, zone_match):
15
15
Raises ValueError if the match does not correspond to a valid date
16
16
or datetime.
17
17
"""
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 )
23
21
24
22
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 )
33
27
else :
34
28
hour_str = None
35
29
minute_str = None
36
30
sec_str = None
37
31
micros_str = None
38
32
39
33
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 )
47
38
else :
48
39
zulu_time = None
49
40
offset_sign_str = None
@@ -91,6 +82,9 @@ def cached_tz(hour_str, minute_str, sign_str):
91
82
92
83
93
84
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 )
95
89
micros = int (micros_str .ljust (6 , "0" )) if micros_str else 0
96
90
return time (int (hour_str ), int (minute_str ), int (sec_str ), micros )
0 commit comments