Lower minimum required Python version to 3.7

Just use Dict instead of TypedDict
This commit is contained in:
Andrew Ferrazzutti 2021-07-03 03:11:15 -04:00
parent 4e21113940
commit 120e4e11f7
2 changed files with 6 additions and 10 deletions

View File

@ -1,5 +1,5 @@
# Minimum Requirements
* Python 3.8
* Python 3.7
* Node 10.18.1
* yarn 1.22.x

View File

@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import AsyncGenerator, TypedDict, List, Tuple, Dict, Callable, Awaitable, Any
from typing import AsyncGenerator, List, Tuple, Dict, Callable, Awaitable, Any
from collections import deque
from base64 import b64decode
import asyncio
@ -22,10 +22,6 @@ from .rpc import RPCClient
from .types import ChatEvents, ChatListInfo, ChatInfo, ImageData, Message, Participant, Receipt, StartStatus
class LoginCommand(TypedDict):
content: str
class Client(RPCClient):
async def start(self) -> StartStatus:
await self.connect()
@ -113,19 +109,19 @@ class Client(RPCClient):
data = deque()
event = asyncio.Event()
async def qr_handler(req: LoginCommand) -> None:
async def qr_handler(req: Dict[str, str]) -> None:
data.append(("qr", req["url"]))
event.set()
async def pin_handler(req: LoginCommand) -> None:
async def pin_handler(req: Dict[str, str]) -> None:
data.append(("pin", req["pin"]))
event.set()
async def success_handler(req: LoginCommand) -> None:
async def success_handler(req: Dict[str, str]) -> None:
data.append(("login_success", None))
event.set()
async def failure_handler(req: LoginCommand) -> None:
async def failure_handler(req: Dict[str, str]) -> None:
data.append(("login_failure", req.get("reason")))
event.set()