Fix utils.py import for Python 3.6

This commit is contained in:
miruka 2020-03-14 17:32:05 -04:00
parent d3e01b938c
commit cc3bb3c4fd
2 changed files with 19 additions and 13 deletions

View File

@ -7,8 +7,9 @@ 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
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]

View File

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