Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# -- Project information -----------------------------------------------------

project = "MailThunder"
copyright = "2020 ~ Now, JE-Chen"
project_copyright = "2020 ~ Now, JE-Chen"
author = "JE-Chen"

# -- General configuration ---------------------------------------------------
Expand Down
12 changes: 11 additions & 1 deletion je_mail_thunder/utils/package_manager/package_manager_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
from je_mail_thunder.utils.logging.loggin_instance import mail_thunder_logger


def _is_safe_module_name(package: str) -> bool:
if not isinstance(package, str) or not package:
return False
return all(part.isidentifier() for part in package.split("."))


class PackageManager:

def __init__(self):
Expand All @@ -17,9 +23,13 @@ def check_package(self, package: str):
:param package: package to check exists or not
:return: package if find else None
"""
if not _is_safe_module_name(package):
mail_thunder_logger.error(
f"check_package: rejected non-conforming module name: {package!r}")
return None
if self.installed_package_dict.get(package, None) is None:
found_spec = find_spec(package)
if found_spec is not None:
if found_spec is not None and _is_safe_module_name(found_spec.name):
try:
installed_package = import_module(found_spec.name)
self.installed_package_dict.update(
Expand Down
3 changes: 0 additions & 3 deletions test/unit_test/test_executor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import os
import types

import pytest

from je_mail_thunder.utils.exception.exceptions import AddCommandException, ExecuteActionException
Expand Down
1 change: 0 additions & 1 deletion test/unit_test/test_get_dir_file_list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import shutil
import tempfile

from je_mail_thunder.utils.file_process.get_dir_file_list import get_dir_files_as_list
Expand Down
3 changes: 0 additions & 3 deletions test/unit_test/test_json_file.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import json
import os

import pytest

from je_mail_thunder.utils.exception.exceptions import JsonActionException
from je_mail_thunder.utils.json.json_file import read_action_json, write_action_json

TEST_JSON_PATH = "test_action.json"
Expand Down
Loading