Spaces:
Running
Running
Download code-review-env/sample_codebase/checkout.py from Athmabhiram1/nodeaudit-openenv: direct link, hf CLI and curl.
- Browser
- Download file 468 Bytes
-
https://huggingface.co/spaces/Athmabhiram1/nodeaudit-openenv/resolve/main/code-review-env/sample_codebase/checkout.py
- Command line
-
hf download hf://spaces/Athmabhiram1/nodeaudit-openenv/code-review-env/sample_codebase/checkout.py
-
curl -L -o checkout.py https://huggingface.co/spaces/Athmabhiram1/nodeaudit-openenv/resolve/main/code-review-env/sample_codebase/checkout.py
468 Bytes
| """Checkout flow.""" | |
| import cart | |
| import payments | |
| def submit_order(items: list[dict[str, float]]) -> str: | |
| total = cart.calculate_total(items) | |
| # Cascading symptom: negative total is observed here but root cause is config -> cart. | |
| if total < 0: | |
| return "error: negative total" | |
| gateway_ok = payments.run_gateway_check("https://gateway.example.com/health") | |
| if gateway_ok != 0: | |
| return "error: gateway" | |
| return payments.charge(total) | |