From ed5c929b238506702cd06356ee30c8f508b6a485 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 5 Oct 2024 13:17:35 +0200 Subject: [PATCH] chore: remove rapidjson from "default" imports --- freqtrade/commands/list_commands.py | 4 ++-- tests/data/test_btanalysis.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/freqtrade/commands/list_commands.py b/freqtrade/commands/list_commands.py index d4ae4cf43..4922eac3c 100644 --- a/freqtrade/commands/list_commands.py +++ b/freqtrade/commands/list_commands.py @@ -3,8 +3,6 @@ import logging import sys from typing import Any, Dict, List, Union -import rapidjson - from freqtrade.enums import RunMode from freqtrade.exceptions import ConfigurationError, OperationalException from freqtrade.ft_types import ValidExchangesType @@ -297,6 +295,8 @@ def start_list_markets(args: Dict[str, Any], pairs_only: bool = False) -> None: elif args.get("print_one_column", False): print("\n".join(pairs.keys())) elif args.get("list_pairs_print_json", False): + import rapidjson + print(rapidjson.dumps(list(pairs.keys()), default=str)) elif args.get("print_csv", False): writer = csv.DictWriter(sys.stdout, fieldnames=headers) diff --git a/tests/data/test_btanalysis.py b/tests/data/test_btanalysis.py index 691b02fc0..b9dee6d59 100644 --- a/tests/data/test_btanalysis.py +++ b/tests/data/test_btanalysis.py @@ -146,7 +146,7 @@ def test_load_backtest_data_multi(testdatadir): def test_load_trades_from_db(default_conf, fee, is_short, mocker): create_mock_trades(fee, is_short) # remove init so it does not init again - init_mock = mocker.patch("freqtrade.persistence.init_db", MagicMock()) + init_mock = mocker.patch("freqtrade.data.btanalysis.init_db", MagicMock()) trades = load_trades_from_db(db_url=default_conf["db_url"]) assert init_mock.call_count == 1