Skip to content

Commit

Permalink
⬆ Upgrade Starlette from 0.19.0 to 0.19.1 (tiangolo#4819)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
  • Loading branch information
2 people authored and JeanArhancet committed Aug 20, 2022
1 parent 0cf65d5 commit e6b4daa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
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,
)
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

0 comments on commit e6b4daa

Please sign in to comment.