diff --git a/lnbits/core/services.py b/lnbits/core/services.py index 285525405..798680a23 100644 --- a/lnbits/core/services.py +++ b/lnbits/core/services.py @@ -2,7 +2,7 @@ import asyncio import json from binascii import unhexlify from io import BytesIO -from typing import Dict, Optional, Tuple, List +from typing import Dict, List, Optional, Tuple from urllib.parse import parse_qs, urlparse import httpx @@ -13,27 +13,18 @@ from loguru import logger from lnbits import bolt11 from lnbits.db import Connection -from lnbits.decorators import ( - WalletTypeInfo, - get_key_type, - require_admin_key, - require_invoice_key, -) +from lnbits.decorators import (WalletTypeInfo, get_key_type, require_admin_key, + require_invoice_key) from lnbits.helpers import url_for, urlsafe_short_hash from lnbits.requestvars import g -from lnbits.settings import FAKE_WALLET, RESERVE_FEE_MIN, RESERVE_FEE_PERCENT, WALLET +from lnbits.settings import (FAKE_WALLET, RESERVE_FEE_MIN, RESERVE_FEE_PERCENT, + WALLET) from lnbits.wallets.base import PaymentResponse, PaymentStatus from . import db -from .crud import ( - check_internal, - create_payment, - delete_wallet_payment, - get_wallet, - get_wallet_payment, - update_payment_details, - update_payment_status, -) +from .crud import (check_internal, create_payment, delete_wallet_payment, + get_wallet, get_wallet_payment, update_payment_details, + update_payment_status) from .models import Payment try: diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index ac56eb5ed..c6c5f9925 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -9,10 +9,10 @@ from io import BytesIO from typing import Dict, List, Optional, Tuple, Union from urllib.parse import ParseResult, parse_qs, urlencode, urlparse, urlunparse -import async_timeout import httpx import pyqrcode -from fastapi import Depends, Header, Query, Request, WebSocket, WebSocketDisconnect +from fastapi import (Depends, Header, Query, Request, WebSocket, + WebSocketDisconnect) from fastapi.exceptions import HTTPException from fastapi.params import Body from loguru import logger @@ -21,44 +21,23 @@ from pydantic.fields import Field from sse_starlette.sse import EventSourceResponse, ServerSentEvent from starlette.responses import HTMLResponse, StreamingResponse +import async_timeout from lnbits import bolt11, lnurl from lnbits.core.models import Payment, Wallet -from lnbits.decorators import ( - WalletTypeInfo, - get_key_type, - require_admin_key, - require_invoice_key, -) +from lnbits.decorators import (WalletTypeInfo, get_key_type, require_admin_key, + require_invoice_key) from lnbits.helpers import url_for, urlsafe_short_hash from lnbits.settings import LNBITS_ADMIN_USERS, LNBITS_SITE_TITLE, WALLET -from lnbits.utils.exchange_rates import ( - currencies, - fiat_amount_as_satoshis, - satoshis_amount_as_fiat, -) +from lnbits.utils.exchange_rates import (currencies, fiat_amount_as_satoshis, + satoshis_amount_as_fiat) from .. import core_app, db -from ..crud import ( - create_payment, - get_payments, - get_standalone_payment, - get_total_balance, - get_wallet, - get_wallet_for_key, - save_balance_check, - update_payment_status, - update_wallet, -) -from ..services import ( - InvoiceFailure, - PaymentFailure, - check_transaction_status, - create_invoice, - pay_invoice, - perform_lnurlauth, - websocketManager, - websocketUpdater, -) +from ..crud import (create_payment, get_payments, get_standalone_payment, + get_total_balance, get_wallet, get_wallet_for_key, + save_balance_check, update_payment_status, update_wallet) +from ..services import (InvoiceFailure, PaymentFailure, + check_transaction_status, create_invoice, pay_invoice, + perform_lnurlauth, websocketManager, websocketUpdater) from ..tasks import api_invoice_listeners diff --git a/lnbits/core/views/generic.py b/lnbits/core/views/generic.py index 31a7b0300..c16c8a410 100644 --- a/lnbits/core/views/generic.py +++ b/lnbits/core/views/generic.py @@ -15,24 +15,14 @@ from lnbits.core import db from lnbits.core.models import User from lnbits.decorators import check_user_exists from lnbits.helpers import template_renderer, url_for -from lnbits.settings import ( - LNBITS_ADMIN_USERS, - LNBITS_ALLOWED_USERS, - LNBITS_CUSTOM_LOGO, - LNBITS_SITE_TITLE, - SERVICE_FEE, -) +from lnbits.settings import (LNBITS_ADMIN_USERS, LNBITS_ALLOWED_USERS, + LNBITS_CUSTOM_LOGO, LNBITS_SITE_TITLE, + SERVICE_FEE) from ...helpers import get_valid_extensions -from ..crud import ( - create_account, - create_wallet, - delete_wallet, - get_balance_check, - get_user, - save_balance_notify, - update_user_extension, -) +from ..crud import (create_account, create_wallet, delete_wallet, + get_balance_check, get_user, save_balance_notify, + update_user_extension) from ..services import pay_invoice, redeem_lnurl_withdraw core_html_routes: APIRouter = APIRouter(tags=["Core NON-API Website Routes"])