diff --git a/freqtrade/configuration/environment_vars.py b/freqtrade/configuration/environment_vars.py index d59d4bd23..c5efd45b7 100644 --- a/freqtrade/configuration/environment_vars.py +++ b/freqtrade/configuration/environment_vars.py @@ -41,7 +41,7 @@ def flat_vars_to_nested_dict(env_dict: Dict[str, Any], prefix: str) -> Dict[str, key = env_var.replace(prefix, '') for k in reversed(key.split('__')): val = {k.lower(): get_var_typed(val) - if type(val) != dict and k not in no_convert else val} + if not isinstance(val, dict) and k not in no_convert else val} relevant_vars = deep_merge_dicts(val, relevant_vars) return relevant_vars diff --git a/requirements-dev.txt b/requirements-dev.txt index 8770eacc8..cac9d5cd7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -7,7 +7,7 @@ -r docs/requirements-docs.txt coveralls==3.3.1 -ruff==0.0.284 +ruff==0.0.285 mypy==1.5.1 pre-commit==3.3.3 pytest==7.4.0 diff --git a/tests/data/test_dataprovider.py b/tests/data/test_dataprovider.py index 31c6763bc..1eeaffb2c 100644 --- a/tests/data/test_dataprovider.py +++ b/tests/data/test_dataprovider.py @@ -264,7 +264,7 @@ def test_orderbook(mocker, default_conf, order_book_l2): assert order_book_l2.call_args_list[0][0][0] == 'ETH/BTC' assert order_book_l2.call_args_list[0][0][1] >= 5 - assert type(res) is dict + assert isinstance(res, dict) assert 'bids' in res assert 'asks' in res @@ -277,7 +277,7 @@ def test_market(mocker, default_conf, markets): dp = DataProvider(default_conf, exchange) res = dp.market('ETH/BTC') - assert type(res) is dict + assert isinstance(res, dict) assert 'symbol' in res assert res['symbol'] == 'ETH/BTC' @@ -291,7 +291,7 @@ def test_ticker(mocker, default_conf, tickers): exchange = get_patched_exchange(mocker, default_conf) dp = DataProvider(default_conf, exchange) res = dp.ticker('ETH/BTC') - assert type(res) is dict + assert isinstance(res, dict) assert 'symbol' in res assert res['symbol'] == 'ETH/BTC' diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index 84b525cff..adb8b7497 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -2470,7 +2470,7 @@ def test_refresh_latest_ohlcv_inv_result(default_conf, mocker, caplog): assert exchange._klines assert exchange._api_async.fetch_ohlcv.call_count == 2 - assert type(res) is dict + assert isinstance(res, dict) assert len(res) == 1 # Test that each is in list at least once as order is not guaranteed assert log_has("Error loading ETH/BTC. Result was [[]].", caplog) @@ -2854,7 +2854,7 @@ async def test__async_fetch_trades(default_conf, mocker, caplog, exchange_name, pair = 'ETH/BTC' res = await exchange._async_fetch_trades(pair, since=None, params=None) - assert type(res) is list + assert isinstance(res, list) assert isinstance(res[0], list) assert isinstance(res[1], list) @@ -2954,9 +2954,9 @@ async def test__async_get_trade_history_id(default_conf, mocker, exchange_name, ret = await exchange._async_get_trade_history_id(pair, since=fetch_trades_result[0]['timestamp'], until=fetch_trades_result[-1]['timestamp'] - 1) - assert type(ret) is tuple + assert isinstance(ret, tuple) assert ret[0] == pair - assert type(ret[1]) is list + assert isinstance(ret[1], list) assert len(ret[1]) == len(fetch_trades_result) assert exchange._api_async.fetch_trades.call_count == 3 fetch_trades_cal = exchange._api_async.fetch_trades.call_args_list @@ -2992,9 +2992,9 @@ async def test__async_get_trade_history_time(default_conf, mocker, caplog, excha pair, since=fetch_trades_result[0]['timestamp'], until=fetch_trades_result[-1]['timestamp'] - 1) - assert type(ret) is tuple + assert isinstance(ret, tuple) assert ret[0] == pair - assert type(ret[1]) is list + assert isinstance(ret[1], list) assert len(ret[1]) == len(fetch_trades_result) assert exchange._api_async.fetch_trades.call_count == 2 fetch_trades_cal = exchange._api_async.fetch_trades.call_args_list @@ -3028,9 +3028,9 @@ async def test__async_get_trade_history_time_empty(default_conf, mocker, caplog, pair = 'ETH/BTC' ret = await exchange._async_get_trade_history_time(pair, since=trades_history[0][0], until=trades_history[-1][0] - 1) - assert type(ret) is tuple + assert isinstance(ret, tuple) assert ret[0] == pair - assert type(ret[1]) is list + assert isinstance(ret[1], list) assert len(ret[1]) == len(trades_history) - 1 assert exchange._async_fetch_trades.call_count == 2 fetch_trades_cal = exchange._async_fetch_trades.call_args_list diff --git a/tests/plugins/test_pairlist.py b/tests/plugins/test_pairlist.py index cbbf1e6da..369a7f223 100644 --- a/tests/plugins/test_pairlist.py +++ b/tests/plugins/test_pairlist.py @@ -553,7 +553,7 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t assert isinstance(whitelist, list) # Verify length of pairlist matches (used for ShuffleFilter without seed) - if type(whitelist_result) is list: + if isinstance(whitelist_result, list): assert whitelist == whitelist_result else: len(whitelist) == whitelist_result diff --git a/tests/test_arguments.py b/tests/test_arguments.py index 0c63f636d..b4f6e7279 100644 --- a/tests/test_arguments.py +++ b/tests/test_arguments.py @@ -133,7 +133,7 @@ def test_parse_args_backtesting_custom() -> None: assert call_args['command'] == 'backtesting' assert call_args['func'] is not None assert call_args['timeframe'] == '1m' - assert type(call_args['strategy_list']) is list + assert isinstance(call_args['strategy_list'], list) assert len(call_args['strategy_list']) == 2