remove ujson / json fallback hack as it's now in requirements

This commit is contained in:
Matthias 2018-12-16 09:58:54 +01:00
parent f5b2430cda
commit ebb80b6906

View File

@ -6,19 +6,14 @@ includes:
""" """
import gzip import gzip
try:
import ujson as json
_UJSON = True
except ImportError:
# see mypy/issues/1153
import json # type: ignore
_UJSON = False
import logging import logging
from pathlib import Path from pathlib import Path
from typing import Optional, List, Dict, Tuple, Any from typing import Optional, List, Dict, Tuple, Any
import arrow import arrow
from pandas import DataFrame from pandas import DataFrame
import ujson
from freqtrade import misc, constants, OperationalException from freqtrade import misc, constants, OperationalException
from freqtrade.data.converter import parse_ticker_dataframe from freqtrade.data.converter import parse_ticker_dataframe
@ -29,11 +24,12 @@ logger = logging.getLogger(__name__)
def json_load(data): def json_load(data):
"""Try to load data with ujson""" """
if _UJSON: load data with ujson
return json.load(data, precise_float=True) Use this to have a consistent experience,
else: otherwise "precise_float" needs to be passed to all load operations
return json.load(data) """
return ujson.load(data, precise_float=True)
def trim_tickerlist(tickerlist: List[Dict], timerange: TimeRange) -> List[Dict]: def trim_tickerlist(tickerlist: List[Dict], timerange: TimeRange) -> List[Dict]: