Remove broken ujson loading - replace with variable-based fix
This commit is contained in:
parent
cb2fff8909
commit
7d72e364aa
@ -3,10 +3,11 @@
|
|||||||
import gzip
|
import gzip
|
||||||
try:
|
try:
|
||||||
import ujson as json
|
import ujson as json
|
||||||
|
_UJSON = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# see mypy/issues/1153
|
# see mypy/issues/1153
|
||||||
import json # type: ignore
|
import json # type: ignore
|
||||||
import inspect
|
_UJSON = False
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from typing import Optional, List, Dict, Tuple, Any
|
from typing import Optional, List, Dict, Tuple, Any
|
||||||
@ -21,7 +22,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def json_load(data):
|
def json_load(data):
|
||||||
"""Try to load data with ujson"""
|
"""Try to load data with ujson"""
|
||||||
if inspect.getfullargspec(json.load)[5].get('precise_float'):
|
if _UJSON:
|
||||||
return json.load(data, precise_float=True)
|
return json.load(data, precise_float=True)
|
||||||
else:
|
else:
|
||||||
return json.load(data)
|
return json.load(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user