mirror of
https://github.com/Sea-Haven-Industries/meal-order-manager.git
synced 2026-10-07 16:18:54 +00:00
style(python): apply Ruff formatting
This commit is contained in:
parent
308f46eafd
commit
7e4bccc804
3 changed files with 15 additions and 19 deletions
|
|
@ -220,9 +220,7 @@ def handle_publish_settings():
|
||||||
return response(
|
return response(
|
||||||
200,
|
200,
|
||||||
{
|
{
|
||||||
"bulk_discount_percent": float(
|
"bulk_discount_percent": float(settings.get("bulk_discount_percent", 0)),
|
||||||
settings.get("bulk_discount_percent", 0)
|
|
||||||
),
|
|
||||||
"company_subsidy_percent": float(
|
"company_subsidy_percent": float(
|
||||||
settings.get("company_subsidy_percent", 0)
|
settings.get("company_subsidy_percent", 0)
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,13 @@ def signed_request(
|
||||||
return json.loads(response.read())
|
return json.loads(response.read())
|
||||||
except urllib.error.HTTPError as exc:
|
except urllib.error.HTTPError as exc:
|
||||||
detail = exc.read().decode(errors="replace")
|
detail = exc.read().decode(errors="replace")
|
||||||
raise RuntimeError(f"Publication API returned HTTP {exc.code}: {detail}") from exc
|
raise RuntimeError(
|
||||||
|
f"Publication API returned HTTP {exc.code}: {detail}"
|
||||||
|
) from exc
|
||||||
|
|
||||||
|
|
||||||
def get_settings(api_url: str, region: str) -> dict:
|
def get_settings(api_url: str, region: str) -> dict:
|
||||||
return signed_request(
|
return signed_request(api_url, "/api/publish/settings", method="GET", region=region)
|
||||||
api_url, "/api/publish/settings", method="GET", region=region
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def publish_menu(api_url: str, region: str) -> dict:
|
def publish_menu(api_url: str, region: str) -> dict:
|
||||||
|
|
@ -81,9 +81,7 @@ def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("action", choices=("settings", "publish"))
|
parser.add_argument("action", choices=("settings", "publish"))
|
||||||
parser.add_argument("--api-url", required=True)
|
parser.add_argument("--api-url", required=True)
|
||||||
parser.add_argument(
|
parser.add_argument("--region", default=os.environ.get("AWS_REGION", "us-east-1"))
|
||||||
"--region", default=os.environ.get("AWS_REGION", "us-east-1")
|
|
||||||
)
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -189,16 +189,16 @@ class TestGenerateFormStructural:
|
||||||
if route == "/api/publish/settings"
|
if route == "/api/publish/settings"
|
||||||
else " AdminOrders:"
|
else " AdminOrders:"
|
||||||
)
|
)
|
||||||
route_config = template.split(f"Path: {route}", 1)[1].split(
|
route_config = template.split(f"Path: {route}", 1)[1].split(next_event, 1)[
|
||||||
next_event, 1
|
0
|
||||||
)[0]
|
]
|
||||||
assert "Authorizer: AWS_IAM" in route_config
|
assert "Authorizer: AWS_IAM" in route_config
|
||||||
assert route in script
|
assert route in script
|
||||||
|
|
||||||
assert "scripts/upload_menu.py settings" in workflow
|
assert "scripts/upload_menu.py settings" in workflow
|
||||||
assert "scripts/upload_menu.py publish" in workflow
|
assert "scripts/upload_menu.py publish" in workflow
|
||||||
assert "aws dynamodb" not in workflow
|
assert "aws dynamodb" not in workflow
|
||||||
assert "boto3.resource(\"dynamodb\")" not in script
|
assert 'boto3.resource("dynamodb")' not in script
|
||||||
|
|
||||||
def test_local_and_google_render(self):
|
def test_local_and_google_render(self):
|
||||||
local = _render(google=False)
|
local = _render(google=False)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue