Skip to content

Commit

Permalink
reintroduce E203, black does not like that one
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Apr 17, 2023
1 parent 0b596c0 commit 06fa6c1
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
max-line-length = 150
exclude = lnbits/wallets/lnd_grpc_files/, lnbits/extensions/
ignore =
# E203 whitespace before ':' black does not like it
E203
# E402: module level import not at top of file
E402,
# W503: line break before binary operator
Expand Down
4 changes: 2 additions & 2 deletions lnbits/bolt11.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def decode(pr: str) -> Invoice:
raise ValueError("Too short to contain signature")

# extract the signature
signature = bitarray[-65 * 8:].tobytes()
signature = bitarray[-65 * 8 :].tobytes()

# the tagged fields as a bitstream
data = bitstring.ConstBitStream(bitarray[: -65 * 8])
Expand All @@ -61,7 +61,7 @@ def decode(pr: str) -> Invoice:
# decode the amount from the hrp
m = re.search(r"[^\d]+", hrp[2:])
if m:
amountstr = hrp[2 + m.end():]
amountstr = hrp[2 + m.end() :]
if amountstr != "":
invoice.amount_msat = _unshorten_amount(amountstr)

Expand Down
2 changes: 1 addition & 1 deletion lnbits/core/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def m002_add_fields_to_apipayments(db):
for ext in ["withdraw", "events", "lnticket", "paywall", "tpos"]:
prefix = f"#{ext} "
if row["memo"].startswith(prefix):
new = row["memo"][len(prefix):]
new = row["memo"][len(prefix) :]
await db.execute(
"""
UPDATE apipayments SET extra = ?, memo = ?
Expand Down
2 changes: 1 addition & 1 deletion lnbits/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _has_common_path(self, redirect_path: str, req_path: str) -> bool:
def _new_path(self, redirect: dict, req_path: str) -> str:
from_path = redirect["from_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 = [
e for e in ([redirect["ext_id"]] + redirect_to + req_tail_path) if e != ""
Expand Down
2 changes: 1 addition & 1 deletion lnbits/wallets/lnbits.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
sse_trigger = True
continue
elif sse_trigger and line.startswith("data:"):
data = json.loads(line[len("data:"):])
data = json.loads(line[len("data:") :])
sse_trigger = False
yield data["payment_hash"]
else:
Expand Down
2 changes: 1 addition & 1 deletion lnbits/wallets/lntips.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
prefix = "data: "
if not line.startswith(prefix):
continue
data = line[len(prefix):] # sse parsing
data = line[len(prefix) :] # sse parsing
inv = json.loads(data)
if not inv.get("payment_hash"):
continue
Expand Down
10 changes: 6 additions & 4 deletions lnbits/wallets/void.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ async def create_invoice(
raise Unsupported("")

async def status(self) -> StatusResponse:
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."
))
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."
)
)
return StatusResponse(None, 0)

async def pay_invoice(self, bolt11: str, fee_limit_msat: int) -> PaymentResponse:
Expand Down

0 comments on commit 06fa6c1

Please sign in to comment.