pythonism
This commit is contained in:
parent
6ed2324c71
commit
641dfd7ba0
2 changed files with 2 additions and 4 deletions
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
import json
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import Depends
|
||||
from jose.constants import ALGORITHMS
|
||||
|
@ -37,7 +36,7 @@ class DBConfig(BaseModel):
|
|||
|
||||
|
||||
class JWTConfig(BaseModel):
|
||||
secret: Optional[str] = None
|
||||
secret: str | None = None
|
||||
hash_algorithm: str = ALGORITHMS.HS256
|
||||
expiry_minutes: int = 30
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from jose import JWTError, jwt
|
||||
|
@ -18,7 +17,7 @@ class User(BaseModel):
|
|||
capabilities: list[str]
|
||||
|
||||
@classmethod
|
||||
def from_db(cls, username: str) -> Optional[User]:
|
||||
def from_db(cls, username: str) -> User | None:
|
||||
user = db_User.get_by_name(username)
|
||||
|
||||
if not user:
|
||||
|
|
Loading…
Reference in a new issue