From e3ae8d3f69b77d89159ec83cefc39137989212d6 Mon Sep 17 00:00:00 2001 From: Samuel Husso Date: Thu, 31 Jan 2019 07:51:03 +0200 Subject: [PATCH] flake8 3.7.1 fixes --- freqtrade/data/history.py | 6 +++--- freqtrade/exchange/__init__.py | 4 ++-- freqtrade/freqtradebot.py | 2 +- freqtrade/tests/optimize/test_backtesting.py | 4 ++-- freqtrade/tests/rpc/test_fiat_convert.py | 2 +- freqtrade/tests/strategy/test_strategy.py | 2 +- freqtrade/vendor/qtpylib/indicators.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/freqtrade/data/history.py b/freqtrade/data/history.py index 5492f15ad..7d89f7ad6 100644 --- a/freqtrade/data/history.py +++ b/freqtrade/data/history.py @@ -230,6 +230,6 @@ def download_pair_history(datadir: Optional[Path], misc.file_dump_json(filename, data) return True except BaseException: - logger.info('Failed to download the pair: "%s", Interval: %s', - pair, tick_interval) - return False + logger.info('Failed to download the pair: "%s", Interval: %s', + pair, tick_interval) + return False diff --git a/freqtrade/exchange/__init__.py b/freqtrade/exchange/__init__.py index e4d83cf6d..47886989e 100644 --- a/freqtrade/exchange/__init__.py +++ b/freqtrade/exchange/__init__.py @@ -237,7 +237,7 @@ class Exchange(object): f'Exchange {self.name} does not support market orders.') if order_types.get('stoploss_on_exchange'): - if self.name is not 'Binance': + if self.name != 'Binance': raise OperationalException( 'On exchange stoploss is not supported for %s.' % self.name ) @@ -247,7 +247,7 @@ class Exchange(object): Checks if order time in force configured in strategy/config are supported """ if any(v != 'gtc' for k, v in order_time_in_force.items()): - if self.name is not 'Binance': + if self.name != 'Binance': raise OperationalException( f'Time in force policies are not supporetd for {self.name} yet.') diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 656c700ac..e81e05e9e 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -820,7 +820,7 @@ class FreqtradeBot(object): # we consider the sell price stop price if self.config.get('dry_run', False) and sell_type == 'stoploss' \ and self.strategy.order_types['stoploss_on_exchange']: - limit = trade.stop_loss + limit = trade.stop_loss # First cancelling stoploss on exchange ... if self.strategy.order_types.get('stoploss_on_exchange') and trade.stoploss_order_id: diff --git a/freqtrade/tests/optimize/test_backtesting.py b/freqtrade/tests/optimize/test_backtesting.py index 11d011ccd..e69b1374e 100644 --- a/freqtrade/tests/optimize/test_backtesting.py +++ b/freqtrade/tests/optimize/test_backtesting.py @@ -663,8 +663,8 @@ def test_backtest_alternate_buy_sell(default_conf, fee, mocker): def test_backtest_multi_pair(default_conf, fee, mocker): def evaluate_result_multi(results, freq, max_open_trades): - # Find overlapping trades by expanding each trade once per period - # and then counting overlaps + # Find overlapping trades by expanding each trade once per period + # and then counting overlaps dates = [pd.Series(pd.date_range(row[1].open_time, row[1].close_time, freq=freq)) for row in results[['open_time', 'close_time']].iterrows()] deltas = [len(x) for x in dates] diff --git a/freqtrade/tests/rpc/test_fiat_convert.py b/freqtrade/tests/rpc/test_fiat_convert.py index 7d857d2f1..fbc942432 100644 --- a/freqtrade/tests/rpc/test_fiat_convert.py +++ b/freqtrade/tests/rpc/test_fiat_convert.py @@ -117,7 +117,7 @@ def test_fiat_convert_get_price(mocker): assert fiat_convert._pairs[0].crypto_symbol == 'BTC' assert fiat_convert._pairs[0].fiat_symbol == 'USD' assert fiat_convert._pairs[0].price == 28000.0 - assert fiat_convert._pairs[0]._expiration is not 0 + assert fiat_convert._pairs[0]._expiration != 0 assert len(fiat_convert._pairs) == 1 # Verify the cached is used diff --git a/freqtrade/tests/strategy/test_strategy.py b/freqtrade/tests/strategy/test_strategy.py index e9240de99..602ea5dbe 100644 --- a/freqtrade/tests/strategy/test_strategy.py +++ b/freqtrade/tests/strategy/test_strategy.py @@ -364,7 +364,7 @@ def test_deprecate_populate_indicators(result): in str(w[-1].message) with warnings.catch_warnings(record=True) as w: - # Cause all warnings to always be triggered. + # Cause all warnings to always be triggered. warnings.simplefilter("always") resolver.strategy.advise_buy(indicators, 'ETH/BTC') assert len(w) == 1 diff --git a/freqtrade/vendor/qtpylib/indicators.py b/freqtrade/vendor/qtpylib/indicators.py index e68932998..3866d36c1 100644 --- a/freqtrade/vendor/qtpylib/indicators.py +++ b/freqtrade/vendor/qtpylib/indicators.py @@ -236,7 +236,7 @@ def crossed(series1, series2, direction=None): if direction is None: return above or below - return above if direction is "above" else below + return above if direction == "above" else below def crossed_above(series1, series2):