From dadf8adb3ef8897d56dd526b7dd1a2538fbddf35 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 14 Jul 2019 20:14:35 +0200 Subject: [PATCH] Replace filter usage --- freqtrade/rpc/telegram.py | 3 ++- freqtrade/tests/test_plotting.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 3eb060074..fe4929780 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -217,7 +217,8 @@ class Telegram(RPC): "*Open Order:* `{open_order}`" if r['open_order'] else "" ] - messages.append("\n".join(filter(None, lines)).format(**r)) + # Filter empty lines using list-comprehension + messages.append("\n".join([l for l in lines if l]).format(**r)) for msg in messages: self._send_msg(msg, bot=bot) diff --git a/freqtrade/tests/test_plotting.py b/freqtrade/tests/test_plotting.py index cef229d19..565659d25 100644 --- a/freqtrade/tests/test_plotting.py +++ b/freqtrade/tests/test_plotting.py @@ -23,7 +23,7 @@ def fig_generating_mock(fig, *args, **kwargs): def find_trace_in_fig_data(data, search_string: str): - matches = filter(lambda x: x.name == search_string, data) + matches = (d for d in data if d.name == search_string) return next(matches)