projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5d39176
)
[utils] Simplify integer conversion in js_to_json
author
Sergey M․
<dstftw@gmail.com>
Sat, 14 May 2016 17:41:57 +0000
(23:41 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Sat, 14 May 2016 17:41:57 +0000
(23:41 +0600)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index 25a9f33c02ff1aae6e13688c97109bc128fabb56..a637563cb8d6562f2a626c8ee72fb9afa7ee505c 100644
(file)
--- a/
youtube_dl/utils.py
+++ b/
youtube_dl/utils.py
@@
-1926,14
+1926,14
@@
def js_to_json(code):
}.get(m.group(0), m.group(0)), v[1:-1])
INTEGER_TABLE = (
- (r'^
(0[xX][0-9a-fA-F]+)
', 16),
- (r'^
(0+[0-7]+)
', 8),
+ (r'^
0[xX][0-9a-fA-F]+
', 16),
+ (r'^
0+[0-7]+
', 8),
)
for regex, base in INTEGER_TABLE:
im = re.match(regex, v)
if im:
- i = int(im.group(
1
), base)
+ i = int(im.group(
0
), base)
return '"%d":' % i if v.endswith(':') else '%d' % i
return '"%s"' % v