run autoflake

```
autoflake -i --remove-unused-variables $(find . -name "*.py")
```
This commit is contained in:
Pavol Rusnak
2023-01-30 11:46:43 +00:00
parent c8efe41e1a
commit 15d7fbeace
38 changed files with 18 additions and 62 deletions
+1 -3
View File
@@ -1,10 +1,8 @@
import glob
import os
import subprocess
import warnings
from os import path
from pathlib import Path
from typing import Any, List, NamedTuple, Optional
from typing import List
LNBITS_PATH = path.dirname(path.realpath(__file__)) + "/lnbits"
+1 -1
View File
@@ -702,7 +702,7 @@ async def websocket_connect(websocket: WebSocket, item_id: str):
await websocketManager.connect(websocket)
try:
while True:
data = await websocket.receive_text()
await websocket.receive_text()
except WebSocketDisconnect:
websocketManager.disconnect(websocket)
@@ -1,6 +1,6 @@
import json
import os
from typing import Callable, Dict, Union
from typing import Callable, Union
import httpx
+3 -3
View File
@@ -143,10 +143,10 @@ async def check_swap(swap: SubmarineSwap, client):
timeout_block_height=swap.timeout_block_height,
)
await update_swap_status(swap.id, "refunded")
except BoltzNotFoundException as exc:
except BoltzNotFoundException:
logger.debug(f"Boltz - swap: {swap.boltz_id} does not exist.")
await update_swap_status(swap.id, "failed")
except MempoolBlockHeightException as exc:
except MempoolBlockHeightException:
logger.debug(
f"Boltz - tried to refund swap: {swap.id}, but has not reached the timeout."
)
@@ -171,7 +171,7 @@ async def check_reverse_swap(reverse_swap: ReverseSubmarineSwap, client):
logger.debug(f"Boltz - swap_status: {str(exc)}")
await update_swap_status(reverse_swap.id, "failed")
# should only happen while development when regtest is reset
except BoltzNotFoundException as exc:
except BoltzNotFoundException:
logger.debug(f"Boltz - reverse swap: {reverse_swap.boltz_id} does not exist.")
await update_swap_status(reverse_swap.id, "failed")
except Exception as exc:
-1
View File
@@ -10,7 +10,6 @@ from lnbits.tasks import catch_everything_and_restart
db = Database("ext_cashu")
import sys
cashu_static_files = [
{
+1 -4
View File
@@ -1,7 +1,4 @@
import os
import random
import time
from typing import Any, List, Optional, Union
from typing import List, Optional, Union
from cashu.core.base import MintKeyset
from embit import bip32, bip39, ec, script
+1 -1
View File
@@ -1,5 +1,5 @@
from sqlite3 import Row
from typing import List, Union
from typing import List
from fastapi import Query
from pydantic import BaseModel
-2
View File
@@ -1,5 +1,4 @@
import asyncio
import json
from cashu.core.migrations import migrate_databases
from cashu.mint import migrations
@@ -15,7 +14,6 @@ async def startup_cashu_mint():
await migrate_databases(db, migrations)
await ledger.load_used_proofs()
await ledger.init_keysets(autosave=False)
pass
async def wait_for_paid_invoices():
+1 -1
View File
@@ -1,6 +1,6 @@
import math
from http import HTTPStatus
from typing import Dict, List, Union
from typing import Dict, Union
# -------- cashu imports
from cashu.core.base import (
-1
View File
@@ -1,4 +1,3 @@
from http import HTTPStatus
from typing import List, Optional
from . import db
-2
View File
@@ -1,5 +1,3 @@
from typing import Optional
from pydantic.main import BaseModel
from sqlalchemy.engine import base # type: ignore
-1
View File
@@ -1,5 +1,4 @@
from sqlite3 import Row
from typing import Optional
from fastapi.param_functions import Query
from pydantic import BaseModel
-2
View File
@@ -1,5 +1,3 @@
import asyncio
from fastapi import APIRouter
from fastapi.staticfiles import StaticFiles
-1
View File
@@ -1,5 +1,4 @@
import asyncio
import json
from loguru import logger
@@ -1,5 +1,3 @@
import json
import httpx
from .models import Domains
-1
View File
@@ -228,4 +228,3 @@ async def lndhub_decodeinvoice(invoice: str = Query(None)):
@lndhub_ext.get("/ext/checkrouteinvoice")
async def lndhub_checkrouteinvoice():
"not implemented on canonical lndhub"
pass
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import List, Optional, Union
from typing import List, Optional
import shortuuid
-2
View File
@@ -1,5 +1,3 @@
import hashlib
import math
from http import HTTPStatus
from fastapi import Request
-2
View File
@@ -1,6 +1,4 @@
from base64 import urlsafe_b64encode
from typing import List, Optional, Union
from uuid import uuid4
# from lnbits.db import open_ext_db
from lnbits.db import SQLITE
-1
View File
@@ -1,6 +1,5 @@
import json
from http import HTTPStatus
from typing import List
from fastapi import (
BackgroundTasks,
-3
View File
@@ -1,7 +1,4 @@
from base64 import urlsafe_b64encode
from http import HTTPStatus
from typing import List, Union
from uuid import uuid4
from fastapi import Body, Depends, Query, Request
from loguru import logger
-2
View File
@@ -1,6 +1,4 @@
from enum import Enum
from sqlite3 import Row
from typing import List, Optional
from fastapi.param_functions import Query
from pydantic import BaseModel
-1
View File
@@ -1,4 +1,3 @@
from datetime import datetime
from http import HTTPStatus
from fastapi import Depends, Request
-1
View File
@@ -1,7 +1,6 @@
import time
from datetime import datetime
from http import HTTPStatus
from typing import List
from fastapi import Depends, HTTPException, Query, Request
from starlette.responses import HTMLResponse
-1
View File
@@ -1,4 +1,3 @@
from http import HTTPStatus
from typing import Optional
import httpx
+2 -2
View File
@@ -54,6 +54,6 @@ async def cloudflare_deletesubdomain(domain: Domains, domain_id: str):
async with httpx.AsyncClient() as client:
try:
r = await client.delete(url + "/" + domain_id, headers=header, timeout=40)
cf_response = r.text
r.text
except AssertionError:
cf_response = "Error occured"
pass
+1 -1
View File
@@ -55,4 +55,4 @@ async def on_invoice_paid(payment: Payment) -> None:
timeout=40,
)
except AssertionError:
webhook = None
pass
+1 -1
View File
@@ -3,7 +3,7 @@ import time
import traceback
import uuid
from http import HTTPStatus
from typing import Callable, Dict, List
from typing import Dict
from fastapi.exceptions import HTTPException
from loguru import logger
+1 -1
View File
@@ -1,7 +1,7 @@
import asyncio
import hashlib
import json
from typing import AsyncGenerator, Dict, Optional
from typing import AsyncGenerator, Optional
import httpx
from loguru import logger
-2
View File
@@ -4,9 +4,7 @@ except ImportError: # pragma: nocover
LightningRpc = None
import asyncio
import hashlib
import random
import time
from functools import partial, wraps
from typing import AsyncGenerator, Optional
-3
View File
@@ -98,7 +98,6 @@ class EclairWallet(Wallet):
error_message = data["error"]
except:
error_message = r.text
pass
return InvoiceResponse(False, None, None, error_message)
@@ -120,7 +119,6 @@ class EclairWallet(Wallet):
error_message = data["error"]
except:
error_message = r.text
pass
return PaymentResponse(False, None, None, None, error_message)
data = r.json()
@@ -147,7 +145,6 @@ class EclairWallet(Wallet):
error_message = data["error"]
except:
error_message = r.text
pass
return PaymentResponse(None, checking_id, None, preimage, error_message)
statuses = {
-1
View File
@@ -1,5 +1,4 @@
import asyncio
import hashlib
import json
from typing import AsyncGenerator, Dict, Optional
+2 -2
View File
@@ -9,7 +9,7 @@ except ImportError: # pragma: nocover
import asyncio
import base64
import hashlib
from os import environ, error
from os import environ
from typing import AsyncGenerator, Dict, Optional
from loguru import logger
@@ -238,7 +238,7 @@ class LndWallet(Wallet):
return PaymentStatus(None)
try:
resp = await self.rpc.LookupInvoice(ln.PaymentHash(r_hash=r_hash))
except RpcError as exc:
except RpcError:
return PaymentStatus(None)
if resp.settled:
return PaymentStatus(True)
-1
View File
@@ -2,7 +2,6 @@ import asyncio
import base64
import hashlib
import json
from pydoc import describe
from typing import AsyncGenerator, Dict, Optional
import httpx
+1 -3
View File
@@ -77,7 +77,6 @@ class LnTipsWallet(Wallet):
error_message = data["message"]
except:
error_message = r.text
pass
return InvoiceResponse(False, None, None, error_message)
@@ -103,7 +102,6 @@ class LnTipsWallet(Wallet):
error_message = data["error"]
except:
error_message = r.text
pass
return PaymentResponse(False, None, 0, None, error_message)
data = r.json()["details"]
@@ -165,7 +163,7 @@ class LnTipsWallet(Wallet):
except:
continue
yield inv["payment_hash"]
except Exception as e:
except Exception:
pass
# do not sleep if the connection was active for more than 10s
-2
View File
@@ -75,7 +75,6 @@ class LntxbotWallet(Wallet):
error_message = data["message"]
except:
error_message = r.text
pass
return InvoiceResponse(False, None, None, error_message)
@@ -97,7 +96,6 @@ class LntxbotWallet(Wallet):
error_message = data["message"]
except:
error_message = r.text
pass
return PaymentResponse(False, None, None, None, error_message)
data = r.json()
-1
View File
@@ -161,7 +161,6 @@ class SparkWallet(Wallet):
# this may result in an error if it was paid previously
# our database won't allow the same payment_hash to be added twice
# this is good
pass
fee_msat = -int(r["msatoshi_sent"] - r["msatoshi"])
preimage = r["payment_preimage"]
-1
View File
@@ -1,5 +1,4 @@
import asyncio
from typing import Tuple
import pytest_asyncio
from httpx import AsyncClient