flake8 passing, use pathlib in lieu of os.path to accommodate windows/mac OS

This commit is contained in:
robcaulk
2022-05-04 17:42:34 +02:00
parent 2600ba4e74
commit 99f7e44c30
7 changed files with 593 additions and 439 deletions

View File

@@ -12,6 +12,7 @@ from freqtrade.exceptions import OperationalException
from freqtrade.freqai.freqai_interface import IFreqaiModel
from freqtrade.resolvers import IResolver
logger = logging.getLogger(__name__)
@@ -19,10 +20,11 @@ class FreqaiModelResolver(IResolver):
"""
This class contains all the logic to load custom hyperopt loss class
"""
object_type = IFreqaiModel
object_type_str = "FreqaiModel"
user_subdir = USERPATH_FREQAIMODELS
initial_search_path = Path(__file__).parent.parent.joinpath('optimize').resolve()
initial_search_path = Path(__file__).parent.parent.joinpath("optimize").resolve()
@staticmethod
def load_freqaimodel(config: Dict) -> IFreqaiModel:
@@ -31,15 +33,17 @@ class FreqaiModelResolver(IResolver):
:param config: configuration dictionary
"""
freqaimodel_name = config.get('freqaimodel')
freqaimodel_name = config.get("freqaimodel")
if not freqaimodel_name:
raise OperationalException(
"No freqaimodel set. Please use `--freqaimodel` to "
"specify the FreqaiModel class to use.\n"
)
freqaimodel = FreqaiModelResolver.load_object(freqaimodel_name,
config, kwargs={'config': config},
extra_dir=config.get('freqaimodel_path'))
freqaimodel = FreqaiModelResolver.load_object(
freqaimodel_name,
config,
kwargs={"config": config},
extra_dir=config.get("freqaimodel_path"),
)
return freqaimodel