Code Expression (#1) (#767)

* Replace unused `for` index with underscore

* Use `items()` to directly unpack dictionary values

* Merge duplicate blocks in conditional

* Use `any()` instead of for loop

* Format __init__.py
This commit is contained in:
Yasser Tahiri
2021-10-16 08:29:34 +01:00
committed by GitHub
parent 843b197875
commit 872b85de03
4 changed files with 13 additions and 13 deletions

View File

@ -50,11 +50,10 @@ def get_oauth_router(
scopes: List[str] = Query(None),
):
# Check that authentication_backend exists
backend_exists = False
for backend in authenticator.backends:
if backend.name == authentication_backend:
backend_exists = True
break
backend_exists = any(
backend.name == authentication_backend for backend in authenticator.backends
)
if not backend_exists:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST)