Replace filter usage

This commit is contained in:
Matthias 2019-07-14 20:14:35 +02:00
parent 4238ee090d
commit dadf8adb3e
2 changed files with 3 additions and 2 deletions

View File

@ -217,7 +217,8 @@ class Telegram(RPC):
"*Open Order:* `{open_order}`" if r['open_order'] else "" "*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: for msg in messages:
self._send_msg(msg, bot=bot) self._send_msg(msg, bot=bot)

View File

@ -23,7 +23,7 @@ def fig_generating_mock(fig, *args, **kwargs):
def find_trace_in_fig_data(data, search_string: str): 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) return next(matches)