diff --git a/src/common/actionflow.py b/src/common/actionflow.py index ced0da6..5b37d73 100644 --- a/src/common/actionflow.py +++ b/src/common/actionflow.py @@ -1,8 +1,8 @@ from abc import abstractmethod, ABCMeta -class Unavailable(BaseException): pass -class NotAllowed(BaseException): pass +class Unavailable(Exception): pass +class NotAllowed(Exception): pass -class Action(BaseException, metaclass=ABCMeta): +class Action(Exception, metaclass=ABCMeta): def __init__(self, *args): super().__init__(*args) @@ -28,14 +28,13 @@ class ActionFlow: if self.on[index]: raise Unavailable(name) if self.on[index] is None: raise NotAllowed(name) - value = self.actions[index].prepare() - self.on[index] = bool(value) + self.on[index] = bool(self.actions[index].prepare()) def react(self): for index in self.indices.values(): if (self.on[index]): - self.on[index] = False - self.actions[index].perform() + self.on[index] = None + self.on[index] = bool(self.actions[index].perform()) def index(self, action: type[Action]) -> int: name = action.__name__ diff --git a/src/common/jsonrpc2/client.js b/src/common/jsonrpc2/client.js index 3b55bff..86d4d42 100644 --- a/src/common/jsonrpc2/client.js +++ b/src/common/jsonrpc2/client.js @@ -52,4 +52,4 @@ const RemoteProceduralCall = { window.LogRecord = LogRecord; window.Rpc2 = RemoteProceduralCall; -main(...arguments); // entrypoint to user-defined (async) main stub of the script \ No newline at end of file +main(...arguments); // user-defined code \ No newline at end of file diff --git a/src/common/utils/selenium.py b/src/common/utils/selenium.py index 7c18a4d..a52e4f3 100644 --- a/src/common/utils/selenium.py +++ b/src/common/utils/selenium.py @@ -10,8 +10,7 @@ from selenium.webdriver.support.wait import WebDriverWait from selenium.common.exceptions import StaleElementReferenceException, TimeoutException driver: WebDriver|None = None -attempts, timeout, interval = int(), float(), float() -identity = ''.join(random.choices(string.ascii_uppercase + string.digits, k=8)) +attempts, timeout, interval, identity = int(), float(), float(), None def until(condition: typing.Callable[[WebDriver], bool], watch=True): try: @@ -70,7 +69,8 @@ def click(selector: str|WebElement, wait=True, condition=False): except: break def setup(a: WebDriver, b: int, c: float, d: float): - global driver, attempts, timeout, interval + global identity, driver, attempts, timeout, interval + identity = ''.join(random.choices(string.ascii_uppercase + string.digits, k=8)) driver = a attempts = b timeout = c