Switch to python3
This commit is contained in:
parent
531041e89a
commit
9ba4b6a91a
5286 changed files with 677347 additions and 576888 deletions
21
Shared/lib/python3.4/site-packages/ox/jsonc.py
Normal file
21
Shared/lib/python3.4/site-packages/ox/jsonc.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import with_statement, print_function
|
||||
|
||||
from .js import minify
|
||||
from .utils import json
|
||||
|
||||
|
||||
def load(f):
|
||||
return loads(f.read())
|
||||
|
||||
def loads(source):
|
||||
try:
|
||||
minified = minify(source)
|
||||
return json.loads(minified)
|
||||
except json.JSONDecodeError as e:
|
||||
s = minified.split('\n')
|
||||
context = s[e.lineno-1][max(0, e.colno-1):e.colno+30]
|
||||
msg = e.msg + ' at ' + context
|
||||
raise json.JSONDecodeError(msg, minified, e.pos)
|
||||
Loading…
Add table
Add a link
Reference in a new issue