tHW_PluginBase: small clean-up for 'maximum_library' - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit dc6dbe5bfba448dba739b33bff8041f9ccfa0d62 DIR parent e07d5d842246962d2add815e82691338173bfbca HTML Author: SomberNight <somber.night@protonmail.com> Date: Thu, 4 Jun 2020 18:49:14 +0200 HW_PluginBase: small clean-up for 'maximum_library' Diffstat: M electrum/plugins/hw_wallet/plugin.… | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- DIR diff --git a/electrum/plugins/hw_wallet/plugin.py b/electrum/plugins/hw_wallet/plugin.py t@@ -46,7 +46,9 @@ class HW_PluginBase(BasePlugin): keystore_class: Type['Hardware_KeyStore'] libraries_available: bool + # define supported library versions: minimum_library <= x < maximum_library minimum_library = (0, ) + maximum_library = (float('inf'), ) def __init__(self, parent, config, name): BasePlugin.__init__(self, parent, config, name) t@@ -149,17 +151,16 @@ class HW_PluginBase(BasePlugin): # if no exception so far, we might still raise LibraryFoundButUnusable if (library_version == 'unknown' or versiontuple(library_version) < self.minimum_library - or hasattr(self, "maximum_library") and versiontuple(library_version) >= self.maximum_library): + or versiontuple(library_version) >= self.maximum_library): raise LibraryFoundButUnusable(library_version=library_version) except ImportError: return False except LibraryFoundButUnusable as e: library_version = e.library_version - max_version_str = version_str(self.maximum_library) if hasattr(self, "maximum_library") else "inf" self.libraries_available_message = ( _("Library version for '{}' is incompatible.").format(self.name) + '\nInstalled: {}, Needed: {} <= x < {}' - .format(library_version, version_str(self.minimum_library), max_version_str)) + .format(library_version, version_str(self.minimum_library), version_str(self.maximum_library))) self.logger.warning(self.libraries_available_message) return False