fix: 🏷️ update type annotations

This commit is contained in:
thentgesMindee
2022-11-03 17:39:33 +01:00
parent 6adcf1a0de
commit aa3e108d0a
2 changed files with 5 additions and 5 deletions

View File

@@ -540,7 +540,7 @@ class Limiter:
def _check_request_limit(
self,
request: Request,
endpoint_func: Callable[..., Any],
endpoint_func: Optional[Callable[..., Any]],
in_middleware: bool = True,
) -> None:
"""

View File

@@ -1,5 +1,5 @@
import inspect
from typing import Callable, Coroutine, Iterable, Optional, Tuple, Type, Union
from typing import Callable, Iterable, Optional, Tuple, Type
from starlette.applications import Starlette
from starlette.datastructures import MutableHeaders
@@ -26,13 +26,13 @@ def _find_route_handler(
return handler
def _get_route_name(handler: Type[Callable]):
def _get_route_name(handler: Callable):
return "%s.%s" % (handler.__module__, handler.__name__)
def _check_limits(
limiter: Limiter, request: Request, handler: Optional[Callable], app: Starlette
) -> Tuple[Optional[Union[Callable, Coroutine]], bool, Optional[Exception]]:
) -> Tuple[Optional[Callable], bool, Optional[Exception]]:
"""
Utils to check (if needed) current requests limit.
It returns a tuple of size 3:
@@ -74,7 +74,7 @@ def sync_check_limits(
if inspect.iscoroutinefunction(exception_handler):
exception_handler = _rate_limit_exceeded_handler
return exception_handler(request, exc), _bool
return exception_handler(request, exc), _bool # type: ignore
async def async_check_limits(