From e2406f21b4ccddb8231b5f0d0574179a9fcad101 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sun, 23 Apr 2023 01:45:14 +0000 Subject: [PATCH] fix flake8-bugbear B011 B011 Do not call assert False since python -O removes these calls. Instead callers should raise AssertionError(). --- electrum/gui/qt/history_list.py | 2 +- electrum/network.py | 2 +- electrum/plugins/trustedcoin/trustedcoin.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py index 9f10c031f..cb4a2383f 100644 --- a/electrum/gui/qt/history_list.py +++ b/electrum/gui/qt/history_list.py @@ -709,7 +709,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop): if value is not None: self.hm.update_fiat(index) else: - assert False + raise Exception(f"did not expect {column=!r} to get edited") def on_double_click(self, idx): tx_item = idx.internalPointer().get_data() diff --git a/electrum/network.py b/electrum/network.py index 47ed65baa..e12f28a62 100644 --- a/electrum/network.py +++ b/electrum/network.py @@ -1362,7 +1362,7 @@ class Network(Logger, NetworkRetryManager[ServerAddr]): async with session.post(url, json=json, headers=headers) as resp: return await on_finish(resp) else: - assert False + raise Exception(f"unexpected {method=!r}") @classmethod def send_http_on_proxy(cls, method, url, **kwargs): diff --git a/electrum/plugins/trustedcoin/trustedcoin.py b/electrum/plugins/trustedcoin/trustedcoin.py index 3ff7ff8ec..181425dc2 100644 --- a/electrum/plugins/trustedcoin/trustedcoin.py +++ b/electrum/plugins/trustedcoin/trustedcoin.py @@ -165,7 +165,7 @@ class TrustedCoinCosignerClient(Logger): on_finish=self.handle_response, timeout=timeout) else: - assert False + raise Exception(f"unexpected {method=!r}") except TrustedCoinException: raise except Exception as e: