Update to use uv (#37)

---------

Co-authored-by: dni  <office@dnilabs.com>
This commit is contained in:
Tiago Vasconcelos 2025-08-22 15:54:51 +01:00 committed by GitHub
parent c729ef17a6
commit 7aeba1eeb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 2297 additions and 2655 deletions

View file

@ -1,5 +1,4 @@
from datetime import datetime, timedelta, timezone
from typing import Optional, Union
from lnbits.db import Database
from lnbits.helpers import urlsafe_short_hash
@ -33,7 +32,7 @@ async def update_ticket(ticket: Ticket) -> Ticket:
return ticket
async def get_ticket(payment_hash: str) -> Optional[Ticket]:
async def get_ticket(payment_hash: str) -> Ticket | None:
return await db.fetchone(
"SELECT * FROM events.ticket WHERE id = :id",
{"id": payment_hash},
@ -41,7 +40,7 @@ async def get_ticket(payment_hash: str) -> Optional[Ticket]:
)
async def get_tickets(wallet_ids: Union[str, list[str]]) -> list[Ticket]:
async def get_tickets(wallet_ids: str | list[str]) -> list[Ticket]:
if isinstance(wallet_ids, str):
wallet_ids = [wallet_ids]
q = ",".join([f"'{wallet_id}'" for wallet_id in wallet_ids])
@ -84,7 +83,7 @@ async def update_event(event: Event) -> Event:
return event
async def get_event(event_id: str) -> Optional[Event]:
async def get_event(event_id: str) -> Event | None:
return await db.fetchone(
"SELECT * FROM events.events WHERE id = :id",
{"id": event_id},
@ -92,7 +91,7 @@ async def get_event(event_id: str) -> Optional[Event]:
)
async def get_events(wallet_ids: Union[str, list[str]]) -> list[Event]:
async def get_events(wallet_ids: str | list[str]) -> list[Event]:
if isinstance(wallet_ids, str):
wallet_ids = [wallet_ids]
q = ",".join([f"'{wallet_id}'" for wallet_id in wallet_ids])