From 17c79cd0443add7e1e78859ed59896eeedb917e1 Mon Sep 17 00:00:00 2001 From: calle <93376500+callebtc@users.noreply.github.com> Date: Tue, 5 Jul 2022 17:18:22 +0200 Subject: [PATCH] Makefile: remove prettier (#705) * remove prettier * black --- Makefile | 2 +- lnbits/extensions/tpos/__init__.py | 2 ++ lnbits/extensions/tpos/crud.py | 9 ++++++++- lnbits/extensions/tpos/migrations.py | 4 +++- lnbits/extensions/tpos/tasks.py | 2 +- lnbits/extensions/tpos/views.py | 13 ++++++++----- lnbits/extensions/tpos/views_api.py | 4 +++- 7 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 63f7eb23..b9418df5 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ all: format check requirements.txt -format: prettier black +format: black check: mypy checkprettier checkblack diff --git a/lnbits/extensions/tpos/__init__.py b/lnbits/extensions/tpos/__init__.py index f4bfc790..1aed95ba 100644 --- a/lnbits/extensions/tpos/__init__.py +++ b/lnbits/extensions/tpos/__init__.py @@ -14,10 +14,12 @@ tpos_ext: APIRouter = APIRouter(prefix="/tpos", tags=["TPoS"]) def tpos_renderer(): return template_renderer(["lnbits/extensions/tpos/templates"]) + from .tasks import wait_for_paid_invoices from .views_api import * # noqa from .views import * # noqa + def tpos_start(): loop = asyncio.get_event_loop() loop.create_task(catch_everything_and_restart(wait_for_paid_invoices)) diff --git a/lnbits/extensions/tpos/crud.py b/lnbits/extensions/tpos/crud.py index 5f0cf96e..8f071d8c 100644 --- a/lnbits/extensions/tpos/crud.py +++ b/lnbits/extensions/tpos/crud.py @@ -13,7 +13,14 @@ async def create_tpos(wallet_id: str, data: CreateTposData) -> TPoS: INSERT INTO tpos.tposs (id, wallet, name, currency, tip_options, tip_wallet) VALUES (?, ?, ?, ?, ?, ?) """, - (tpos_id, wallet_id, data.name, data.currency, data.tip_options, data.tip_wallet), + ( + tpos_id, + wallet_id, + data.name, + data.currency, + data.tip_options, + data.tip_wallet, + ), ) tpos = await get_tpos(tpos_id) diff --git a/lnbits/extensions/tpos/migrations.py b/lnbits/extensions/tpos/migrations.py index 396bd7f2..565c05ab 100644 --- a/lnbits/extensions/tpos/migrations.py +++ b/lnbits/extensions/tpos/migrations.py @@ -13,6 +13,7 @@ async def m001_initial(db): """ ) + async def m002_addtip_wallet(db): """ Add tips to tposs table @@ -23,6 +24,7 @@ async def m002_addtip_wallet(db): """ ) + async def m003_addtip_options(db): """ Add tips to tposs table @@ -31,4 +33,4 @@ async def m003_addtip_options(db): """ ALTER TABLE tpos.tposs ADD tip_options TEXT NULL; """ - ) \ No newline at end of file + ) diff --git a/lnbits/extensions/tpos/tasks.py b/lnbits/extensions/tpos/tasks.py index baa8e6c7..0bb8dff9 100644 --- a/lnbits/extensions/tpos/tasks.py +++ b/lnbits/extensions/tpos/tasks.py @@ -30,7 +30,7 @@ async def on_invoice_paid(payment: Payment) -> None: tipAmount = payment.extra.get("tipAmount") if tipAmount is None: - #no tip amount + # no tip amount return tipAmount = tipAmount * 1000 diff --git a/lnbits/extensions/tpos/views.py b/lnbits/extensions/tpos/views.py index dbee8434..a94564d5 100644 --- a/lnbits/extensions/tpos/views.py +++ b/lnbits/extensions/tpos/views.py @@ -38,6 +38,7 @@ async def tpos(request: Request, tpos_id): "tpos/tpos.html", {"request": request, "tpos": tpos} ) + @tpos_ext.get("/manifest/{tpos_id}.webmanifest") async def manifest(tpos_id: str): tpos = await get_tpos(tpos_id) @@ -48,10 +49,12 @@ async def manifest(tpos_id: str): return { "short_name": LNBITS_SITE_TITLE, - "name": tpos.name + ' - ' + LNBITS_SITE_TITLE, + "name": tpos.name + " - " + LNBITS_SITE_TITLE, "icons": [ { - "src": LNBITS_CUSTOM_LOGO if LNBITS_CUSTOM_LOGO else "https://cdn.jsdelivr.net/gh/lnbits/lnbits@0.3.0/docs/logos/lnbits.png", + "src": LNBITS_CUSTOM_LOGO + if LNBITS_CUSTOM_LOGO + else "https://cdn.jsdelivr.net/gh/lnbits/lnbits@0.3.0/docs/logos/lnbits.png", "type": "image/png", "sizes": "900x900", } @@ -64,10 +67,10 @@ async def manifest(tpos_id: str): "theme_color": "#1F2234", "shortcuts": [ { - "name": tpos.name + ' - ' + LNBITS_SITE_TITLE, + "name": tpos.name + " - " + LNBITS_SITE_TITLE, "short_name": tpos.name, - "description": tpos.name + ' - ' + LNBITS_SITE_TITLE, + "description": tpos.name + " - " + LNBITS_SITE_TITLE, "url": "/tpos/" + tpos_id, } ], - } \ No newline at end of file + } diff --git a/lnbits/extensions/tpos/views_api.py b/lnbits/extensions/tpos/views_api.py index e39a9814..fb4bd0ab 100644 --- a/lnbits/extensions/tpos/views_api.py +++ b/lnbits/extensions/tpos/views_api.py @@ -52,7 +52,9 @@ async def api_tpos_delete( @tpos_ext.post("/api/v1/tposs/{tpos_id}/invoices", status_code=HTTPStatus.CREATED) -async def api_tpos_create_invoice(amount: int = Query(..., ge=1), tipAmount: int = None, tpos_id: str = None): +async def api_tpos_create_invoice( + amount: int = Query(..., ge=1), tipAmount: int = None, tpos_id: str = None +): tpos = await get_tpos(tpos_id) if not tpos: