Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆ Upgrade Starlette from 0.19.0 to 0.19.1 #4819

Merged
merged 26 commits into from May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions fastapi/applications.py
@@ -1,5 +1,16 @@
from enum import Enum
from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Type, Union
from typing import (
Any,
Awaitable,
Callable,
Coroutine,
Dict,
List,
Optional,
Sequence,
Type,
Union,
)

from fastapi import routing
from fastapi.datastructures import Default, DefaultPlaceholder
Expand Down Expand Up @@ -121,11 +132,8 @@ def __init__(
generate_unique_id_function=generate_unique_id_function,
)
self.exception_handlers: Dict[
Union[int, Type[Exception]],
Callable[[Request, Any], Coroutine[Any, Any, Response]],
] = (
{} if exception_handlers is None else dict(exception_handlers)
)
Any, Callable[[Request, Any], Union[Response, Awaitable[Response]]]
] = ({} if exception_handlers is None else dict(exception_handlers))
self.exception_handlers.setdefault(HTTPException, http_exception_handler)
self.exception_handlers.setdefault(
RequestValidationError, request_validation_exception_handler
Expand Down
4 changes: 1 addition & 3 deletions fastapi/exceptions.py
Expand Up @@ -12,9 +12,7 @@ def __init__(
detail: Any = None,
headers: Optional[Dict[str, Any]] = None,
) -> None:
super().__init__(
status_code=status_code, detail=detail, headers=headers # type: ignore
)
super().__init__(status_code=status_code, detail=detail, headers=headers)


RequestErrorModel: Type[BaseModel] = create_model("Request")
Expand Down
10 changes: 5 additions & 5 deletions fastapi/routing.py
Expand Up @@ -478,11 +478,11 @@ def __init__(
),
) -> None:
super().__init__(
routes=routes, # type: ignore # in Starlette
routes=routes,
redirect_slashes=redirect_slashes,
default=default, # type: ignore # in Starlette
on_startup=on_startup, # type: ignore # in Starlette
on_shutdown=on_shutdown, # type: ignore # in Starlette
default=default,
on_startup=on_startup,
on_shutdown=on_shutdown,
Comment on lines +481 to +485
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So nice to have these better type annotations in Starlette! 🎉

)
if prefix:
assert prefix.startswith("/"), "A path prefix must start with '/'"
Expand Down Expand Up @@ -757,7 +757,7 @@ def include_router(
generate_unique_id_function=current_generate_unique_id,
)
elif isinstance(route, routing.Route):
methods = list(route.methods or []) # type: ignore # in Starlette
methods = list(route.methods or [])
self.add_route(
prefix + route.path,
route.endpoint,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -35,7 +35,7 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP",
]
requires = [
"starlette==0.19.0",
"starlette==0.19.1",
"pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
]
description-file = "README.md"
Expand Down