mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-11 19:56:03 +00:00
fix(mypy): resolve routes and type narrowing errors
- routes.py: Use type ignore for intentional None endpoint - routes.py: Handle optional route.methods with fallback to empty list 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6fa7af52f9
commit
a0694b632b
1 changed files with 4 additions and 3 deletions
|
|
@ -68,8 +68,9 @@ def get_all_api_routes(
|
|||
else:
|
||||
http_method = hdrs.METH_POST
|
||||
routes.append(
|
||||
(Route(path=path, methods=[http_method], name=name, endpoint=None), webmethod)
|
||||
) # setting endpoint to None since don't use a Router object
|
||||
# setting endpoint to None since don't use a Router object
|
||||
(Route(path=path, methods=[http_method], name=name, endpoint=None), webmethod) # type: ignore[arg-type]
|
||||
)
|
||||
|
||||
apis[api] = routes
|
||||
|
||||
|
|
@ -98,7 +99,7 @@ def initialize_route_impls(impls, external_apis: dict[Api, ExternalApiSpec] | No
|
|||
impl = impls[api]
|
||||
func = getattr(impl, route.name)
|
||||
# Get the first (and typically only) method from the set, filtering out HEAD
|
||||
available_methods = [m for m in route.methods if m != "HEAD"]
|
||||
available_methods = [m for m in (route.methods or []) if m != "HEAD"]
|
||||
if not available_methods:
|
||||
continue # Skip if only HEAD method is available
|
||||
method = available_methods[0].lower()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue