increase readability by using f-strings (#1597)
* increase readability by using f-strings * readd merge conflict stuff --------- Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -171,7 +171,7 @@ def lnencode(addr, privkey):
|
||||
else:
|
||||
amount = addr.currency if addr.currency else ""
|
||||
|
||||
hrp = "ln" + amount + "0n"
|
||||
hrp = f"ln{amount}0n"
|
||||
|
||||
# Start with the timestamp
|
||||
data = bitstring.pack("uint:35", addr.date)
|
||||
@@ -257,7 +257,7 @@ class LnAddr:
|
||||
|
||||
def __str__(self):
|
||||
pubkey = bytes.hex(self.pubkey.serialize()).decode()
|
||||
tags = ", ".join([k + "=" + str(v) for k, v in self.tags])
|
||||
tags = ", ".join([f"{k}={v}" for k, v in self.tags])
|
||||
return f"LnAddr[{pubkey}, amount={self.amount}{self.currency} tags=[{tags}]]"
|
||||
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ async def m002_add_fields_to_apipayments(db):
|
||||
continue
|
||||
|
||||
for ext in ["withdraw", "events", "lnticket", "paywall", "tpos"]:
|
||||
prefix = "#" + ext + " "
|
||||
prefix = f"#{ext} "
|
||||
if row["memo"].startswith(prefix):
|
||||
new = row["memo"][len(prefix) :]
|
||||
await db.execute(
|
||||
|
||||
@@ -570,7 +570,7 @@ async def api_lnurlscan(code: str, wallet: WalletTypeInfo = Depends(get_key_type
|
||||
if k == "text/plain":
|
||||
params.update(description=v)
|
||||
if k in ("image/jpeg;base64", "image/png;base64"):
|
||||
data_uri = "data:" + k + "," + v
|
||||
data_uri = f"data:{k},{v}"
|
||||
params.update(image=data_uri)
|
||||
if k in ("text/email", "text/identifier"):
|
||||
params.update(targetUser=v)
|
||||
|
||||
@@ -369,7 +369,7 @@ async def manifest(usr: str):
|
||||
"sizes": "900x900",
|
||||
}
|
||||
],
|
||||
"start_url": "/wallet?usr=" + usr + "&wal=" + user.wallets[0].id,
|
||||
"start_url": f"/wallet?usr={usr}&wal={user.wallets[0].id}",
|
||||
"background_color": "#1F2234",
|
||||
"description": "Bitcoin Lightning Wallet",
|
||||
"display": "standalone",
|
||||
@@ -380,7 +380,7 @@ async def manifest(usr: str):
|
||||
"name": wallet.name,
|
||||
"short_name": wallet.name,
|
||||
"description": wallet.name,
|
||||
"url": "/wallet?usr=" + usr + "&wal=" + wallet.id,
|
||||
"url": f"/wallet?usr={usr}&wal={wallet.id}",
|
||||
}
|
||||
for wallet in user.wallets
|
||||
],
|
||||
|
||||
@@ -520,7 +520,7 @@ async def fetch_github_releases(org: str, repo: str) -> List[GitHubRepoRelease]:
|
||||
async def gihub_api_get(url: str, error_msg: Optional[str]) -> Any:
|
||||
async with httpx.AsyncClient() as client:
|
||||
headers = (
|
||||
{"Authorization": "Bearer " + settings.lnbits_ext_github_token}
|
||||
{"Authorization": f"Bearer {settings.lnbits_ext_github_token}"}
|
||||
if settings.lnbits_ext_github_token
|
||||
else None
|
||||
)
|
||||
|
||||
@@ -26,7 +26,7 @@ class LndRestWallet(Wallet):
|
||||
endpoint = settings.lnd_rest_endpoint
|
||||
endpoint = endpoint[:-1] if endpoint.endswith("/") else endpoint
|
||||
endpoint = (
|
||||
"https://" + endpoint if not endpoint.startswith("http") else endpoint
|
||||
f"https://{endpoint}" if not endpoint.startswith("http") else endpoint
|
||||
)
|
||||
self.endpoint = endpoint
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class SparkWallet(Wallet):
|
||||
httpx.HTTPError,
|
||||
httpx.TimeoutException,
|
||||
) as exc:
|
||||
raise UnknownError("error connecting to spark: " + str(exc))
|
||||
raise UnknownError(f"error connecting to spark: {exc}")
|
||||
|
||||
try:
|
||||
data = r.json()
|
||||
|
||||
Reference in New Issue
Block a user