From 8ca390e0b055e701ff21f5aa6890fe6be1a25a86 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 1 Dec 2022 18:41:58 +0000 Subject: [PATCH] format --- lnbits/bolt11.py | 6 +++--- lnbits/core/services.py | 6 +++--- lnbits/extensions/copilot/tasks.py | 4 +++- .../extensions/lnurldevice/templates/lnurldevice/index.html | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lnbits/bolt11.py b/lnbits/bolt11.py index 08f1f1e59..32b43feb6 100644 --- a/lnbits/bolt11.py +++ b/lnbits/bolt11.py @@ -166,7 +166,7 @@ def lnencode(addr, privkey): if addr.amount: amount = Decimal(str(addr.amount)) # We can only send down to millisatoshi. - if amount * 10 ** 12 % 10: + if amount * 10**12 % 10: raise ValueError( "Cannot encode {}: too many decimal places".format(addr.amount) ) @@ -271,7 +271,7 @@ class LnAddr(object): def shorten_amount(amount): """Given an amount in bitcoin, shorten it""" # Convert to pico initially - amount = int(amount * 10 ** 12) + amount = int(amount * 10**12) units = ["p", "n", "u", "m", ""] for unit in units: if amount % 1000 == 0: @@ -290,7 +290,7 @@ def _unshorten_amount(amount: str) -> int: # * `u` (micro): multiply by 0.000001 # * `n` (nano): multiply by 0.000000001 # * `p` (pico): multiply by 0.000000000001 - units = {"p": 10 ** 12, "n": 10 ** 9, "u": 10 ** 6, "m": 10 ** 3} + units = {"p": 10**12, "n": 10**9, "u": 10**6, "m": 10**3} unit = str(amount)[-1] # BOLT #11: diff --git a/lnbits/core/services.py b/lnbits/core/services.py index 623f78139..beb0f97ad 100644 --- a/lnbits/core/services.py +++ b/lnbits/core/services.py @@ -329,12 +329,12 @@ async def perform_lnurlauth( sign_len = 6 + r_len + s_len signature = BytesIO() - signature.write(0x30 .to_bytes(1, "big", signed=False)) + signature.write(0x30.to_bytes(1, "big", signed=False)) signature.write((sign_len - 2).to_bytes(1, "big", signed=False)) - signature.write(0x02 .to_bytes(1, "big", signed=False)) + signature.write(0x02.to_bytes(1, "big", signed=False)) signature.write(r_len.to_bytes(1, "big", signed=False)) signature.write(r) - signature.write(0x02 .to_bytes(1, "big", signed=False)) + signature.write(0x02.to_bytes(1, "big", signed=False)) signature.write(s_len.to_bytes(1, "big", signed=False)) signature.write(s) diff --git a/lnbits/extensions/copilot/tasks.py b/lnbits/extensions/copilot/tasks.py index 949e0d94b..384070cdf 100644 --- a/lnbits/extensions/copilot/tasks.py +++ b/lnbits/extensions/copilot/tasks.py @@ -65,7 +65,9 @@ async def on_invoice_paid(payment: Payment) -> None: except (httpx.ConnectError, httpx.RequestError): await mark_webhook_sent(payment, -1) if payment.extra.get("comment"): - await websocketUpdater(copilot.id, str(data) + "-" + str(payment.extra.get("comment"))) + await websocketUpdater( + copilot.id, str(data) + "-" + str(payment.extra.get("comment")) + ) await websocketUpdater(copilot.id, str(data) + "-none") diff --git a/lnbits/extensions/lnurldevice/templates/lnurldevice/index.html b/lnbits/extensions/lnurldevice/templates/lnurldevice/index.html index c8488bdf6..04d645830 100644 --- a/lnbits/extensions/lnurldevice/templates/lnurldevice/index.html +++ b/lnbits/extensions/lnurldevice/templates/lnurldevice/index.html @@ -158,8 +158,8 @@ color="primary" size="md" @click="copyText(wslocation + '/api/v1/ws/' + settingsDialog.data.id, 'Link copied to clipboard!')" - >{% raw %}{{wslocation}}/api/v1/ws/{{settingsDialog.data.id}}{% - endraw %} Click to copy URL + >{% raw %}{{wslocation}}/api/v1/ws/{{settingsDialog.data.id}}{% endraw + %} Click to copy URL