diff --git a/requirements.txt b/requirements.txt index dc3c9b59..8c33909d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,15 @@ -Pillow >= 5.4.1, < 6 -pymediainfo >= 4.1, < 5 -cairosvg >= 2.4.2, < 3 -aiofiles >= 0.4.0, < 0.5 -appdirs >= 1.4.3, < 2 -filetype >= 1.0.5, < 2 -html_sanitizer >= 1.7.3, < 2 -lxml >= 4.4.2, < 5 -mistune >= 0.8.4, < 0.9 -dataclasses >= 0.6, < 0.7; python_version < "3.7" -pyfastcopy >= 1.0.3, < 2; python_version < "3.8" -blist >= 1.3.6, < 2 +Pillow >= 5.4.1, < 6 +pymediainfo >= 4.1, < 5 +cairosvg >= 2.4.2, < 3 +aiofiles >= 0.4.0, < 0.5 +appdirs >= 1.4.3, < 2 +filetype >= 1.0.5, < 2 +html_sanitizer >= 1.7.3, < 2 +lxml >= 4.4.2, < 5 +mistune >= 0.8.4, < 0.9 +blist >= 1.3.6, < 2 +dataclasses >= 0.6, < 0.7; python_version < "3.7" +async_generator >= 1.10, < 2; python_version < "3.7" +pyfastcopy >= 1.0.3, < 2; python_version < "3.8" git+http://github.com/mirukan/matrix-nio#egg=matrix-nio[e2e] diff --git a/src/backend/utils.py b/src/backend/utils.py index 7a0fb280..ee021219 100644 --- a/src/backend/utils.py +++ b/src/backend/utils.py @@ -7,8 +7,8 @@ import html import inspect import io import json +import sys import xml.etree.cElementTree as xml_etree # FIXME: bandit warning -from contextlib import asynccontextmanager from datetime import datetime, timedelta from enum import Enum from enum import auto as autostr @@ -28,6 +28,11 @@ from aiofiles.threadpool.text import AsyncTextIOWrapper from nio.crypto import AsyncDataT as File from nio.crypto import async_generator_from_data +if sys.version_info >= (3, 7): + from contextlib import asynccontextmanager +else: + from async_generator import asynccontextmanager + Size = Tuple[int, int] auto = autostr