black formatting

This commit is contained in:
Ben Arc
2021-04-09 00:41:19 +01:00
parent 6a18766a82
commit d872f0d138
8 changed files with 98 additions and 28 deletions
+30 -7
View File
@@ -48,7 +48,19 @@ async def api_charge_create_or_update(charge_id=None):
@api_check_wallet_key("invoice")
async def api_charges_retrieve():
try:
return jsonify([{**charge._asdict(), **{"time_elapsed": charge.time_elapsed}, **{"paid": charge.paid}}for charge in await get_charges(g.wallet.user)]), HTTPStatus.OK
return (
jsonify(
[
{
**charge._asdict(),
**{"time_elapsed": charge.time_elapsed},
**{"paid": charge.paid},
}
for charge in await get_charges(g.wallet.user)
]
),
HTTPStatus.OK,
)
except:
return ""
@@ -61,7 +73,16 @@ async def api_charge_retrieve(charge_id):
if not charge:
return jsonify({"message": "charge does not exist"}), HTTPStatus.NOT_FOUND
return jsonify({**charge._asdict(), **{"time_elapsed": charge.time_elapsed}, **{"paid": charge.paid}}), HTTPStatus.OK
return (
jsonify(
{
**charge._asdict(),
**{"time_elapsed": charge.time_elapsed},
**{"paid": charge.paid},
}
),
HTTPStatus.OK,
)
@satspay_ext.route("/api/v1/charge/<charge_id>", methods=["DELETE"])
@@ -79,6 +100,7 @@ async def api_charge_delete(charge_id):
#############################BALANCE##########################
@satspay_ext.route("/api/v1/charges/balance/<charge_id>", methods=["GET"])
async def api_charges_balance(charge_id):
@@ -110,12 +132,13 @@ async def api_charges_balance(charge_id):
charge.webhook = None
return jsonify(charge._asdict()), HTTPStatus.OK
#############################MEMPOOL##########################
@ satspay_ext.route("/api/v1/mempool", methods=["PUT"])
@ api_check_wallet_key("invoice")
@ api_validate_post_request(
@satspay_ext.route("/api/v1/mempool", methods=["PUT"])
@api_check_wallet_key("invoice")
@api_validate_post_request(
schema={
"endpoint": {"type": "string", "empty": False, "required": True},
}
@@ -125,8 +148,8 @@ async def api_update_mempool():
return jsonify(mempool._asdict()), HTTPStatus.OK
@ satspay_ext.route("/api/v1/mempool", methods=["GET"])
@ api_check_wallet_key("invoice")
@satspay_ext.route("/api/v1/mempool", methods=["GET"])
@api_check_wallet_key("invoice")
async def api_get_mempool():
mempool = await get_mempool(g.wallet.user)
if not mempool: