Test colorama init again (after the fixes done to progressbar)

This commit is contained in:
Matthias 2020-06-01 09:34:03 +02:00
parent 84c50bf16c
commit ffa93377b4

View File

@ -4,26 +4,26 @@
This module contains the hyperopt logic This module contains the hyperopt logic
""" """
import io
import locale import locale
import logging import logging
import random import random
import warnings import warnings
from math import ceil
from collections import OrderedDict from collections import OrderedDict
from math import ceil
from operator import itemgetter from operator import itemgetter
from pathlib import Path from pathlib import Path
from pprint import pprint from pprint import pprint
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
import progressbar
import rapidjson import rapidjson
import tabulate
from colorama import Fore, Style from colorama import Fore, Style
from colorama import init as colorama_init
from joblib import (Parallel, cpu_count, delayed, dump, load, from joblib import (Parallel, cpu_count, delayed, dump, load,
wrap_non_picklable_objects) wrap_non_picklable_objects)
from pandas import DataFrame, json_normalize, isna from pandas import DataFrame, isna, json_normalize
import progressbar
import tabulate
from os import path
import io
from freqtrade.data.converter import trim_dataframe from freqtrade.data.converter import trim_dataframe
from freqtrade.data.history import get_timerange from freqtrade.data.history import get_timerange
@ -32,7 +32,8 @@ from freqtrade.misc import plural, round_dict
from freqtrade.optimize.backtesting import Backtesting from freqtrade.optimize.backtesting import Backtesting
# Import IHyperOpt and IHyperOptLoss to allow unpickling classes from these modules # Import IHyperOpt and IHyperOptLoss to allow unpickling classes from these modules
from freqtrade.optimize.hyperopt_interface import IHyperOpt # noqa: F401 from freqtrade.optimize.hyperopt_interface import IHyperOpt # noqa: F401
from freqtrade.optimize.hyperopt_loss_interface import IHyperOptLoss # noqa: F401 from freqtrade.optimize.hyperopt_loss_interface import \
IHyperOptLoss # noqa: F401
from freqtrade.resolvers.hyperopt_resolver import (HyperOptLossResolver, from freqtrade.resolvers.hyperopt_resolver import (HyperOptLossResolver,
HyperOptResolver) HyperOptResolver)
@ -374,7 +375,7 @@ class Hyperopt:
return return
# Verification for overwrite # Verification for overwrite
if path.isfile(csv_file): if Path(csv_file).is_file():
logger.error(f"CSV file already exists: {csv_file}") logger.error(f"CSV file already exists: {csv_file}")
return return
@ -603,7 +604,7 @@ class Hyperopt:
data, timerange = self.backtesting.load_bt_data() data, timerange = self.backtesting.load_bt_data()
preprocessed = self.backtesting.strategy.ohlcvdata_to_dataframe(data) preprocessed = self.backtesting.strategy.ohlcvdata_to_dataframe(data)
colorama_init(autoreset=True)
# Trim startup period from analyzed dataframe # Trim startup period from analyzed dataframe
for pair, df in preprocessed.items(): for pair, df in preprocessed.items():
preprocessed[pair] = trim_dataframe(df, timerange) preprocessed[pair] = trim_dataframe(df, timerange)