File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change 12
12
_TIME_RE_STR = r"([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(?:\.([0-9]{1,6})[0-9]*)?"
13
13
14
14
RE_NUMBER = re .compile (
15
- r"""
16
- 0
17
- (?:
18
- x[0-9A-Fa-f](?:_?[0-9A-Fa-f])* # hex
19
- |
20
- b[01](?:_?[01])* # bin
21
- |
22
- o[0-7](?:_?[0-7])* # oct
23
- )
24
- |
25
- [+-]?(?:0|[1-9](?:_?[0-9])*) # dec, integer part
26
- (?P<floatpart>
27
- (?:\.[0-9](?:_?[0-9])*)? # optional fractional part
28
- (?:[eE][+-]?[0-9](?:_?[0-9])*)? # optional exponent part
29
- )
30
- """ ,
31
- flags = re .VERBOSE ,
15
+ r"""0(x[0-9A-Fa-f](_?[0-9A-Fa-f])*|b[01](_?[01])*|o[0-7](_?[0-7])*)|[+-]?(0|[1-9](_?[0-9])*)((\.[0-9](_?[0-9])*)?([eE][+-]?[0-9](_?[0-9])*)?)"""
16
+
32
17
)
33
18
RE_LOCALTIME = re .compile (_TIME_RE_STR )
34
19
RE_DATETIME = re .compile (
@@ -97,6 +82,6 @@ def match_to_localtime(match):
97
82
98
83
99
84
def match_to_number (match , parse_float ):
100
- if match .group ("floatpart" ):
85
+ if match .group (7 ):
101
86
return parse_float (match .group ())
102
87
return int (match .group (), 0 )
You can’t perform that action at this time.
0 commit comments