mirror of https://github.com/tiangolo/fastapi.git
Fix linting
This commit is contained in:
parent
70a48e59a2
commit
7d071df243
|
|
@ -187,7 +187,9 @@ class HTTPBasic(HTTPBase):
|
|||
self.auto_error = auto_error
|
||||
|
||||
@handle_exc_for_ws
|
||||
async def __call__(self, request: HTTPConnection) -> Optional[HTTPBasicCredentials]:
|
||||
async def __call__( # type: ignore
|
||||
self, request: HTTPConnection
|
||||
) -> Optional[HTTPBasicCredentials]:
|
||||
authorization = request.headers.get("Authorization")
|
||||
scheme, param = get_authorization_scheme_param(authorization)
|
||||
if self.realm:
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ def get_authorization_scheme_param(
|
|||
|
||||
|
||||
_SecurityDepFunc = TypeVar(
|
||||
"_SecurityDepFunc", bound=Callable[[Any, HTTPConnection], Awaitable]
|
||||
"_SecurityDepFunc", bound=Callable[[Any, HTTPConnection], Awaitable[Any]]
|
||||
)
|
||||
|
||||
|
||||
def handle_exc_for_ws(func: _SecurityDepFunc) -> _SecurityDepFunc:
|
||||
@wraps(func)
|
||||
async def wrapper(self, request: HTTPConnection, *args, **kwargs):
|
||||
async def wrapper(self: Any, request: HTTPConnection) -> Any:
|
||||
try:
|
||||
return await func(self, request, *args, **kwargs)
|
||||
return await func(self, request)
|
||||
except HTTPException as e:
|
||||
if not isinstance(request, WebSocket):
|
||||
raise e
|
||||
|
|
|
|||
Loading…
Reference in New Issue