fix pyright

This commit is contained in:
dni
2026-07-13 09:09:42 +02:00
parent 824bc14f26
commit c76cb627d8
+9 -9
View File
@@ -166,10 +166,10 @@ async def api_address(address: str) -> AddressResponse:
c.get_history(scripthash), c.get_history(scripthash),
return_exceptions=True, return_exceptions=True,
) )
if isinstance(balance_res, Exception): if isinstance(balance_res, BaseException):
raise HTTPException(HTTPStatus.SERVICE_UNAVAILABLE, detail=str(balance_res)) raise HTTPException(HTTPStatus.SERVICE_UNAVAILABLE, detail=str(balance_res))
history = [] if isinstance(history_res, Exception) else history_res history = [] if isinstance(history_res, BaseException) else history_res
history_error = str(history_res) if isinstance(history_res, Exception) else None history_error = str(history_res) if isinstance(history_res, BaseException) else None
return AddressResponse( return AddressResponse(
balance=balance_res, history=history, history_error=history_error balance=balance_res, history=history, history_error=history_error
) )
@@ -230,12 +230,12 @@ async def ws_address(websocket: WebSocket, address: str) -> None:
c.get_history(scripthash), c.get_history(scripthash),
return_exceptions=True, return_exceptions=True,
) )
if isinstance(balance_res, Exception): if isinstance(balance_res, BaseException):
await websocket.send_json({"error": str(balance_res)}) await websocket.send_json({"error": str(balance_res)})
return return
history = [] if isinstance(history_res, Exception) else history_res history = [] if isinstance(history_res, BaseException) else history_res
history_error = ( history_error = (
str(history_res) if isinstance(history_res, Exception) else None str(history_res) if isinstance(history_res, BaseException) else None
) )
resp = AddressResponse( resp = AddressResponse(
balance=balance_res, history=history, history_error=history_error balance=balance_res, history=history, history_error=history_error
@@ -249,10 +249,10 @@ async def ws_address(websocket: WebSocket, address: str) -> None:
c.get_history(scripthash), c.get_history(scripthash),
return_exceptions=True, return_exceptions=True,
) )
if isinstance(bal_r, Exception): if isinstance(bal_r, BaseException):
return return
hist = [] if isinstance(hist_r, Exception) else hist_r hist = [] if isinstance(hist_r, BaseException) else hist_r
h_err = str(hist_r) if isinstance(hist_r, Exception) else None h_err = str(hist_r) if isinstance(hist_r, BaseException) else None
await websocket.send_json( await websocket.send_json(
AddressResponse( AddressResponse(
balance=bal_r, history=hist, history_error=h_err balance=bal_r, history=hist, history_error=h_err