Skip to content

Commit 4381075

Browse files
committed
Fix typing: Use of lambda caused typing errors
1 parent 811d791 commit 4381075

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/aleph/vm/orchestrator/supervisor.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ async def allow_cors_on_endpoint(request: web.Request):
8282
)
8383

8484

85+
async def http_not_found(request: web.Request):
86+
"""Return a 404 error for unknown URLs."""
87+
return web.HTTPNotFound()
88+
89+
8590
app = web.Application(middlewares=[server_version_middleware])
8691
cors = aiohttp_cors.setup(app)
8792

@@ -110,9 +115,9 @@ async def allow_cors_on_endpoint(request: web.Request):
110115
web.get("/status/check/ipv6", status_check_ipv6),
111116
web.get("/status/config", status_public_config),
112117
# Raise an HTTP Error 404 if attempting to access an unknown URL within these paths.
113-
web.get("/about/{suffix:.*}", lambda _: web.HTTPNotFound()),
114-
web.get("/control/{suffix:.*}", lambda _: web.HTTPNotFound()),
115-
web.get("/status/{suffix:.*}", lambda _: web.HTTPNotFound()),
118+
web.get("/about/{suffix:.*}", http_not_found),
119+
web.get("/control/{suffix:.*}", http_not_found),
120+
web.get("/status/{suffix:.*}", http_not_found),
116121
# /static is used to serve static files
117122
web.static("/static", Path(__file__).parent / "views/static"),
118123
# /vm is used to launch VMs on-demand

0 commit comments

Comments
 (0)