chore: add a check for None

route.methods can be None so let's check for that to make mypy happy :)

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han 2025-12-02 10:05:04 +01:00
parent 3ce509e94a
commit 1ffaa04f09
No known key found for this signature in database

View file

@ -100,13 +100,16 @@ class DistributionInspectImpl(Inspect):
router_routes = get_router_routes(router) router_routes = get_router_routes(router)
for route in router_routes: for route in router_routes:
if _should_include_router_route(route, router.prefix): if _should_include_router_route(route, router.prefix):
ret.append( if route.methods is not None:
RouteInfo( available_methods = [m for m in route.methods if m != "HEAD"]
route=route.path, if available_methods:
method=next(iter([m for m in route.methods if m != "HEAD"])), ret.append(
provider_types=_get_provider_types(api), RouteInfo(
) route=route.path,
) method=available_methods[0],
provider_types=_get_provider_types(api),
)
)
# Process routes from legacy webmethod-based APIs # Process routes from legacy webmethod-based APIs
for api, endpoints in all_endpoints.items(): for api, endpoints in all_endpoints.items():