Add support for python <3.10

This commit is contained in:
ManiMozaffar 2023-09-21 14:16:13 +03:00
parent 28a12652a3
commit dea7452652
2 changed files with 5 additions and 3 deletions

View File

@ -16,6 +16,7 @@ import time
import zipfile import zipfile
from distutils.version import LooseVersion from distutils.version import LooseVersion
from multiprocessing import Lock from multiprocessing import Lock
from typing import Optional
from urllib.request import urlopen, urlretrieve from urllib.request import urlopen, urlretrieve
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -44,7 +45,7 @@ class Patcher(object):
self, self,
executable_path=None, executable_path=None,
force=False, force=False,
version_main: None | int = 0, version_main: Optional[int] = 0,
user_multi_procs=False, user_multi_procs=False,
): ):
""" """

View File

@ -3,6 +3,7 @@ import json
import logging import logging
import threading import threading
import time import time
from typing import Dict, Optional
from selenium import webdriver from selenium import webdriver
@ -80,10 +81,10 @@ class Reactor(threading.Thread):
for entry in log_entries: for entry in log_entries:
try: try:
obj_serialized: str = entry.get("message") obj_serialized: str = entry.get("message")
obj: dict[str, dict] = json.loads(obj_serialized) obj: Dict[str, dict] = json.loads(obj_serialized)
message = obj.get("message") message = obj.get("message")
assert message is not None assert message is not None
method: str | None = message.get("method") method: Optional[str] = message.get("method")
assert isinstance(method, str) assert isinstance(method, str)
if "*" in self.handlers: if "*" in self.handlers: