Код: Выделить всё
error: Incompatible types in assignment (expression has type "datetime", variable has type "int") [assignment]
Код: Выделить всё
from datetime import datetime, timedelta
class TokenExp:
LIFETIME = 60
def __init__(self, lifetime_in_minutes: int = LIFETIME) -> None:
self.lifetime = timedelta(minutes=lifetime_in_minutes)
self.token_exp = 0
def token_expiration(self):
now = datetime.utcnow()
self.token_exp = now + self.lifetime
return self.token_exp
Подробнее здесь: https://stackoverflow.com/questions/757 ... t-for-mypy