diff --git a/lnbits/bolt11.py b/lnbits/bolt11.py index 0bc401581..4e20208c9 100644 --- a/lnbits/bolt11.py +++ b/lnbits/bolt11.py @@ -4,12 +4,12 @@ import time from decimal import Decimal from typing import List, NamedTuple, Optional -import bitstring # type: ignore +import bitstring import embit import secp256k1 from bech32 import CHARSET, bech32_decode, bech32_encode -from ecdsa import SECP256k1, VerifyingKey # type: ignore -from ecdsa.util import sigdecode_string # type: ignore +from ecdsa import SECP256k1, VerifyingKey +from ecdsa.util import sigdecode_string class Route(NamedTuple): diff --git a/lnbits/core/migrations.py b/lnbits/core/migrations.py index 41ba56446..66254d11d 100644 --- a/lnbits/core/migrations.py +++ b/lnbits/core/migrations.py @@ -1,7 +1,7 @@ import datetime from loguru import logger -from sqlalchemy.exc import OperationalError # type: ignore +from sqlalchemy.exc import OperationalError from lnbits import bolt11 diff --git a/lnbits/core/models.py b/lnbits/core/models.py index 31383667a..eca1bf50a 100644 --- a/lnbits/core/models.py +++ b/lnbits/core/models.py @@ -6,9 +6,9 @@ import time from sqlite3 import Row from typing import Dict, List, Optional -from ecdsa import SECP256k1, SigningKey # type: ignore +from ecdsa import SECP256k1, SigningKey from fastapi import Query -from lnurl import encode as lnurl_encode # type: ignore +from lnurl import encode as lnurl_encode from loguru import logger from pydantic import BaseModel diff --git a/lnbits/core/services.py b/lnbits/core/services.py index 8dc973e76..eefb2f990 100644 --- a/lnbits/core/services.py +++ b/lnbits/core/services.py @@ -7,7 +7,7 @@ from urllib.parse import parse_qs, urlparse import httpx from fastapi import Depends, WebSocket from lnurl import LnurlErrorResponse -from lnurl import decode as decode_lnurl # type: ignore +from lnurl import decode as decode_lnurl from loguru import logger from lnbits import bolt11 @@ -44,7 +44,7 @@ from .crud import ( from .models import Payment try: - from typing import TypedDict # type: ignore + from typing import TypedDict except ImportError: # pragma: nocover from typing_extensions import TypedDict diff --git a/lnbits/core/views/public_api.py b/lnbits/core/views/public_api.py index 56afc1765..b5773bbe9 100644 --- a/lnbits/core/views/public_api.py +++ b/lnbits/core/views/public_api.py @@ -16,7 +16,7 @@ from ..tasks import api_invoice_listeners @core_app.get("/.well-known/lnurlp/{username}") async def lnaddress(username: str, request: Request): - from lnbits.extensions.lnaddress.lnurl import lnurl_response + from lnbits.extensions.lnaddress.lnurl import lnurl_response # type: ignore domain = urlparse(str(request.url)).netloc return await lnurl_response(username, domain, request) diff --git a/lnbits/db.py b/lnbits/db.py index 1bef7bf21..77f3cf33a 100644 --- a/lnbits/db.py +++ b/lnbits/db.py @@ -9,7 +9,7 @@ from typing import Optional from loguru import logger from sqlalchemy import create_engine from sqlalchemy_aio.base import AsyncConnection -from sqlalchemy_aio.strategy import ASYNCIO_STRATEGY # type: ignore +from sqlalchemy_aio.strategy import ASYNCIO_STRATEGY from lnbits.settings import settings @@ -129,7 +129,7 @@ class Database(Compat): else: self.type = POSTGRES - import psycopg2 # type: ignore + import psycopg2 def _parse_timestamp(value, _): if value is None: diff --git a/lnbits/extensions/boltz/models.py b/lnbits/extensions/boltz/models.py index c8ec5646d..4f4ec9e29 100644 --- a/lnbits/extensions/boltz/models.py +++ b/lnbits/extensions/boltz/models.py @@ -3,7 +3,7 @@ from typing import Dict, List, Optional from fastapi.params import Query from pydantic.main import BaseModel -from sqlalchemy.engine import base # type: ignore +from sqlalchemy.engine import base class SubmarineSwap(BaseModel): @@ -24,9 +24,9 @@ class SubmarineSwap(BaseModel): class CreateSubmarineSwap(BaseModel): - wallet: str = Query(...) # type: ignore - refund_address: str = Query(...) # type: ignore - amount: int = Query(...) # type: ignore + wallet: str = Query(...) + refund_address: str = Query(...) + amount: int = Query(...) class ReverseSubmarineSwap(BaseModel): @@ -48,13 +48,13 @@ class ReverseSubmarineSwap(BaseModel): class CreateReverseSubmarineSwap(BaseModel): - wallet: str = Query(...) # type: ignore - amount: int = Query(...) # type: ignore - instant_settlement: bool = Query(...) # type: ignore + wallet: str = Query(...) + amount: int = Query(...) + instant_settlement: bool = Query(...) # validate on-address, bcrt1 for regtest addresses onchain_address: str = Query( ..., regex="^(bcrt1|bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$" - ) # type: ignore + ) class SwapStatus(BaseModel): diff --git a/lnbits/extensions/boltz/views_api.py b/lnbits/extensions/boltz/views_api.py index 18ca14cb7..34f4033e8 100644 --- a/lnbits/extensions/boltz/views_api.py +++ b/lnbits/extensions/boltz/views_api.py @@ -111,7 +111,7 @@ async def api_submarineswap( ) async def api_submarineswap_refund( swap_id: str, - g: WalletTypeInfo = Depends(require_admin_key), # type: ignore + g: WalletTypeInfo = Depends(require_admin_key), ): if swap_id == None: raise HTTPException( @@ -160,7 +160,7 @@ async def api_submarineswap_refund( ) async def api_submarineswap_create( data: CreateSubmarineSwap, - wallet: WalletTypeInfo = Depends(require_admin_key), # type: ignore + wallet: WalletTypeInfo = Depends(require_admin_key), ): try: swap_data = await create_swap(data) @@ -257,7 +257,7 @@ async def api_reverse_submarineswap_create( }, ) async def api_swap_status( - swap_id: str, wallet: WalletTypeInfo = Depends(require_admin_key) # type: ignore + swap_id: str, wallet: WalletTypeInfo = Depends(require_admin_key) ): swap = await get_submarine_swap(swap_id) or await get_reverse_submarine_swap( swap_id @@ -290,7 +290,7 @@ async def api_swap_status( response_description="list of pending swaps", ) async def api_check_swaps( - g: WalletTypeInfo = Depends(require_admin_key), # type: ignore + g: WalletTypeInfo = Depends(require_admin_key), all_wallets: bool = Query(False), ): wallet_ids = [g.wallet.id] diff --git a/lnbits/extensions/cashu/__init__.py b/lnbits/extensions/cashu/__init__.py index e6507bba9..83d8ce274 100644 --- a/lnbits/extensions/cashu/__init__.py +++ b/lnbits/extensions/cashu/__init__.py @@ -1,6 +1,6 @@ import asyncio -from environs import Env # type: ignore +from environs import Env from fastapi import APIRouter from fastapi.staticfiles import StaticFiles diff --git a/lnbits/extensions/copilot/lnurl.py b/lnbits/extensions/copilot/lnurl.py index d8ededf30..b0bc83bc8 100644 --- a/lnbits/extensions/copilot/lnurl.py +++ b/lnbits/extensions/copilot/lnurl.py @@ -6,7 +6,7 @@ from fastapi import Request from fastapi.param_functions import Query from lnurl.types import LnurlPayMetadata from starlette.exceptions import HTTPException -from starlette.responses import HTMLResponse # type: ignore +from starlette.responses import HTMLResponse from lnbits.core.services import create_invoice diff --git a/lnbits/extensions/copilot/models.py b/lnbits/extensions/copilot/models.py index b9b43ccfb..7ca2fc961 100644 --- a/lnbits/extensions/copilot/models.py +++ b/lnbits/extensions/copilot/models.py @@ -4,11 +4,11 @@ from typing import Dict, Optional from urllib.parse import ParseResult, parse_qs, urlencode, urlparse, urlunparse from fastapi.param_functions import Query -from lnurl.types import LnurlPayMetadata # type: ignore +from lnurl.types import LnurlPayMetadata from pydantic import BaseModel from starlette.requests import Request -from lnbits.lnurl import encode as lnurl_encode # type: ignore +from lnbits.lnurl import encode as lnurl_encode class CreateCopilotData(BaseModel): diff --git a/lnbits/extensions/copilot/views.py b/lnbits/extensions/copilot/views.py index 7b66366de..ff69dfba9 100644 --- a/lnbits/extensions/copilot/views.py +++ b/lnbits/extensions/copilot/views.py @@ -2,7 +2,7 @@ from typing import List from fastapi import Depends, Request from fastapi.templating import Jinja2Templates -from starlette.responses import HTMLResponse # type: ignore +from starlette.responses import HTMLResponse from lnbits.core.models import User from lnbits.decorators import check_user_exists diff --git a/lnbits/extensions/lndhub/decorators.py b/lnbits/extensions/lndhub/decorators.py index fcadce279..48118087c 100644 --- a/lnbits/extensions/lndhub/decorators.py +++ b/lnbits/extensions/lndhub/decorators.py @@ -5,7 +5,7 @@ from fastapi.param_functions import Security from fastapi.security.api_key import APIKeyHeader from starlette.exceptions import HTTPException -from lnbits.decorators import WalletTypeInfo, get_key_type # type: ignore +from lnbits.decorators import WalletTypeInfo, get_key_type api_key_header_auth = APIKeyHeader( name="AUTHORIZATION", diff --git a/lnbits/extensions/lnurlp/lnurl.py b/lnbits/extensions/lnurlp/lnurl.py index 8f6aa6237..99de459cf 100644 --- a/lnbits/extensions/lnurlp/lnurl.py +++ b/lnbits/extensions/lnurlp/lnurl.py @@ -3,11 +3,7 @@ import math from http import HTTPStatus from fastapi import Request -from lnurl import ( # type: ignore - LnurlErrorResponse, - LnurlPayActionResponse, - LnurlPayResponse, -) +from lnurl import LnurlErrorResponse, LnurlPayActionResponse, LnurlPayResponse from starlette.exceptions import HTTPException from lnbits.core.services import create_invoice diff --git a/lnbits/extensions/lnurlp/models.py b/lnbits/extensions/lnurlp/models.py index 42ea29267..1c6b6f711 100644 --- a/lnbits/extensions/lnurlp/models.py +++ b/lnbits/extensions/lnurlp/models.py @@ -4,11 +4,11 @@ from typing import Dict, Optional from urllib.parse import ParseResult, parse_qs, urlencode, urlparse, urlunparse from fastapi.param_functions import Query -from lnurl.types import LnurlPayMetadata # type: ignore +from lnurl.types import LnurlPayMetadata from pydantic import BaseModel from starlette.requests import Request -from lnbits.lnurl import encode as lnurl_encode # type: ignore +from lnbits.lnurl import encode as lnurl_encode class CreatePayLinkData(BaseModel): diff --git a/lnbits/extensions/lnurlp/views_api.py b/lnbits/extensions/lnurlp/views_api.py index 0fa739b08..a7bf0761a 100644 --- a/lnbits/extensions/lnurlp/views_api.py +++ b/lnbits/extensions/lnurlp/views_api.py @@ -2,7 +2,7 @@ import json from http import HTTPStatus from fastapi import Depends, Query, Request -from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore +from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl from starlette.exceptions import HTTPException from lnbits.core.crud import get_user diff --git a/lnbits/extensions/market/views.py b/lnbits/extensions/market/views.py index 27ec7a973..e6c8eeff1 100644 --- a/lnbits/extensions/market/views.py +++ b/lnbits/extensions/market/views.py @@ -16,7 +16,7 @@ from starlette.exceptions import HTTPException from starlette.responses import HTMLResponse from lnbits.core.models import User -from lnbits.decorators import check_user_exists # type: ignore +from lnbits.decorators import check_user_exists from . import market_ext, market_renderer from .crud import ( diff --git a/lnbits/extensions/ngrok/views.py b/lnbits/extensions/ngrok/views.py index 81c8b24e3..d84ecd2d9 100644 --- a/lnbits/extensions/ngrok/views.py +++ b/lnbits/extensions/ngrok/views.py @@ -1,4 +1,3 @@ -# type: ignore from os import getenv from fastapi import Depends, Request @@ -36,5 +35,5 @@ ngrok_tunnel = ngrok.connect(port) @ngrok_ext.get("/") async def index(request: Request, user: User = Depends(check_user_exists)): return ngrok_renderer().TemplateResponse( - "ngrok/index.html", {"request": request, "ngrok": string5, "user": user.dict()} + "ngrok/index.html", {"request": request, "ngrok": string5, "user": user.dict()} # type: ignore ) diff --git a/lnbits/extensions/satsdice/lnurl.py b/lnbits/extensions/satsdice/lnurl.py index 1e9c6c09b..f766d8cbd 100644 --- a/lnbits/extensions/satsdice/lnurl.py +++ b/lnbits/extensions/satsdice/lnurl.py @@ -5,7 +5,7 @@ from http import HTTPStatus from fastapi import Request from fastapi.param_functions import Query from starlette.exceptions import HTTPException -from starlette.responses import HTMLResponse # type: ignore +from starlette.responses import HTMLResponse from lnbits.core.services import create_invoice, pay_invoice diff --git a/lnbits/extensions/satsdice/models.py b/lnbits/extensions/satsdice/models.py index 2537f8d79..b0a9a4cda 100644 --- a/lnbits/extensions/satsdice/models.py +++ b/lnbits/extensions/satsdice/models.py @@ -5,8 +5,8 @@ from typing import Dict, Optional from fastapi import Request from fastapi.param_functions import Query from lnurl import Lnurl -from lnurl import encode as lnurl_encode # type: ignore -from lnurl.types import LnurlPayMetadata # type: ignore +from lnurl import encode as lnurl_encode +from lnurl.types import LnurlPayMetadata from pydantic import BaseModel from pydantic.main import BaseModel diff --git a/lnbits/extensions/satsdice/views_api.py b/lnbits/extensions/satsdice/views_api.py index 77c2f1d40..57ab26b84 100644 --- a/lnbits/extensions/satsdice/views_api.py +++ b/lnbits/extensions/satsdice/views_api.py @@ -1,7 +1,7 @@ from http import HTTPStatus from fastapi import Depends, Query, Request -from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore +from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl from starlette.exceptions import HTTPException from lnbits.core.crud import get_user diff --git a/lnbits/extensions/satspay/crud.py b/lnbits/extensions/satspay/crud.py index 4fb14695e..01abe24e4 100644 --- a/lnbits/extensions/satspay/crud.py +++ b/lnbits/extensions/satspay/crud.py @@ -7,7 +7,7 @@ from lnbits.core.services import create_invoice from lnbits.core.views.api import api_payment from lnbits.helpers import urlsafe_short_hash -from ..watchonly.crud import get_config, get_fresh_address +from ..watchonly.crud import get_config, get_fresh_address # type: ignore from . import db from .helpers import fetch_onchain_balance from .models import Charges, CreateCharge, SatsPayThemes diff --git a/lnbits/extensions/scrub/models.py b/lnbits/extensions/scrub/models.py index db05e4f17..8079f358a 100644 --- a/lnbits/extensions/scrub/models.py +++ b/lnbits/extensions/scrub/models.py @@ -3,7 +3,7 @@ from sqlite3 import Row from pydantic import BaseModel from starlette.requests import Request -from lnbits.lnurl import encode as lnurl_encode # type: ignore +from lnbits.lnurl import encode as lnurl_encode class CreateScrubLink(BaseModel): diff --git a/lnbits/extensions/streamalerts/crud.py b/lnbits/extensions/streamalerts/crud.py index 37583117b..941134473 100644 --- a/lnbits/extensions/streamalerts/crud.py +++ b/lnbits/extensions/streamalerts/crud.py @@ -7,6 +7,7 @@ from lnbits.core.crud import get_wallet from lnbits.db import SQLITE from lnbits.helpers import urlsafe_short_hash +# todo: use the API, not direct import from ..satspay.crud import delete_charge # type: ignore from . import db from .models import CreateService, Donation, Service diff --git a/lnbits/extensions/streamalerts/views_api.py b/lnbits/extensions/streamalerts/views_api.py index 25033e274..7bf952c7d 100644 --- a/lnbits/extensions/streamalerts/views_api.py +++ b/lnbits/extensions/streamalerts/views_api.py @@ -7,10 +7,13 @@ from starlette.responses import RedirectResponse from lnbits.core.crud import get_user from lnbits.decorators import WalletTypeInfo, get_key_type -from lnbits.extensions.satspay.models import CreateCharge + +# todo: use the API, not direct import +from lnbits.extensions.satspay.models import CreateCharge # type: ignore from lnbits.utils.exchange_rates import btc_price -from ..satspay.crud import create_charge, get_charge +# todo: use the API, not direct import +from ..satspay.crud import create_charge, get_charge # type: ignore from . import streamalerts_ext from .crud import ( authenticate_service, diff --git a/lnbits/extensions/subdomains/tasks.py b/lnbits/extensions/subdomains/tasks.py index f9e0c8eef..ca57950b3 100644 --- a/lnbits/extensions/subdomains/tasks.py +++ b/lnbits/extensions/subdomains/tasks.py @@ -30,7 +30,7 @@ async def on_invoice_paid(payment: Payment) -> None: ### Create subdomain cf_response = await cloudflare_create_subdomain( - domain=domain, + domain=domain, # type: ignore subdomain=subdomain.subdomain, record_type=subdomain.record_type, ip=subdomain.ip, diff --git a/lnbits/extensions/tipjar/crud.py b/lnbits/extensions/tipjar/crud.py index 080eaf1cf..3ea45d0d2 100644 --- a/lnbits/extensions/tipjar/crud.py +++ b/lnbits/extensions/tipjar/crud.py @@ -2,6 +2,7 @@ from typing import Optional from lnbits.db import SQLITE +# todo: use the API, not direct import from ..satspay.crud import delete_charge # type: ignore from . import db from .models import Tip, TipJar, createTipJar diff --git a/lnbits/extensions/tipjar/views_api.py b/lnbits/extensions/tipjar/views_api.py index d0c7ac7d7..7d3df9205 100644 --- a/lnbits/extensions/tipjar/views_api.py +++ b/lnbits/extensions/tipjar/views_api.py @@ -6,8 +6,9 @@ from starlette.exceptions import HTTPException from lnbits.core.crud import get_user from lnbits.decorators import WalletTypeInfo, get_key_type -from ..satspay.crud import create_charge -from ..satspay.models import CreateCharge +# todo: use the API, not direct import +from ..satspay.crud import create_charge # type: ignore +from ..satspay.models import CreateCharge # type: ignore from . import tipjar_ext from .crud import ( create_tip, diff --git a/lnbits/helpers.py b/lnbits/helpers.py index d3a4e6ea1..4804bdeab 100644 --- a/lnbits/helpers.py +++ b/lnbits/helpers.py @@ -4,7 +4,7 @@ import os from typing import Any, List, NamedTuple, Optional import jinja2 -import shortuuid # type: ignore +import shortuuid from lnbits.jinja2_templating import Jinja2Templates from lnbits.requestvars import g diff --git a/pyproject.toml b/pyproject.toml index 1eca3408c..dd470e44a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,7 +95,7 @@ exclude = """(?x)( )""" [[tool.mypy.overrides]] -module = "embit.*,secp256k1.*,uvicorn.*,sqlalchemy.*,sqlalchemy_aio.*,websocket.*,pyqrcode.*,cashu.*,shortuuid.*,grpc.*,lnurl.*" +module = "embit.*,secp256k1.*,uvicorn.*,sqlalchemy.*,sqlalchemy_aio.*,websocket.*,websockets.*,pyqrcode.*,cashu.*,shortuuid.*,grpc.*,lnurl.*,bitstring.*,ecdsa.*,psycopg2.*,pyngrok.*" ignore_missing_imports = "True" [tool.pytest.ini_options]