Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #29

Merged
merged 3 commits into from
Jul 20, 2024
Merged

Dev #29

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "je_mail_thunder_dev"
version = "0.0.33"
version = "0.0.36"
authors = [
{ name = "JE-Chen", email = "[email protected]" },
]
Expand Down
3 changes: 2 additions & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ je_mail_thunder_dev
wheel
twine
sphinx
sphinx-rtd-theme
sphinx-rtd-theme
build
6 changes: 5 additions & 1 deletion je_mail_thunder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ def preprocess_execute_files(file_path: str):


def preprocess_read_str_execute_action(execute_str: str):
execute_str = json.loads(execute_str)
if sys.platform in ["win32", "cygwin", "msys"]:
json_data = json.loads(execute_str)
execute_str = json.loads(json_data)
else:
execute_str = json.loads(execute_str)
execute_action(execute_str)


Expand Down
8 changes: 4 additions & 4 deletions je_mail_thunder/imap/imap_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def imap_later_init(self):
Try to log in
:return: None
"""
mail_thunder_logger.info(f"MT_imap_later_init")
mail_thunder_logger.info("MT_imap_later_init")
try:
self.imap_try_to_login_with_env_or_content()
except Exception as error:
Expand All @@ -38,15 +38,15 @@ def imap_try_to_login_with_env_or_content(self):
Try to find user and password on cwd /mail_thunder_content.json or env var
:return: None
"""
mail_thunder_logger.info(f"imap_try_to_login_with_env_or_content")
mail_thunder_logger.info("imap_try_to_login_with_env_or_content")
try:
user_info = read_output_content()
if user_info is not None and type(user_info) == dict:
if user_info is not None and isinstance(user_info, dict):
if user_info.get("user", None) is not None and user_info.get("password", None) is not None:
self.login(user_info.get("user"), user_info.get("password"))
else:
user_info = get_mail_thunder_os_environ()
if user_info is not None and type(user_info) == dict:
if user_info is not None and isinstance(user_info, dict):
if user_info.get("mail_thunder_user", None) is not None and user_info.get(
"mail_thunder_user_password", None) is not None:
self.login(user_info.get("mail_thunder_user"), user_info.get("mail_thunder_user_password"))
Expand Down
6 changes: 3 additions & 3 deletions je_mail_thunder/smtp/smtp_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ def smtp_try_to_login_with_env_or_content(self):
user_info = read_output_content()
self.login_state = False
try:
if user_info is not None and type(user_info) == dict:
if user_info is not None and isinstance(user_info, dict):
if user_info.get("user", None) is not None and user_info.get("password", None) is not None:
self.login(user_info.get("user"), user_info.get("password"))
self.login_state = True
else:
user_info = get_mail_thunder_os_environ()
if user_info is not None and type(user_info) == dict:
if user_info is not None and isinstance(user_info, dict):
if user_info.get("mail_thunder_user", None) is not None and user_info.get(
"mail_thunder_user_password", None) is not None:
self.login(user_info.get("mail_thunder_user"), user_info.get("mail_thunder_user_password"))
Expand All @@ -147,7 +147,7 @@ def quit(self):
Quit service and close connect
:return: None
"""
mail_thunder_logger.info(f"SMTP quit")
mail_thunder_logger.info("SMTP quit")
self.login_state = False

def smtp_create_message_with_attach_and_send(self, message_content: str, message_setting_dict: dict,
Expand Down
6 changes: 2 additions & 4 deletions je_mail_thunder/utils/executor/action_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ def execute_action(self, action_list: [list, dict]) -> dict:
for loop the list and execute action
"""
if isinstance(action_list, dict):
action_list: list = action_list.get("auto_control", None)
action_list: list = action_list.get("auto_control")
if action_list is None:
raise ExecuteActionException(executor_list_error)
execute_record_dict = dict()
try:
if len(action_list) > 0 or isinstance(action_list, list):
pass
else:
if len(action_list) < 0 or isinstance(action_list, list) is False:
raise ExecuteActionException(action_is_null_error)
except Exception as error:
mail_thunder_logger.error(
Expand Down
4 changes: 2 additions & 2 deletions je_mail_thunder/utils/scheduler/extend_apscheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def add_blocking_job(
"""
params = locals()
params.pop("self")
trigger_args = params.pop("trigger_args")
params.pop("trigger_args")
return self._blocking_schedulers.add_job(**params, **trigger_args)

def add_nonblocking_job(
Expand Down Expand Up @@ -92,7 +92,7 @@ def add_nonblocking_job(
"""
params = locals()
params.pop("self")
trigger_args = params.pop("trigger_args")
params.pop("trigger_args")
return self._background_schedulers.add_job(**params, **trigger_args)

def get_blocking_scheduler(self) -> BlockingScheduler:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "je_mail_thunder"
version = "0.0.19"
version = "0.0.21"
authors = [
{ name = "JE-Chen", email = "[email protected]" },
]
Expand Down
Loading