mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-10-30 00:46:14 +08:00
Drop Python 3.8 support
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Generic, Optional, Protocol
|
||||
from typing import Any, Generic, Optional, Protocol
|
||||
|
||||
from fastapi_users.authentication.strategy.db.models import AP
|
||||
|
||||
@ -13,11 +13,11 @@ class AccessTokenDatabase(Protocol, Generic[AP]):
|
||||
"""Get a single access token by token."""
|
||||
... # pragma: no cover
|
||||
|
||||
async def create(self, create_dict: Dict[str, Any]) -> AP:
|
||||
async def create(self, create_dict: dict[str, Any]) -> AP:
|
||||
"""Create an access token."""
|
||||
... # pragma: no cover
|
||||
|
||||
async def update(self, access_token: AP, update_dict: Dict[str, Any]) -> AP:
|
||||
async def update(self, access_token: AP, update_dict: dict[str, Any]) -> AP:
|
||||
"""Update an access token."""
|
||||
... # pragma: no cover
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import secrets
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from typing import Any, Dict, Generic, Optional
|
||||
from typing import Any, Generic, Optional
|
||||
|
||||
from fastapi_users import exceptions, models
|
||||
from fastapi_users.authentication.strategy.base import Strategy
|
||||
@ -50,6 +50,6 @@ class DatabaseStrategy(
|
||||
if access_token is not None:
|
||||
await self.database.delete(access_token)
|
||||
|
||||
def _create_access_token_dict(self, user: models.UP) -> Dict[str, Any]:
|
||||
def _create_access_token_dict(self, user: models.UP) -> dict[str, Any]:
|
||||
token = secrets.token_urlsafe()
|
||||
return {"token": token, "user_id": user.id}
|
||||
|
||||
Reference in New Issue
Block a user