chore: get rid of mypy notes and typecheck more functions (#3257)
This commit is contained in:
@@ -7,7 +7,7 @@ from typing import Optional
|
||||
import httpx
|
||||
from loguru import logger
|
||||
from pydantic import BaseModel
|
||||
from websockets.legacy.client import WebSocketClientProtocol, connect
|
||||
from websockets.legacy.client import connect
|
||||
from websockets.typing import Subprotocol
|
||||
|
||||
from lnbits import bolt11
|
||||
@@ -48,7 +48,7 @@ class BlinkWallet(Wallet):
|
||||
"payload": {"X-API-KEY": settings.blink_token},
|
||||
}
|
||||
self.client = httpx.AsyncClient(base_url=self.endpoint, headers=self.auth)
|
||||
self.ws: Optional[WebSocketClientProtocol] = None
|
||||
self.ws = None
|
||||
self._wallet_id = None
|
||||
|
||||
@property
|
||||
|
||||
@@ -63,7 +63,7 @@ class BoltzWallet(Wallet):
|
||||
channel = grpc.aio.insecure_channel(settings.boltz_client_endpoint)
|
||||
|
||||
self.rpc = boltzrpc_pb2_grpc.BoltzStub(channel)
|
||||
self.wallet_id: int = 0
|
||||
self.wallet_id = 0
|
||||
|
||||
# Auto-create wallet if running in Docker mode
|
||||
async def _init_boltz_wallet():
|
||||
|
||||
@@ -62,7 +62,7 @@ class NWCWallet(Wallet):
|
||||
# interval in seconds between checks for pending payments
|
||||
self.pending_payments_lookup_interval = 10
|
||||
# track paid invoices for paid_invoices_stream
|
||||
self.paid_invoices_queue: asyncio.Queue = asyncio.Queue(0)
|
||||
self.paid_invoices_queue = asyncio.Queue(0)
|
||||
# This task periodically checks if pending payments have been settled
|
||||
self.pending_payments_lookup_task = asyncio.create_task(
|
||||
self._handle_pending_payments()
|
||||
|
||||
@@ -27,7 +27,7 @@ class TokenBucket:
|
||||
Token bucket rate limiter for Strike API endpoints.
|
||||
"""
|
||||
|
||||
def __init__(self, rate: int, period_seconds: int):
|
||||
def __init__(self, rate: int, period_seconds: int) -> None:
|
||||
"""
|
||||
Initialize a token bucket.
|
||||
|
||||
@@ -77,7 +77,7 @@ class StrikeWallet(Wallet):
|
||||
# construction / teardown #
|
||||
# --------------------------------------------------------------------- #
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
if not settings.strike_api_endpoint:
|
||||
raise ValueError("Missing strike_api_endpoint")
|
||||
if not settings.strike_api_key:
|
||||
@@ -120,7 +120,7 @@ class StrikeWallet(Wallet):
|
||||
self._cached_balance_ts: float = 0.0
|
||||
self._cache_ttl = 30 # seconds
|
||||
|
||||
async def cleanup(self):
|
||||
async def cleanup(self) -> None:
|
||||
try:
|
||||
await self.client.aclose()
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user