mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2024-11-19 09:54:21 +01:00
refactor: remove redundant # type: ignore
This commit is contained in:
parent
8cd6c7c9bc
commit
c370bd18c6
@ -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):
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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):
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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 (
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user