Merge pull request #1274 from prusnak/mypy-extension-lnticket

fix mypy for lnbits/extensions/lnticket
This commit is contained in:
calle 2023-01-04 09:10:26 +01:00 committed by GitHub
commit ce97dda738
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 6 deletions

View file

@ -19,7 +19,7 @@ async def wait_for_paid_invoices():
async def on_invoice_paid(payment: Payment) -> None: async def on_invoice_paid(payment: Payment) -> None:
if payment.extra.get("tag") != "lnticket": if not payment.extra or payment.extra.get("tag") != "lnticket":
# not a lnticket invoice # not a lnticket invoice
return return

View file

@ -33,6 +33,7 @@ async def display(request: Request, form_id):
) )
wallet = await get_wallet(form.wallet) wallet = await get_wallet(form.wallet)
assert wallet
return lnticket_renderer().TemplateResponse( return lnticket_renderer().TemplateResponse(
"lnticket/display.html", "lnticket/display.html",

View file

@ -1,8 +1,7 @@
import re import re
from http import HTTPStatus from http import HTTPStatus
from fastapi import Query from fastapi import Depends, Query
from fastapi.params import Depends
from starlette.exceptions import HTTPException from starlette.exceptions import HTTPException
from lnbits.core.crud import get_user from lnbits.core.crud import get_user
@ -35,7 +34,8 @@ async def api_forms_get(
wallet_ids = [wallet.wallet.id] wallet_ids = [wallet.wallet.id]
if all_wallets: if all_wallets:
wallet_ids = (await get_user(wallet.wallet.user)).wallet_ids user = await get_user(wallet.wallet.user)
wallet_ids = user.wallet_ids if user else []
return [form.dict() for form in await get_forms(wallet_ids)] return [form.dict() for form in await get_forms(wallet_ids)]
@ -91,7 +91,8 @@ async def api_tickets(
wallet_ids = [wallet.wallet.id] wallet_ids = [wallet.wallet.id]
if all_wallets: if all_wallets:
wallet_ids = (await get_user(wallet.wallet.user)).wallet_ids user = await get_user(wallet.wallet.user)
wallet_ids = user.wallet_ids if user else []
return [form.dict() for form in await get_tickets(wallet_ids)] return [form.dict() for form in await get_tickets(wallet_ids)]

View file

@ -98,7 +98,6 @@ exclude = """(?x)(
| ^lnbits/extensions/livestream. | ^lnbits/extensions/livestream.
| ^lnbits/extensions/lnaddress. | ^lnbits/extensions/lnaddress.
| ^lnbits/extensions/lndhub. | ^lnbits/extensions/lndhub.
| ^lnbits/extensions/lnticket.
| ^lnbits/extensions/lnurldevice. | ^lnbits/extensions/lnurldevice.
| ^lnbits/extensions/lnurlp. | ^lnbits/extensions/lnurlp.
| ^lnbits/extensions/offlineshop. | ^lnbits/extensions/offlineshop.