From 82c7356daf56e8689b2fc7ae0b945412ba4b12bf Mon Sep 17 00:00:00 2001
From: JeffreyChen <33644111+JE-Chen@users.noreply.github.com>
Date: Sat, 17 Jun 2023 17:54:09 +0800
Subject: [PATCH 1/8] Refactor
Refactor
---
.idea/workspace.xml | 6 ++++--
je_auto_control/linux_with_x11/core/utils/x11_linux_vk.py | 2 --
.../linux_with_x11/keyboard/x11_linux_keyboard_control.py | 2 --
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ef3be7f..e0fb5b6 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,9 @@
-
+
+
+
@@ -62,7 +64,7 @@
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false",
"git-widget-placeholder": "dev",
- "last_opened_file_path": "C:/Users/JeffreyChen/Desktop/Code_Space/LoadDensity",
+ "last_opened_file_path": "C:/Users/JeffreyChen/Desktop/Code_Space/AutoControl",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
diff --git a/je_auto_control/linux_with_x11/core/utils/x11_linux_vk.py b/je_auto_control/linux_with_x11/core/utils/x11_linux_vk.py
index de670ed..dc17983 100644
--- a/je_auto_control/linux_with_x11/core/utils/x11_linux_vk.py
+++ b/je_auto_control/linux_with_x11/core/utils/x11_linux_vk.py
@@ -2,7 +2,6 @@
from je_auto_control.utils.exception.exception_tags import linux_import_error
from je_auto_control.utils.exception.exceptions import AutoControlException
-from je_auto_control.utils.logging.loggin_instance import auto_control_logger
if sys.platform not in ["linux", "linux2"]:
raise AutoControlException(linux_import_error)
@@ -195,4 +194,3 @@
x11_linux_key_8 = display.keysym_to_keycode(XK.string_to_keysym("8"))
x11_linux_key_9 = display.keysym_to_keycode(XK.string_to_keysym("9"))
x11_linux_key_0 = display.keysym_to_keycode(XK.string_to_keysym("0"))
-
diff --git a/je_auto_control/linux_with_x11/keyboard/x11_linux_keyboard_control.py b/je_auto_control/linux_with_x11/keyboard/x11_linux_keyboard_control.py
index e9835d0..c6524bf 100644
--- a/je_auto_control/linux_with_x11/keyboard/x11_linux_keyboard_control.py
+++ b/je_auto_control/linux_with_x11/keyboard/x11_linux_keyboard_control.py
@@ -3,7 +3,6 @@
from je_auto_control.utils.exception.exception_tags import linux_import_error
from je_auto_control.utils.exception.exceptions import AutoControlException
-from je_auto_control.utils.logging.loggin_instance import auto_control_logger
if sys.platform not in ["linux", "linux2"]:
raise AutoControlException(linux_import_error)
@@ -29,4 +28,3 @@ def release_key(keycode: int) -> None:
time.sleep(0.01)
fake_input(display, X.KeyRelease, keycode)
display.sync()
-
From 5a61d283a7fba141f5e5c592b0e163dd3bbe6968 Mon Sep 17 00:00:00 2001
From: JeffreyChen <33644111+JE-Chen@users.noreply.github.com>
Date: Mon, 19 Jun 2023 15:58:36 +0800
Subject: [PATCH 2/8] Refactor update dev version
Refactor update dev version
---
.idea/workspace.xml | 6 +-
.../callback/callback_function_executor.py | 7 +-
.../utils/executor/action_executor.py | 14 +-
.../generate_report/generate_html_report.py | 2 +-
.../generate_report/generate_json_report.py | 3 +-
.../generate_report/generate_xml_report.py | 5 +-
je_auto_control/utils/json/json_file.py | 3 +-
.../package_manager/package_manager_class.py | 11 +-
.../utils/scheduler/extend_apscheduler.py | 178 ++++++++++++------
.../auto_control_socket_server.py | 4 +-
.../utils/start_exe/start_another_process.py | 2 +-
.../utils/timeout/multiprocess_timeout.py | 2 +-
pyproject.toml | 12 +-
dev.toml => stable.toml | 10 +-
14 files changed, 163 insertions(+), 96 deletions(-)
rename dev.toml => stable.toml (87%)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e0fb5b6..7df422e 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,7 @@
-
-
-
+
@@ -64,7 +62,7 @@
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false",
"git-widget-placeholder": "dev",
- "last_opened_file_path": "C:/Users/JeffreyChen/Desktop/Code_Space/AutoControl",
+ "last_opened_file_path": "C:/Users/JeffreyChen/Desktop/Code_Space/pynecone_add_zh_cn_readme",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
diff --git a/je_auto_control/utils/callback/callback_function_executor.py b/je_auto_control/utils/callback/callback_function_executor.py
index 726928e..02ee1ad 100644
--- a/je_auto_control/utils/callback/callback_function_executor.py
+++ b/je_auto_control/utils/callback/callback_function_executor.py
@@ -1,4 +1,4 @@
-import typing
+from typing import Callable, Any
from sys import stderr
from je_auto_control.utils.exception.exception_tags import get_bad_trigger_method, get_bad_trigger_function
@@ -122,11 +122,11 @@ def __init__(self):
def callback_function(
self,
trigger_function_name: str,
- callback_function: typing.Callable,
+ callback_function: Callable,
callback_function_param: [dict, None] = None,
callback_param_method: str = "kwargs",
**kwargs
- ) -> typing.Any:
+ ) -> Any:
"""
:param trigger_function_name: what function we want to trigger only accept function in event_dict
:param callback_function: what function we want to callback
@@ -155,4 +155,3 @@ def callback_function(
callback_executor = CallbackFunctionExecutor()
package_manager.callback_executor = callback_executor
-
diff --git a/je_auto_control/utils/executor/action_executor.py b/je_auto_control/utils/executor/action_executor.py
index b2880a3..31f9c7a 100644
--- a/je_auto_control/utils/executor/action_executor.py
+++ b/je_auto_control/utils/executor/action_executor.py
@@ -1,7 +1,7 @@
import builtins
-import sys
import types
from inspect import getmembers, isbuiltin
+from typing import Any, Dict, List
from je_auto_control.utils.exception.exception_tags import action_is_null_error, add_command_exception, \
executor_list_error
@@ -94,7 +94,7 @@ def __init__(self):
for function in getmembers(builtins, isbuiltin):
self.event_dict.update({str(function[0]): function[1]})
- def _execute_event(self, action: list):
+ def _execute_event(self, action: list) -> Any:
event = self.event_dict.get(action[0])
if len(action) == 2:
if isinstance(action[1], dict):
@@ -106,7 +106,7 @@ def _execute_event(self, action: list):
else:
raise AutoControlActionException(cant_execute_action_error + " " + str(action))
- def execute_action(self, action_list: [list, dict]) -> dict:
+ def execute_action(self, action_list: [list, dict]) -> Dict[str, str]:
"""
use to execute all action on action list(action file or program list)
:param action_list the list include action
@@ -145,7 +145,7 @@ def execute_action(self, action_list: [list, dict]) -> dict:
print(value, flush=True)
return execute_record_dict
- def execute_files(self, execute_files_list: list) -> list:
+ def execute_files(self, execute_files_list: list) -> List[Dict[str, str]]:
"""
:param execute_files_list: list include execute files path
:return: every execute detail as list
@@ -161,7 +161,7 @@ def execute_files(self, execute_files_list: list) -> list:
package_manager.executor = executor
-def add_command_to_executor(command_dict: dict):
+def add_command_to_executor(command_dict: dict) -> None:
"""
:param command_dict: dict include command we want to add to event_dict
"""
@@ -172,9 +172,9 @@ def add_command_to_executor(command_dict: dict):
raise AutoControlAddCommandException(add_command_exception)
-def execute_action(action_list: list) -> dict:
+def execute_action(action_list: list) -> Dict[str, str]:
return executor.execute_action(action_list)
-def execute_files(execute_files_list: list) -> list:
+def execute_files(execute_files_list: list) -> List[Dict[str, str]]:
return executor.execute_files(execute_files_list)
diff --git a/je_auto_control/utils/generate_report/generate_html_report.py b/je_auto_control/utils/generate_report/generate_html_report.py
index 1708fe0..a9c7d28 100644
--- a/je_auto_control/utils/generate_report/generate_html_report.py
+++ b/je_auto_control/utils/generate_report/generate_html_report.py
@@ -150,7 +150,7 @@ def generate_html() -> str:
return new_html_string
-def generate_html_report(html_name: str = "default_name"):
+def generate_html_report(html_name: str = "default_name") -> None:
auto_control_logger.info(f"generate_html_report, html_name: {html_name}")
"""
Output html report file
diff --git a/je_auto_control/utils/generate_report/generate_json_report.py b/je_auto_control/utils/generate_report/generate_json_report.py
index 8eee6e2..dd25be9 100644
--- a/je_auto_control/utils/generate_report/generate_json_report.py
+++ b/je_auto_control/utils/generate_report/generate_json_report.py
@@ -1,5 +1,4 @@
import json
-import sys
from threading import Lock
from je_auto_control.utils.exception.exception_tags import cant_generate_json_report
@@ -8,7 +7,7 @@
from je_auto_control.utils.test_record.record_test_class import test_record_instance
-def generate_json():
+def generate_json() -> tuple[dict[str, dict[str, str]], dict[str, dict[str, str]]]:
auto_control_logger.info("generate_json")
"""
:return: two dict {success_dict}, {failure_dict}
diff --git a/je_auto_control/utils/generate_report/generate_xml_report.py b/je_auto_control/utils/generate_report/generate_xml_report.py
index c2d5aeb..f1383ed 100644
--- a/je_auto_control/utils/generate_report/generate_xml_report.py
+++ b/je_auto_control/utils/generate_report/generate_xml_report.py
@@ -1,13 +1,13 @@
-import sys
from threading import Lock
from xml.dom.minidom import parseString
+from typing import Tuple, Dict, Union
from je_auto_control.utils.generate_report.generate_json_report import generate_json
from je_auto_control.utils.logging.loggin_instance import auto_control_logger
from je_auto_control.utils.xml.change_xml_structure.change_xml_structure import dict_to_elements_tree
-def generate_xml():
+def generate_xml() -> Tuple[Union[str, bytes], Union[str, bytes]]:
auto_control_logger.info("generate_xml")
"""
:return: two dict {success_dict}, {failure_dict}
@@ -52,4 +52,3 @@ def generate_xml_report(xml_file_name: str = "default_name"):
f"failed: {repr(error)}")
finally:
lock.release()
-
diff --git a/je_auto_control/utils/json/json_file.py b/je_auto_control/utils/json/json_file.py
index a3050b2..0003f3c 100644
--- a/je_auto_control/utils/json/json_file.py
+++ b/je_auto_control/utils/json/json_file.py
@@ -1,6 +1,7 @@
import json
from pathlib import Path
from threading import Lock
+from typing import List, Dict
from je_auto_control.utils.exception.exception_tags import cant_find_json_error
from je_auto_control.utils.exception.exception_tags import cant_save_json_error
@@ -9,7 +10,7 @@
_lock = Lock()
-def read_action_json(json_file_path: str) -> list:
+def read_action_json(json_file_path: str) -> List[List[Dict[str, Dict[str, str]]]]:
"""
use to read action file
:param json_file_path json file's path to read
diff --git a/je_auto_control/utils/package_manager/package_manager_class.py b/je_auto_control/utils/package_manager/package_manager_class.py
index 2d756cd..040d19e 100644
--- a/je_auto_control/utils/package_manager/package_manager_class.py
+++ b/je_auto_control/utils/package_manager/package_manager_class.py
@@ -2,6 +2,7 @@
from importlib.util import find_spec
from inspect import getmembers, isfunction, isbuiltin, isclass
from sys import stderr
+from typing import Union, Callable
from je_auto_control.utils.logging.loggin_instance import auto_control_logger
@@ -14,7 +15,7 @@ def __init__(self):
self.executor = None
self.callback_executor = None
- def check_package(self, package: str):
+ def check_package(self, package: str) -> Union[None, dict[str, Callable]]:
"""
:param package: package to check exists or not
:return: package if find else None
@@ -30,7 +31,7 @@ def check_package(self, package: str):
print(repr(error), file=stderr)
return self.installed_package_dict.get(package, None)
- def add_package_to_executor(self, package):
+ def add_package_to_executor(self, package) -> None:
auto_control_logger.info(f"add_package_to_executor, package: {package}")
"""
:param package: package's function will add to executor
@@ -40,7 +41,7 @@ def add_package_to_executor(self, package):
target=self.executor
)
- def add_package_to_callback_executor(self, package):
+ def add_package_to_callback_executor(self, package) -> None:
auto_control_logger.info(f"add_package_to_callback_executor, package: {package}")
"""
:param package: package's function will add to callback_executor
@@ -50,7 +51,7 @@ def add_package_to_callback_executor(self, package):
target=self.callback_executor
)
- def get_member(self, package, predicate, target):
+ def get_member(self, package, predicate, target) -> None:
"""
:param package: package we want to get member
:param predicate: predicate
@@ -67,7 +68,7 @@ def get_member(self, package, predicate, target):
else:
print(f"Executor error {self.executor}", file=stderr)
- def add_package_to_target(self, package, target):
+ def add_package_to_target(self, package, target) -> None:
"""
:param package: package we want to get member
:param target: which event_dict will be added
diff --git a/je_auto_control/utils/scheduler/extend_apscheduler.py b/je_auto_control/utils/scheduler/extend_apscheduler.py
index c791e51..e795af0 100644
--- a/je_auto_control/utils/scheduler/extend_apscheduler.py
+++ b/je_auto_control/utils/scheduler/extend_apscheduler.py
@@ -1,5 +1,7 @@
-from typing import Callable
+from datetime import datetime
+from typing import Callable, Any, Union
+from apscheduler.job import Job
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.util import undefined
@@ -12,117 +14,185 @@ def __init__(self):
self._background_schedulers: BackgroundScheduler = BackgroundScheduler()
def add_blocking_job(
- self, func, trigger=None, args=None, kwargs=None, id=None, name=None,
- misfire_grace_time=undefined, coalesce=undefined, max_instances=undefined,
- next_run_time=undefined, jobstore='default', executor='default',
- replace_existing=False, **trigger_args):
+ self, func: Callable, trigger: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, id: str = None, name: str = None,
+ misfire_grace_time: int = undefined, coalesce: bool = undefined, max_instances: int = undefined,
+ next_run_time: datetime = undefined, jobstore: str = 'default', executor: str = 'default',
+ replace_existing: bool = False, **trigger_args: Any) -> Job:
+ """
+ Just an apscheduler add job wrapper.
+ :param func: callable (or a textual reference to one) to run at the given time
+ :param str|apscheduler.triggers.base.BaseTrigger trigger: trigger that determines when
+ ``func`` is called
+ :param list|tuple args: list of positional arguments to call func with
+ :param dict kwargs: dict of keyword arguments to call func with
+ :param str|unicode id: explicit identifier for the job (for modifying it later)
+ :param str|unicode name: textual description of the job
+ :param int misfire_grace_time: seconds after the designated runtime that the job is still
+ allowed to be run (or ``None`` to allow the job to run no matter how late it is)
+ :param bool coalesce: run once instead of many times if the scheduler determines that the
+ job should be run more than once in succession
+ :param int max_instances: maximum number of concurrently running instances allowed for this
+ job
+ :param datetime next_run_time: when to first run the job, regardless of the trigger (pass
+ ``None`` to add the job as paused)
+ :param str|unicode jobstore: alias of the job store to store the job in
+ :param str|unicode executor: alias of the executor to run the job with
+ :param bool replace_existing: ``True`` to replace an existing job with the same ``id``
+ (but retain the number of runs from the existing one)
+ :return: Job
+ """
params = locals()
params.pop("self")
trigger_args = params.pop("trigger_args")
- self._blocking_schedulers.add_job(**params, **trigger_args)
+ return self._blocking_schedulers.add_job(**params, **trigger_args)
def add_nonblocking_job(
- self, func, trigger=None, args=None, kwargs=None, id=None, name=None,
- misfire_grace_time=undefined, coalesce=undefined, max_instances=undefined,
- next_run_time=undefined, jobstore='default', executor='default',
- replace_existing=False, **trigger_args):
+ self, func: Callable, trigger: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, id: str = None, name: str = None,
+ misfire_grace_time: int = undefined, coalesce: bool = undefined, max_instances: int = undefined,
+ next_run_time: datetime = undefined, jobstore: str = 'default', executor: str = 'default',
+ replace_existing: bool = False, **trigger_args: Any) -> Job:
+ """
+ Just an apscheduler add job wrapper.
+ :param func: callable (or a textual reference to one) to run at the given time
+ :param str|apscheduler.triggers.base.BaseTrigger trigger: trigger that determines when
+ ``func`` is called
+ :param list|tuple args: list of positional arguments to call func with
+ :param dict kwargs: dict of keyword arguments to call func with
+ :param str|unicode id: explicit identifier for the job (for modifying it later)
+ :param str|unicode name: textual description of the job
+ :param int misfire_grace_time: seconds after the designated runtime that the job is still
+ allowed to be run (or ``None`` to allow the job to run no matter how late it is)
+ :param bool coalesce: run once instead of many times if the scheduler determines that the
+ job should be run more than once in succession
+ :param int max_instances: maximum number of concurrently running instances allowed for this
+ job
+ :param datetime next_run_time: when to first run the job, regardless of the trigger (pass
+ ``None`` to add the job as paused)
+ :param str|unicode jobstore: alias of the job store to store the job in
+ :param str|unicode executor: alias of the executor to run the job with
+ :param bool replace_existing: ``True`` to replace an existing job with the same ``id``
+ (but retain the number of runs from the existing one)
+ :return: Job
+ """
params = locals()
params.pop("self")
trigger_args = params.pop("trigger_args")
- self._background_schedulers.add_job(**params, **trigger_args)
+ return self._background_schedulers.add_job(**params, **trigger_args)
- def get_blocking_scheduler(self):
+ def get_blocking_scheduler(self) -> BlockingScheduler:
+ """
+ Return self blocking scheduler
+ :return: BlockingScheduler
+ """
return self._blocking_schedulers
- def get_nonblocking_scheduler(self):
+ def get_nonblocking_scheduler(self) -> BackgroundScheduler:
+ """
+ Return self background scheduler
+ :return: BackgroundScheduler
+ """
return self._background_schedulers
- def start_block_scheduler(self, *args, **kwargs):
+ def start_block_scheduler(self, *args: Any, **kwargs: Any) -> None:
+ """
+ Start blocking scheduler
+ :return: None
+ """
self._blocking_schedulers.start(*args, **kwargs)
- def start_nonblocking_scheduler(self, *args, **kwargs):
+ def start_nonblocking_scheduler(self, *args: Any, **kwargs: Any) -> None:
+ """
+ Start background scheduler
+ :return: None
+ """
self._background_schedulers.start(*args, **kwargs)
- def start_all_scheduler(self, *args, **kwargs):
+ def start_all_scheduler(self, *args: Any, **kwargs: Any) -> None:
+ """
+ Start background and blocking scheduler
+ :return: None
+ """
self._blocking_schedulers.start(*args, **kwargs)
self._background_schedulers.start(*args, **kwargs)
def add_interval_blocking_secondly(
- self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, seconds: int = 1, **trigger_args):
- self.add_blocking_job(
+ self, function: Callable, id: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, seconds: int = 1, **trigger_args: Any) -> Job:
+ return self.add_blocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, seconds=seconds, **trigger_args)
def add_interval_blocking_minutely(
- self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, minutes: int = 1, **trigger_args):
- self.add_blocking_job(
+ self, function: Callable, id: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, minutes: int = 1, **trigger_args: Any) -> Job:
+ return self.add_blocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, minutes=minutes, **trigger_args)
def add_interval_blocking_hourly(
- self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, hours: int = 1, **trigger_args):
- self.add_blocking_job(
+ self, function: Callable, id: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, hours: int = 1, **trigger_args: Any) -> Job:
+ return self.add_blocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, hours=hours, **trigger_args)
def add_interval_blocking_daily(
- self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, days: int = 1, **trigger_args):
- self.add_blocking_job(
+ self, function: Callable, id: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, days: int = 1, **trigger_args: Any) -> Job:
+ return self.add_blocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, days=days, **trigger_args)
def add_interval_blocking_weekly(
- self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, weeks: int = 1, **trigger_args):
- self.add_blocking_job(
+ self, function: Callable, id: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, weeks: int = 1, **trigger_args: Any) -> Job:
+ return self.add_blocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, weeks=weeks, **trigger_args)
def add_interval_nonblocking_secondly(
self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, seconds: int = 1, **trigger_args):
- self.add_nonblocking_job(
+ kwargs: dict = None, seconds: int = 1, **trigger_args: Any) -> Job:
+ return self.add_nonblocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, seconds=seconds, **trigger_args)
def add_interval_nonblocking_minutely(
self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, minutes: int = 1, **trigger_args):
- self.add_nonblocking_job(
+ kwargs: dict = None, minutes: int = 1, **trigger_args: Any) -> Job:
+ return self.add_nonblocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, minutes=minutes, **trigger_args)
def add_interval_nonblocking_hourly(
- self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, hours: int = 1, **trigger_args):
- self.add_nonblocking_job(
+ self, function: Callable, id: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, hours: int = 1, **trigger_args: Any) -> Job:
+ return self.add_nonblocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, hours=hours, **trigger_args)
def add_interval_nonblocking_daily(
- self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, days: int = 1, **trigger_args):
- self.add_nonblocking_job(
+ self, function: Callable, id: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, days: int = 1, **trigger_args: Any) -> Job:
+ return self.add_nonblocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, days=days, **trigger_args)
def add_interval_nonblocking_weekly(
- self, function: Callable, id: str = None, args: list = None,
- kwargs: dict = None, weeks: int = 1, **trigger_args):
- self.add_nonblocking_job(
+ self, function: Callable, id: str = None, args: Union[list, tuple] = None,
+ kwargs: dict = None, weeks: int = 1, **trigger_args: Any) -> Job:
+ return self.add_nonblocking_job(
func=function, trigger="interval", id=id, args=args, kwargs=kwargs, weeks=weeks, **trigger_args)
def add_cron_blocking(
- self, function: Callable, id: str = None, **trigger_args):
- self.add_blocking_job(func=function, id=id, trigger="cron", **trigger_args)
+ self, function: Callable, id: str = None, **trigger_args: Any) -> Job:
+ return self.add_blocking_job(func=function, id=id, trigger="cron", **trigger_args)
def add_cron_nonblocking(
- self, function: Callable, id: str = None, **trigger_args):
- self.add_nonblocking_job(func=function, id=id, trigger="cron", **trigger_args)
+ self, function: Callable, id: str = None, **trigger_args: Any) -> Job:
+ return self.add_nonblocking_job(func=function, id=id, trigger="cron", **trigger_args)
- def remove_blocking_job(self, id: str, jobstore: str = 'default'):
- self._blocking_schedulers.remove_job(job_id=id, jobstore=jobstore)
+ def remove_blocking_job(self, id: str, jobstore: str = 'default') -> Any:
+ return self._blocking_schedulers.remove_job(job_id=id, jobstore=jobstore)
- def remove_nonblocking_job(self, id: str, jobstore: str = 'default'):
- self._background_schedulers.remove_job(job_id=id, jobstore=jobstore)
+ def remove_nonblocking_job(self, id: str, jobstore: str = 'default') -> Any:
+ return self._background_schedulers.remove_job(job_id=id, jobstore=jobstore)
- def shutdown_blocking_scheduler(self, wait: bool = False):
+ def shutdown_blocking_scheduler(self, wait: bool = False) -> None:
self._blocking_schedulers.shutdown(wait=wait)
- def shutdown_nonblocking_scheduler(self, wait: bool = False):
+ def shutdown_nonblocking_scheduler(self, wait: bool = False) -> None:
self._background_schedulers.shutdown(wait=wait)
diff --git a/je_auto_control/utils/socket_server/auto_control_socket_server.py b/je_auto_control/utils/socket_server/auto_control_socket_server.py
index 608f45b..c2861f3 100644
--- a/je_auto_control/utils/socket_server/auto_control_socket_server.py
+++ b/je_auto_control/utils/socket_server/auto_control_socket_server.py
@@ -8,7 +8,7 @@
class TCPServerHandler(socketserver.BaseRequestHandler):
- def handle(self):
+ def handle(self) -> None:
command_string = str(self.request.recv(8192).strip(), encoding="utf-8")
socket = self.request
print("command is: " + command_string, flush=True)
@@ -42,7 +42,7 @@ def __init__(self, server_address, request_handler_class):
self.close_flag: bool = False
-def start_autocontrol_socket_server(host: str = "localhost", port: int = 9938):
+def start_autocontrol_socket_server(host: str = "localhost", port: int = 9938) -> TCPServer:
if len(sys.argv) == 2:
host = sys.argv[1]
elif len(sys.argv) == 3:
diff --git a/je_auto_control/utils/start_exe/start_another_process.py b/je_auto_control/utils/start_exe/start_another_process.py
index d87b432..f60ec65 100644
--- a/je_auto_control/utils/start_exe/start_another_process.py
+++ b/je_auto_control/utils/start_exe/start_another_process.py
@@ -7,7 +7,7 @@
from je_auto_control.utils.shell_process.shell_exec import ShellManager
-def start_exe(exe_path: str):
+def start_exe(exe_path: str) -> None:
auto_control_logger.info(f"start_exe, exe_path: {exe_path}")
exe_path = Path(exe_path)
if exe_path.exists() and exe_path.is_file():
diff --git a/je_auto_control/utils/timeout/multiprocess_timeout.py b/je_auto_control/utils/timeout/multiprocess_timeout.py
index d9e056f..bdde3fd 100644
--- a/je_auto_control/utils/timeout/multiprocess_timeout.py
+++ b/je_auto_control/utils/timeout/multiprocess_timeout.py
@@ -4,7 +4,7 @@
from je_auto_control.utils.exception.exceptions import AutoControlTimeoutException
-def multiprocess_timeout(check_function, time: int):
+def multiprocess_timeout(check_function, time: int) -> str:
try:
new_process: Process = Process(target=check_function)
new_process.start()
diff --git a/pyproject.toml b/pyproject.toml
index d19fe6b..7c7eab9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,12 +1,12 @@
-# Rename to build stable version
-# This is stable version
+# Rename to build dev version
+# This is dev version
[build-system]
-requires = ["setuptools>=61.0"]
+requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control"
-version = "0.0.144"
+name = "je_auto_control_dev"
+version = "0.0.83"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
@@ -45,4 +45,4 @@ content-type = "text/markdown"
license-files = ["LICENSE"]
[tool.setuptools.packages]
-find = { namespaces = false }
\ No newline at end of file
+find = { namespaces = false }
diff --git a/dev.toml b/stable.toml
similarity index 87%
rename from dev.toml
rename to stable.toml
index 9fd85e2..d19fe6b 100644
--- a/dev.toml
+++ b/stable.toml
@@ -1,12 +1,12 @@
-# Rename to build dev version
-# This is dev version
+# Rename to build stable version
+# This is stable version
[build-system]
-requires = ["setuptools"]
+requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control_dev"
-version = "0.0.82"
+name = "je_auto_control"
+version = "0.0.144"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
From 442a4522f5ab7d93b7a07f260af85282162787ba Mon Sep 17 00:00:00 2001
From: JeffreyChen <33644111+JE-Chen@users.noreply.github.com>
Date: Mon, 19 Jun 2023 16:17:04 +0800
Subject: [PATCH 3/8] Update stable version
Update stable version
---
stable.toml => dev.toml | 12 ++++++------
pyproject.toml | 10 +++++-----
2 files changed, 11 insertions(+), 11 deletions(-)
rename stable.toml => dev.toml (87%)
diff --git a/stable.toml b/dev.toml
similarity index 87%
rename from stable.toml
rename to dev.toml
index d19fe6b..7c7eab9 100644
--- a/stable.toml
+++ b/dev.toml
@@ -1,12 +1,12 @@
-# Rename to build stable version
-# This is stable version
+# Rename to build dev version
+# This is dev version
[build-system]
-requires = ["setuptools>=61.0"]
+requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control"
-version = "0.0.144"
+name = "je_auto_control_dev"
+version = "0.0.83"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
@@ -45,4 +45,4 @@ content-type = "text/markdown"
license-files = ["LICENSE"]
[tool.setuptools.packages]
-find = { namespaces = false }
\ No newline at end of file
+find = { namespaces = false }
diff --git a/pyproject.toml b/pyproject.toml
index 7c7eab9..2e2bf19 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,12 +1,12 @@
-# Rename to build dev version
-# This is dev version
+# Rename to build stable version
+# This is stable version
[build-system]
-requires = ["setuptools"]
+requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control_dev"
-version = "0.0.83"
+name = "je_auto_control"
+version = "0.0.145"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
From 20f46d5d4c63ecd14a67815b2f0e2b024c79bc19 Mon Sep 17 00:00:00 2001
From: JeffreyChen <33644111+JE-Chen@users.noreply.github.com>
Date: Mon, 19 Jun 2023 16:27:08 +0800
Subject: [PATCH 4/8] Update stable and dev version
Update stable and dev version
---
.../utils/generate_report/generate_json_report.py | 3 ++-
pyproject.toml | 10 +++++-----
dev.toml => stable.toml | 10 +++++-----
3 files changed, 12 insertions(+), 11 deletions(-)
rename dev.toml => stable.toml (89%)
diff --git a/je_auto_control/utils/generate_report/generate_json_report.py b/je_auto_control/utils/generate_report/generate_json_report.py
index dd25be9..33baa6c 100644
--- a/je_auto_control/utils/generate_report/generate_json_report.py
+++ b/je_auto_control/utils/generate_report/generate_json_report.py
@@ -1,5 +1,6 @@
import json
from threading import Lock
+from typing import Dict
from je_auto_control.utils.exception.exception_tags import cant_generate_json_report
from je_auto_control.utils.exception.exceptions import AutoControlGenerateJsonReportException
@@ -7,7 +8,7 @@
from je_auto_control.utils.test_record.record_test_class import test_record_instance
-def generate_json() -> tuple[dict[str, dict[str, str]], dict[str, dict[str, str]]]:
+def generate_json() -> tuple[Dict[str, Dict[str, str]], Dict[str, dict[str, str]]]:
auto_control_logger.info("generate_json")
"""
:return: two dict {success_dict}, {failure_dict}
diff --git a/pyproject.toml b/pyproject.toml
index 2e2bf19..0382edc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,12 +1,12 @@
-# Rename to build stable version
-# This is stable version
+# Rename to build dev version
+# This is dev version
[build-system]
-requires = ["setuptools>=61.0"]
+requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control"
-version = "0.0.145"
+name = "je_auto_control_dev"
+version = "0.0.84"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
diff --git a/dev.toml b/stable.toml
similarity index 89%
rename from dev.toml
rename to stable.toml
index 7c7eab9..d82da92 100644
--- a/dev.toml
+++ b/stable.toml
@@ -1,12 +1,12 @@
-# Rename to build dev version
-# This is dev version
+# Rename to build stable version
+# This is stable version
[build-system]
-requires = ["setuptools"]
+requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control_dev"
-version = "0.0.83"
+name = "je_auto_control"
+version = "0.0.146"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
From 625fcf4bf4e2adb09163db4ba5d4442785f68e22 Mon Sep 17 00:00:00 2001
From: JeffreyChen <33644111+JE-Chen@users.noreply.github.com>
Date: Mon, 19 Jun 2023 16:40:46 +0800
Subject: [PATCH 5/8] Update stable and dev version
Update stable and dev version
---
stable.toml => dev.toml | 10 +++++-----
.../utils/generate_report/generate_json_report.py | 2 +-
pyproject.toml | 10 +++++-----
3 files changed, 11 insertions(+), 11 deletions(-)
rename stable.toml => dev.toml (89%)
diff --git a/stable.toml b/dev.toml
similarity index 89%
rename from stable.toml
rename to dev.toml
index d82da92..d727214 100644
--- a/stable.toml
+++ b/dev.toml
@@ -1,12 +1,12 @@
-# Rename to build stable version
-# This is stable version
+# Rename to build dev version
+# This is dev version
[build-system]
-requires = ["setuptools>=61.0"]
+requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control"
-version = "0.0.146"
+name = "je_auto_control_dev"
+version = "0.0.85"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
diff --git a/je_auto_control/utils/generate_report/generate_json_report.py b/je_auto_control/utils/generate_report/generate_json_report.py
index 33baa6c..46c0d07 100644
--- a/je_auto_control/utils/generate_report/generate_json_report.py
+++ b/je_auto_control/utils/generate_report/generate_json_report.py
@@ -8,7 +8,7 @@
from je_auto_control.utils.test_record.record_test_class import test_record_instance
-def generate_json() -> tuple[Dict[str, Dict[str, str]], Dict[str, dict[str, str]]]:
+def generate_json() -> tuple[Dict[str, Dict[str, str]], Dict[str, Dict[str, str]]]:
auto_control_logger.info("generate_json")
"""
:return: two dict {success_dict}, {failure_dict}
diff --git a/pyproject.toml b/pyproject.toml
index 0382edc..ac61ffc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,12 +1,12 @@
-# Rename to build dev version
-# This is dev version
+# Rename to build stable version
+# This is stable version
[build-system]
-requires = ["setuptools"]
+requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control_dev"
-version = "0.0.84"
+name = "je_auto_control"
+version = "0.0.147"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
From e6b58ceb01ef5883b273e3a0f197bcd3f8a6f09a Mon Sep 17 00:00:00 2001
From: JeffreyChen <33644111+JE-Chen@users.noreply.github.com>
Date: Mon, 19 Jun 2023 16:47:35 +0800
Subject: [PATCH 6/8] update dev and stable
update dev and stable
---
je_auto_control/utils/generate_report/generate_json_report.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/je_auto_control/utils/generate_report/generate_json_report.py b/je_auto_control/utils/generate_report/generate_json_report.py
index 46c0d07..7a7a1bf 100644
--- a/je_auto_control/utils/generate_report/generate_json_report.py
+++ b/je_auto_control/utils/generate_report/generate_json_report.py
@@ -1,6 +1,6 @@
import json
from threading import Lock
-from typing import Dict
+from typing import Dict, Tuple
from je_auto_control.utils.exception.exception_tags import cant_generate_json_report
from je_auto_control.utils.exception.exceptions import AutoControlGenerateJsonReportException
@@ -8,7 +8,7 @@
from je_auto_control.utils.test_record.record_test_class import test_record_instance
-def generate_json() -> tuple[Dict[str, Dict[str, str]], Dict[str, Dict[str, str]]]:
+def generate_json() -> Tuple[Dict[str, Dict[str, str]], Dict[str, Dict[str, str]]]:
auto_control_logger.info("generate_json")
"""
:return: two dict {success_dict}, {failure_dict}
From 100eb8c5f5a8eb6aaa3533c770b15308bf92ca37 Mon Sep 17 00:00:00 2001
From: JeffreyChen <33644111+JE-Chen@users.noreply.github.com>
Date: Mon, 19 Jun 2023 17:02:14 +0800
Subject: [PATCH 7/8] Update stable and dev version
Update stable and dev version
---
dev.toml | 2 +-
pyproject.toml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dev.toml b/dev.toml
index d727214..d2c24b4 100644
--- a/dev.toml
+++ b/dev.toml
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "je_auto_control_dev"
-version = "0.0.85"
+version = "0.0.86"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
diff --git a/pyproject.toml b/pyproject.toml
index ac61ffc..0f9fcc4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "je_auto_control"
-version = "0.0.147"
+version = "0.0.148"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
From e6c3906f101a6f1a89b879ae18e9e01a80b22aac Mon Sep 17 00:00:00 2001
From: JeffreyChen <33644111+JE-Chen@users.noreply.github.com>
Date: Mon, 19 Jun 2023 17:20:09 +0800
Subject: [PATCH 8/8] Update stable and dev
Update stable and dev
---
.../utils/package_manager/package_manager_class.py | 4 ++--
pyproject.toml | 10 +++++-----
dev.toml => stable.toml | 10 +++++-----
3 files changed, 12 insertions(+), 12 deletions(-)
rename dev.toml => stable.toml (89%)
diff --git a/je_auto_control/utils/package_manager/package_manager_class.py b/je_auto_control/utils/package_manager/package_manager_class.py
index 040d19e..3ac19a5 100644
--- a/je_auto_control/utils/package_manager/package_manager_class.py
+++ b/je_auto_control/utils/package_manager/package_manager_class.py
@@ -2,7 +2,7 @@
from importlib.util import find_spec
from inspect import getmembers, isfunction, isbuiltin, isclass
from sys import stderr
-from typing import Union, Callable
+from typing import Union, Callable, Dict
from je_auto_control.utils.logging.loggin_instance import auto_control_logger
@@ -15,7 +15,7 @@ def __init__(self):
self.executor = None
self.callback_executor = None
- def check_package(self, package: str) -> Union[None, dict[str, Callable]]:
+ def check_package(self, package: str) -> Union[None, Dict[str, Callable]]:
"""
:param package: package to check exists or not
:return: package if find else None
diff --git a/pyproject.toml b/pyproject.toml
index 0f9fcc4..60436a4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,12 +1,12 @@
-# Rename to build stable version
-# This is stable version
+# Rename to build dev version
+# This is dev version
[build-system]
-requires = ["setuptools>=61.0"]
+requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control"
-version = "0.0.148"
+name = "je_auto_control_dev"
+version = "0.0.87"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
diff --git a/dev.toml b/stable.toml
similarity index 89%
rename from dev.toml
rename to stable.toml
index d2c24b4..f2b2982 100644
--- a/dev.toml
+++ b/stable.toml
@@ -1,12 +1,12 @@
-# Rename to build dev version
-# This is dev version
+# Rename to build stable version
+# This is stable version
[build-system]
-requires = ["setuptools"]
+requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control_dev"
-version = "0.0.86"
+name = "je_auto_control"
+version = "0.0.149"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]