rm some legacy cruft for old python versions
This commit is contained in:
@@ -7,8 +7,7 @@ is_local = not is_bundle and os.path.exists(os.path.join(os.path.dirname(os.path
|
||||
|
||||
# when running from source, on Windows, also search for DLLs in inner 'electrum' folder
|
||||
if is_local and os.name == 'nt':
|
||||
if hasattr(os, 'add_dll_directory'): # requires python 3.8+
|
||||
os.add_dll_directory(os.path.dirname(__file__))
|
||||
os.add_dll_directory(os.path.dirname(__file__))
|
||||
|
||||
|
||||
class GuiImportError(ImportError):
|
||||
|
||||
@@ -348,12 +348,9 @@ def ripemd(x: bytes) -> bytes:
|
||||
md = ripemd.new(x)
|
||||
return md.digest()
|
||||
|
||||
|
||||
def hmac_oneshot(key: bytes, msg: bytes, digest) -> bytes:
|
||||
if hasattr(hmac, 'digest'):
|
||||
# requires python 3.7+; faster
|
||||
return hmac.digest(key, msg, digest)
|
||||
else:
|
||||
return hmac.new(key, msg, digest).digest()
|
||||
return hmac.digest(key, msg, digest)
|
||||
|
||||
|
||||
def chacha20_poly1305_encrypt(
|
||||
|
||||
@@ -281,15 +281,10 @@ class DigitalBitbox_Client(HardwareClientBase):
|
||||
if not dbb_user_dir:
|
||||
return
|
||||
|
||||
try:
|
||||
# Python 3.5+
|
||||
jsonDecodeError = json.JSONDecodeError
|
||||
except AttributeError:
|
||||
jsonDecodeError = ValueError
|
||||
try:
|
||||
with open(os.path.join(dbb_user_dir, "config.dat")) as f:
|
||||
dbb_config = json.load(f)
|
||||
except (FileNotFoundError, jsonDecodeError):
|
||||
except (FileNotFoundError, json.JSONDecodeError):
|
||||
return
|
||||
|
||||
if ENCRYPTION_PRIVKEY_KEY not in dbb_config or CHANNEL_ID_KEY not in dbb_config:
|
||||
|
||||
@@ -1123,8 +1123,7 @@ def read_json_file(path):
|
||||
try:
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
data = json.loads(f.read())
|
||||
#backwards compatibility for JSONDecodeError
|
||||
except ValueError:
|
||||
except json.JSONDecodeError:
|
||||
_logger.exception('')
|
||||
raise FileImportFailed(_("Invalid JSON code."))
|
||||
except BaseException as e:
|
||||
|
||||
Reference in New Issue
Block a user