From 2abc99c38f07466b372fd8ebd2c1aaf7d3e63188 Mon Sep 17 00:00:00 2001 From: kaibot Date: Fri, 10 Apr 2026 00:56:28 +0000 Subject: [PATCH] docs(willexecutors.py): Add comprehensive documentation for methods --- willexecutors.py | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/willexecutors.py b/willexecutors.py index b281a5e..2f916bb 100644 --- a/willexecutors.py +++ b/willexecutors.py @@ -40,12 +40,31 @@ class Willexecutors: - Download and update executor lists from remote sources """ + """Save executive list to plugin settings. + + Args: + bal_plugin: BAL plugin instance + willexecutors: Dictionary of executors by URL + """ def save(bal_plugin, willexecutors): _logger.debug(f"save {willexecutors},{chainname}") aw = bal_plugin.WILLEXECUTORS.get() aw[chainname] = willexecutors bal_plugin.WILLEXECUTORS.set(aw) _logger.debug(f"saved: {aw}") + """ + Retrieve and update executor list. + + Args: + bal_plugin: BAL plugin instance + update: Ping servers for fresh data + bal_window: GUI window for prompts + force: Force update regardless of settings + task: Run as background task + + Returns: + Sorted dict of executor configurations + """ # bal_plugin.WILLEXECUTORS.set(willexecutors) def get_willexecutors( @@ -101,6 +120,16 @@ class Willexecutors: def is_selected(willexecutor, value=None): if not willexecutor: + """ + Check or set executor selection status. + + Args: + willexecutor: Executor config dict + value: Selection value to set (optional) + + Returns: + Boolean selection status + """ return False if value is not None: willexecutor["selected"] = value @@ -146,6 +175,22 @@ class Willexecutors: # ) def send_request( + """ + Send HTTP request to executor server. + + Args: + method: HTTP method (get/post) + url: Target URL + data: Request payload + timeout: Timeout in seconds + handle_response: Response handler function + count_reply: Retry counter + + Returns: + Server response + + Retries up to 10 times on timeout. + """ method, url, data=None, *, timeout=10, handle_response=None, count_reply=0 ): network = Network.get_instance() @@ -221,6 +266,18 @@ class Willexecutors: pass def push_transactions_to_willexecutor(willexecutor): + """ + Push timelocked transactions to executor. + + Args: + willexecutor: Executor dict with url and txs + + Returns: + True on success, False on failure + + Raises: + AlreadyPresentException: If txs already exist + """ out = True try: _logger.debug(f"{willexecutor['url']}: {willexecutor['txs']}") @@ -251,6 +308,16 @@ class Willexecutors: def get_info_task(url, willexecutor): w = None + """ + Fetch executor info from server. + + Args: + url: Server URL + willexecutor: Config dict to update + + Returns: + Updated config with fee, address, status + """ try: _logger.info("GETINFO_WILLEXECUTOR") _logger.debug(url) @@ -286,6 +353,15 @@ class Willexecutors: willexecutors = Willexecutors.send_request( "get", f"https://welist.bitcoin-after.life/data/{chainname}?page=0&limit=100", + """ + Download executor list from remote source. + + Args: + old_willexecutors: Previous configs for merge + + Returns: + Dictionary of executor configs + """ ) # del willexecutors["status"] for w in willexecutors: