]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
⬆ Upgrade Starlette from 0.19.0 to 0.19.1 (#4819)
authorMarcelo Trylesinski <marcelotryle@gmail.com>
Tue, 10 May 2022 03:22:26 +0000 (05:22 +0200)
committerGitHub <noreply@github.com>
Tue, 10 May 2022 03:22:26 +0000 (03:22 +0000)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
fastapi/applications.py
fastapi/exceptions.py
fastapi/routing.py
pyproject.toml

index 132a94c9a1c7cfdab758309d9f7edb57cce0fb9f..7530ddb9b8fef34dfef2a43496f8f578a7c16789 100644 (file)
@@ -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
@@ -121,11 +132,8 @@ class FastAPI(Starlette):
             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
index fcb7187488f02680e128b9a0c778ee9d66316a73..0f50acc6c58d0f361c4350beb49172b60bd7f56b 100644 (file)
@@ -12,9 +12,7 @@ class HTTPException(StarletteHTTPException):
         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")
index 6680c04ed568b3f0dfae4a06c06dbf8fd2522f8f..db39d3ffd1b158d8e90808cbbd73cdccce0df6f8 100644 (file)
@@ -478,11 +478,11 @@ class APIRouter(routing.Router):
         ),
     ) -> 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 '/'"
@@ -757,7 +757,7 @@ class APIRouter(routing.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,
index fc803f8fc5da79030ea489f4fde33e6dd68cfae7..b23d0db05aca35ae92eb00f60a79a4b0c5371b70 100644 (file)
@@ -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"