Fix Python 3.7 compatibility

Both cached_property and Literal were introduced in Python 3.8 so they
can't be used.
master
Tom Hacohen 4 years ago
parent 8245577dfb
commit 332f7e2332

@ -1,6 +1,6 @@
import typing as t
from typing_extensions import Literal
from datetime import datetime
from functools import cached_property
import nacl
import nacl.encoding
@ -12,6 +12,7 @@ from django.conf import settings
from django.contrib.auth import user_logged_out, user_logged_in
from django.core import exceptions as django_exceptions
from django.db import transaction
from django.utils.functional import cached_property
from fastapi import APIRouter, Depends, status, Request
from django_etebase import app_settings, models
@ -43,7 +44,7 @@ class LoginResponse(BaseModel):
username: str
challenge: bytes
host: str
action: t.Literal["login", "changePassword"]
action: Literal["login", "changePassword"]
class UserOut(BaseModel):

@ -1,5 +1,6 @@
import dataclasses
import typing as t
from typing_extensions import Literal
import msgpack
import base64
@ -17,7 +18,7 @@ from .exceptions import HttpError, HttpErrorOut
User = get_typed_user_model()
Prefetch = t.Literal["auto", "medium"]
Prefetch = Literal["auto", "medium"]
PrefetchQuery = Query(default="auto")

Loading…
Cancel
Save