From 120e4e11f75c757f9ba86486169fdf8faa87d60b Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Sat, 3 Jul 2021 03:11:15 -0400 Subject: [PATCH] Lower minimum required Python version to 3.7 Just use Dict instead of TypedDict --- SETUP.md | 2 +- matrix_puppeteer_line/rpc/client.py | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/SETUP.md b/SETUP.md index 8c37dc6..4886840 100644 --- a/SETUP.md +++ b/SETUP.md @@ -1,5 +1,5 @@ # Minimum Requirements -* Python 3.8 +* Python 3.7 * Node 10.18.1 * yarn 1.22.x diff --git a/matrix_puppeteer_line/rpc/client.py b/matrix_puppeteer_line/rpc/client.py index 5897da8..5592fd4 100644 --- a/matrix_puppeteer_line/rpc/client.py +++ b/matrix_puppeteer_line/rpc/client.py @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -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()