🎨 Upgrade typing syntax for Python 3.10 (#14932)

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tiangolo <1326112+tiangolo@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-02-17 09:59:14 +00:00
1 parent 6e5680c7ea
commit faee822574
77 files changed
+269 -375

No files matched your search

+1 -2
View File
@@ -1,5 +1,4 @@
from base64 import b64encode
from typing import Optional
from fastapi import FastAPI, Security
from fastapi.security import HTTPBasic, HTTPBasicCredentials
@@ -12,7 +11,7 @@ security = HTTPBasic(auto_error=False)
@app.get("/users/me")
def read_current_user(credentials: Optional[HTTPBasicCredentials] = Security(security)):
def read_current_user(credentials: HTTPBasicCredentials | None = Security(security)):
if credentials is None:
return {"msg": "Create an account first"}
return {"username": credentials.username, "password": credentials.password}