1
0
mirror of https://github.com/etesync/server synced 2024-12-01 13:08:10 +00:00

Fix Python 3.7 compatibility

Both cached_property and Literal were introduced in Python 3.8 so they
can't be used.
This commit is contained in:
Tom Hacohen 2020-12-29 17:52:08 +02:00
parent 8245577dfb
commit 332f7e2332
2 changed files with 5 additions and 3 deletions

View File

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

View File

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