pythonism

This commit is contained in:
Jörn-Michael Miehe 2022-03-17 23:00:49 +00:00
parent 6ed2324c71
commit 641dfd7ba0
2 changed files with 2 additions and 4 deletions

View file

@ -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

View file

@ -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: