Browse Source

fix flake8 issues (undefined references)

master
Sander van Grieken 3 years ago
parent
commit
cbd388c297
  1. 10
      electrum/gui/qt/send_tab.py
  2. 7
      electrum/payment_identifier.py

10
electrum/gui/qt/send_tab.py

@ -399,6 +399,7 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
def get_message(self):
return self.message_e.text()
def read_invoice(self) -> Optional[Invoice]:
if self.check_payto_line_and_show_errors():
return
@ -410,7 +411,7 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
invoice = self.payment_identifier.get_invoice(self.wallet, amount_sat, self.get_message())
#except Exception as e:
if not invoice:
self.show_error('error getting invoice' + pi.error)
self.show_error('error getting invoice' + self.payment_identifier.error)
return
if not self.wallet.has_lightning() and not invoice.can_be_paid_onchain():
self.show_error(_('Lightning is disabled'))
@ -533,9 +534,10 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
# for err in errors]))
return True
if self.payment_identifier.warning:
msg += '\n' + _('Do you wish to continue?')
if not self.question(msg):
warning = self.payment_identifier.warning
if warning:
warning += '\n' + _('Do you wish to continue?')
if not self.question(warning):
return True
if self.payment_identifier.has_expired():

7
electrum/payment_identifier.py

@ -1,17 +1,18 @@
import asyncio
import urllib
import re
from decimal import Decimal
from decimal import Decimal, InvalidOperation
from typing import NamedTuple, Optional, Callable, Any, Sequence
from urllib.parse import urlparse
from . import bitcoin
from .i18n import _
from .logging import Logger
from .util import parse_max_spend, format_satoshis_plain
from .util import get_asyncio_loop, log_exceptions
from .transaction import PartialTxOutput
from .lnurl import decode_lnurl, request_lnurl, callback_lnurl, LNURLError, LNURL6Data
from .bitcoin import COIN, TOTAL_COIN_SUPPLY_LIMIT_IN_BTC
from .bitcoin import COIN, TOTAL_COIN_SUPPLY_LIMIT_IN_BTC, opcodes, construct_script
from .lnaddr import lndecode, LnDecodeException, LnInvoiceException
from .lnutil import IncompatibleOrInsaneFeatures
@ -351,7 +352,7 @@ class PaymentIdentifier(Logger):
p = pow(10, self.config.get_decimal_point())
try:
return int(p * Decimal(x))
except decimal.InvalidOperation:
except InvalidOperation:
raise Exception("Invalid amount")
def parse_address(self, line):

Loading…
Cancel
Save