diff --git a/README.md b/README.md index bb4ac68..9540928 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Coldcard is a Cheap, Ultra-secure & Opensource Hardware Wallet for #Bitcoin. Get yours at [ColdcardWallet.com](http://coldcardwallet.com) -This is the python code and command-line utilities you need to communciate with it over USB. +This is the python code and command-line utilities you need to communicate with it over USB. ## Setup For Everyday Use diff --git a/ckcc/cli.py b/ckcc/cli.py index 08281bb..a98ce0f 100755 --- a/ckcc/cli.py +++ b/ckcc/cli.py @@ -205,7 +205,7 @@ def real_file_upload(fd, blksize=MAX_BLK_LEN, do_upgrade=False, do_reboot=True, magic = struct.unpack_from(" # not enforcing policy here on msg contents, so we can define that on product - message = message.encode('ascii') + message = message.encode('ascii') if not isinstance(message, bytes) else message ok = dev.send_recv(CCProtocolPacker.sign_message(message, path, addr_fmt), timeout=None) assert ok == None diff --git a/ckcc/client.py b/ckcc/client.py index 6610cd4..1b77a9a 100644 --- a/ckcc/client.py +++ b/ckcc/client.py @@ -161,10 +161,10 @@ class ColdcardDevice: print("Rx [%2d]: %r" % (len(resp), b2a_hex(bytes(resp)))) return CCProtocolUnpacker.decode(resp) - except CCProtoError as e: + except CCProtoError: if expect_errors: raise raise - except: + except Exception: #print("Corrupt response: %r" % resp) raise @@ -260,7 +260,8 @@ class ColdcardDevice: # If Pycoin is not available, do it using ecdsa from ecdsa import BadSignatureError, SECP256k1, VerifyingKey - pubkey, chaincode = decode_xpub(expected_xpub) + # of the returned (pubkey, chaincode) tuple, chaincode is not used + pubkey, _ = decode_xpub(expected_xpub) vk = VerifyingKey.from_string(get_pubkey_string(pubkey), curve=SECP256k1) try: ok = vk.verify_digest(sig[1:], self.session_key) @@ -346,7 +347,7 @@ class UnixSimulatorPipe: self.pipe = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) try: self.pipe.connect(path) - except: + except Exception: self.close() raise RuntimeError("Cannot connect to simulator. Is it running?") @@ -388,7 +389,8 @@ class UnixSimulatorPipe: self.pipe.close() try: os.unlink(self.pipe_name) - except: pass + except Exception: + pass def get_serial_number_string(self): return 'simulator' diff --git a/ckcc/utils.py b/ckcc/utils.py index 3f4e6e6..5389293 100644 --- a/ckcc/utils.py +++ b/ckcc/utils.py @@ -24,14 +24,14 @@ def dfu_parse(fd): assert dfu_prefix.signature == b'DfuSe', "Not a DFU file (bad magic)" - for idx in range(dfu_prefix.targets): + for _ in range(dfu_prefix.targets): prefix = consume(fd, 'Target', '<6sBI255s2I', 'signature altsetting named name size elements') #print("target%d: %r" % (idx, prefix)) - for ei in range(prefix.elements): + for _ in range(prefix.elements): # Decode target prefix # < little endian # I uint32_t element address