From 04752e1910ac939ea31f51fdcfddbb82ab0970f0 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Fri, 3 Jul 2020 17:05:19 +0100 Subject: [PATCH] Correct flake8 errors Remove unused imports Make regexp strings raw strings in bip21 and amount.py Remove copy of classmethod in wallet.py --- jmbitcoin/jmbitcoin/amount.py | 2 +- jmbitcoin/jmbitcoin/bip21.py | 2 +- jmclient/jmclient/taker_utils.py | 1 - jmclient/jmclient/wallet.py | 6 ------ jmclient/jmclient/wallet_service.py | 1 - 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/jmbitcoin/jmbitcoin/amount.py b/jmbitcoin/jmbitcoin/amount.py index 2f0d982..c8549a3 100644 --- a/jmbitcoin/jmbitcoin/amount.py +++ b/jmbitcoin/jmbitcoin/amount.py @@ -21,7 +21,7 @@ def sat_to_btc(sat): def amount_to_sat(amount_str): amount_str = str(amount_str).strip() - if re.compile("^[0-9]{1,8}(\.)?([0-9]{1,8})?(btc|sat)?$").match( + if re.compile(r"^[0-9]{1,8}(\.)?([0-9]{1,8})?(btc|sat)?$").match( amount_str.lower()) is None: raise ValueError("Invalid BTC amount string " + amount_str) if amount_str.lower().endswith("btc"): diff --git a/jmbitcoin/jmbitcoin/bip21.py b/jmbitcoin/jmbitcoin/bip21.py index 910cc3e..ce53ec8 100644 --- a/jmbitcoin/jmbitcoin/bip21.py +++ b/jmbitcoin/jmbitcoin/bip21.py @@ -15,7 +15,7 @@ def is_bip21_uri(uri): def is_bip21_amount_str(amount): - return re.compile("^[0-9]{1,8}(\.[0-9]{1,8})?$").match(str(amount)) != None + return re.compile(r"^[0-9]{1,8}(\.[0-9]{1,8})?$").match(str(amount)) != None def validate_bip21_amount(amount): diff --git a/jmclient/jmclient/taker_utils.py b/jmclient/jmclient/taker_utils.py index 6f7f294..8524018 100644 --- a/jmclient/jmclient/taker_utils.py +++ b/jmclient/jmclient/taker_utils.py @@ -5,7 +5,6 @@ import os import sys import time import numbers -from binascii import hexlify from jmbase import get_log, jmprint from .configure import jm_single, validate_address, is_burn_destination diff --git a/jmclient/jmclient/wallet.py b/jmclient/jmclient/wallet.py index 59c581a..5159a0d 100644 --- a/jmclient/jmclient/wallet.py +++ b/jmclient/jmclient/wallet.py @@ -1706,12 +1706,6 @@ class FidelityBondMixin(object): def is_timelocked_path(cls, path): return len(path) > 4 and path[4] == cls.BIP32_TIMELOCK_ID - def get_xpub_from_fidelity_bond_master_pub_key(cls, mpk): - if mpk.startswith(cls._BIP32_PUBKEY_PREFIX): - return mpk[len(cls._BIP32_PUBKEY_PREFIX):] - else: - return False - def _get_key_ident(self): first_path = self.get_path(0, 0) priv, engine = self._get_key_from_path(first_path) diff --git a/jmclient/jmclient/wallet_service.py b/jmclient/jmclient/wallet_service.py index 25118af..ef186b2 100644 --- a/jmclient/jmclient/wallet_service.py +++ b/jmclient/jmclient/wallet_service.py @@ -5,7 +5,6 @@ import time import ast import binascii import sys -import itertools from decimal import Decimal from copy import deepcopy from twisted.internet import reactor