Use Ruff and fix all its warnings and errors

This commit is contained in:
2023-03-18 01:50:45 +01:00
parent 15284c5646
commit 948a5a2af9
27 changed files with 504 additions and 313 deletions

View File

@ -7,14 +7,15 @@ def healthcheck() -> None:
"""Check if the website is up.
sys.exit(0): success - the container is healthy and ready for use.
sys.exit(1): unhealthy - the container is not working correctly."""
sys.exit(1): unhealthy - the container is not working correctly.
"""
# TODO: We should check more than just that the website is up.
try:
r: requests.Response = requests.get(url="http://localhost:5000", timeout=5)
if r.ok:
sys.exit(0)
except requests.exceptions.RequestException as e:
print(f"Healthcheck failed: {e}", file=sys.stderr)
print(f"Healthcheck failed: {e}", file=sys.stderr) # noqa: T201
sys.exit(1)