reintroduce E203, black does not like that one
This commit is contained in:
parent
0b596c00ca
commit
06fa6c10c1
2
.flake8
2
.flake8
|
@ -2,6 +2,8 @@
|
||||||
max-line-length = 150
|
max-line-length = 150
|
||||||
exclude = lnbits/wallets/lnd_grpc_files/, lnbits/extensions/
|
exclude = lnbits/wallets/lnd_grpc_files/, lnbits/extensions/
|
||||||
ignore =
|
ignore =
|
||||||
|
# E203 whitespace before ':' black does not like it
|
||||||
|
E203
|
||||||
# E402: module level import not at top of file
|
# E402: module level import not at top of file
|
||||||
E402,
|
E402,
|
||||||
# W503: line break before binary operator
|
# W503: line break before binary operator
|
||||||
|
|
|
@ -50,7 +50,7 @@ def decode(pr: str) -> Invoice:
|
||||||
raise ValueError("Too short to contain signature")
|
raise ValueError("Too short to contain signature")
|
||||||
|
|
||||||
# extract the signature
|
# extract the signature
|
||||||
signature = bitarray[-65 * 8:].tobytes()
|
signature = bitarray[-65 * 8 :].tobytes()
|
||||||
|
|
||||||
# the tagged fields as a bitstream
|
# the tagged fields as a bitstream
|
||||||
data = bitstring.ConstBitStream(bitarray[: -65 * 8])
|
data = bitstring.ConstBitStream(bitarray[: -65 * 8])
|
||||||
|
@ -61,7 +61,7 @@ def decode(pr: str) -> Invoice:
|
||||||
# decode the amount from the hrp
|
# decode the amount from the hrp
|
||||||
m = re.search(r"[^\d]+", hrp[2:])
|
m = re.search(r"[^\d]+", hrp[2:])
|
||||||
if m:
|
if m:
|
||||||
amountstr = hrp[2 + m.end():]
|
amountstr = hrp[2 + m.end() :]
|
||||||
if amountstr != "":
|
if amountstr != "":
|
||||||
invoice.amount_msat = _unshorten_amount(amountstr)
|
invoice.amount_msat = _unshorten_amount(amountstr)
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ async def m002_add_fields_to_apipayments(db):
|
||||||
for ext in ["withdraw", "events", "lnticket", "paywall", "tpos"]:
|
for ext in ["withdraw", "events", "lnticket", "paywall", "tpos"]:
|
||||||
prefix = f"#{ext} "
|
prefix = f"#{ext} "
|
||||||
if row["memo"].startswith(prefix):
|
if row["memo"].startswith(prefix):
|
||||||
new = row["memo"][len(prefix):]
|
new = row["memo"][len(prefix) :]
|
||||||
await db.execute(
|
await db.execute(
|
||||||
"""
|
"""
|
||||||
UPDATE apipayments SET extra = ?, memo = ?
|
UPDATE apipayments SET extra = ?, memo = ?
|
||||||
|
|
|
@ -125,7 +125,7 @@ class ExtensionsRedirectMiddleware:
|
||||||
def _new_path(self, redirect: dict, req_path: str) -> str:
|
def _new_path(self, redirect: dict, req_path: str) -> str:
|
||||||
from_path = redirect["from_path"].split("/")
|
from_path = redirect["from_path"].split("/")
|
||||||
redirect_to = redirect["redirect_to_path"].split("/")
|
redirect_to = redirect["redirect_to_path"].split("/")
|
||||||
req_tail_path = req_path.split("/")[len(from_path):]
|
req_tail_path = req_path.split("/")[len(from_path) :]
|
||||||
|
|
||||||
elements = [
|
elements = [
|
||||||
e for e in ([redirect["ext_id"]] + redirect_to + req_tail_path) if e != ""
|
e for e in ([redirect["ext_id"]] + redirect_to + req_tail_path) if e != ""
|
||||||
|
|
|
@ -164,7 +164,7 @@ class LNbitsWallet(Wallet):
|
||||||
sse_trigger = True
|
sse_trigger = True
|
||||||
continue
|
continue
|
||||||
elif sse_trigger and line.startswith("data:"):
|
elif sse_trigger and line.startswith("data:"):
|
||||||
data = json.loads(line[len("data:"):])
|
data = json.loads(line[len("data:") :])
|
||||||
sse_trigger = False
|
sse_trigger = False
|
||||||
yield data["payment_hash"]
|
yield data["payment_hash"]
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -155,7 +155,7 @@ class LnTipsWallet(Wallet):
|
||||||
prefix = "data: "
|
prefix = "data: "
|
||||||
if not line.startswith(prefix):
|
if not line.startswith(prefix):
|
||||||
continue
|
continue
|
||||||
data = line[len(prefix):] # sse parsing
|
data = line[len(prefix) :] # sse parsing
|
||||||
inv = json.loads(data)
|
inv = json.loads(data)
|
||||||
if not inv.get("payment_hash"):
|
if not inv.get("payment_hash"):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -23,10 +23,12 @@ class VoidWallet(Wallet):
|
||||||
raise Unsupported("")
|
raise Unsupported("")
|
||||||
|
|
||||||
async def status(self) -> StatusResponse:
|
async def status(self) -> StatusResponse:
|
||||||
logger.warning((
|
logger.warning(
|
||||||
"This backend does nothing, it is here just as a placeholder, you must configure an "
|
(
|
||||||
"actual backend before being able to do anything useful with LNbits."
|
"This backend does nothing, it is here just as a placeholder, you must configure an "
|
||||||
))
|
"actual backend before being able to do anything useful with LNbits."
|
||||||
|
)
|
||||||
|
)
|
||||||
return StatusResponse(None, 0)
|
return StatusResponse(None, 0)
|
||||||
|
|
||||||
async def pay_invoice(self, bolt11: str, fee_limit_msat: int) -> PaymentResponse:
|
async def pay_invoice(self, bolt11: str, fee_limit_msat: int) -> PaymentResponse:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user