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
30 changes: 15 additions & 15 deletions file_automation/__init__.py → automation_file/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
from file_automation.local.dir.dir_process import copy_dir, rename_dir, create_dir, remove_dir_tree
from file_automation.local.file.file_process import copy_file, remove_file, rename_file, copy_specify_extension_file, \
from automation_file.local.dir.dir_process import copy_dir, rename_dir, create_dir, remove_dir_tree
from automation_file.local.file.file_process import copy_file, remove_file, rename_file, copy_specify_extension_file, \
copy_all_file_to_dir
from file_automation.local.zip.zip_process import zip_dir, zip_file, zip_info, zip_file_info, set_zip_password, \
from automation_file.local.zip.zip_process import zip_dir, zip_file, zip_info, zip_file_info, set_zip_password, \
read_zip_file, unzip_file, unzip_all
from file_automation.remote.google_drive.delete.delete_manager import drive_delete_file
from file_automation.remote.google_drive.dir.folder_manager import drive_add_folder
from file_automation.remote.google_drive.download.download_file import drive_download_file, \
from automation_file.remote.google_drive.delete.delete_manager import drive_delete_file
from automation_file.remote.google_drive.dir.folder_manager import drive_add_folder
from automation_file.remote.google_drive.download.download_file import drive_download_file, \
drive_download_file_from_folder
from file_automation.remote.google_drive.driver_instance import driver_instance
from file_automation.remote.google_drive.search.search_drive import \
from automation_file.remote.google_drive.driver_instance import driver_instance
from automation_file.remote.google_drive.search.search_drive import \
drive_search_all_file, drive_search_field, drive_search_file_mimetype
from file_automation.remote.google_drive.share.share_file import \
from automation_file.remote.google_drive.share.share_file import \
drive_share_file_to_anyone, drive_share_file_to_domain, drive_share_file_to_user
from file_automation.remote.google_drive.upload.upload_to_driver import \
from automation_file.remote.google_drive.upload.upload_to_driver import \
drive_upload_dir_to_folder, drive_upload_to_folder, drive_upload_dir_to_drive, drive_upload_to_drive
from file_automation.utils.executor.action_executor import execute_action, execute_files, add_command_to_executor
from file_automation.utils.file_process.get_dir_file_list import get_dir_files_as_list
from file_automation.utils.json.json_file import read_action_json
from file_automation.utils.project.create_project_structure import create_project_dir
from automation_file.utils.executor.action_executor import execute_action, execute_files, add_command_to_executor
from automation_file.utils.file_process.get_dir_file_list import get_dir_files_as_list
from automation_file.utils.json.json_file import read_action_json
from automation_file.utils.project.create_project_structure import create_project_dir

__all__ = [
"copy_file", "rename_file", "remove_file", "copy_all_file_to_dir", "copy_specify_extension_file",
"copy_dir", "create_dir", "remove_dir_tree", "zip_dir", "zip_file", "zip_info",
"zip_file_info", "set_zip_password", "unzip_file", "read_zip_file",
"zip_file_info", "set_zip_password", "unzip_file", "read_zip_file", "rename_dir",
"unzip_all", "driver_instance", "drive_search_all_file", "drive_search_field", "drive_search_file_mimetype",
"drive_upload_dir_to_folder", "drive_upload_to_folder", "drive_upload_dir_to_drive", "drive_upload_to_drive",
"drive_add_folder", "drive_share_file_to_anyone", "drive_share_file_to_domain", "drive_share_file_to_user",
Expand Down
14 changes: 7 additions & 7 deletions file_automation/__main__.py → automation_file/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import json
import sys

from file_automation.utils.exception.exception_tags import \
from automation_file.utils.exception.exception_tags import \
argparse_get_wrong_data
from file_automation.utils.exception.exceptions import \
from automation_file.utils.exception.exceptions import \
ArgparseException
from file_automation.utils.executor.action_executor import execute_action
from file_automation.utils.executor.action_executor import execute_files
from file_automation.utils.file_process.get_dir_file_list import \
from automation_file.utils.executor.action_executor import execute_action
from automation_file.utils.executor.action_executor import execute_files
from automation_file.utils.file_process.get_dir_file_list import \
get_dir_files_as_list
from file_automation.utils.json.json_file import read_action_json
from file_automation.utils.project.create_project_structure import create_project_dir
from automation_file.utils.json.json_file import read_action_json
from automation_file.utils.project.create_project_structure import create_project_dir

if __name__ == "__main__":
try:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import sys
from pathlib import Path

from file_automation.utils.exception.exceptions import DirNotExistsException
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.utils.exception.exceptions import DirNotExistsException
from automation_file.utils.logging.loggin_instance import file_automation_logger


def copy_dir(dir_path: str, target_dir_path: str) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import sys
from pathlib import Path

from file_automation.utils.exception.exceptions import FileNotExistsException, DirNotExistsException
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.utils.exception.exceptions import FileNotExistsException, DirNotExistsException
from automation_file.utils.logging.loggin_instance import file_automation_logger


def copy_file(file_path: str, target_path: str) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from shutil import make_archive
from typing import List

from file_automation.utils.exception.exceptions import ZIPGetWrongFileException
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.utils.exception.exceptions import ZIPGetWrongFileException
from automation_file.utils.logging.loggin_instance import file_automation_logger


def zip_dir(dir_we_want_to_zip: str, zip_name: str) -> None:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from googleapiclient.errors import HttpError

from file_automation.remote.google_drive.driver_instance import driver_instance
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.remote.google_drive.driver_instance import driver_instance
from automation_file.utils.logging.loggin_instance import file_automation_logger


def drive_delete_file(file_id: str) -> Union[Dict[str, str], None]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from googleapiclient.errors import HttpError

from file_automation.remote.google_drive.driver_instance import driver_instance
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.remote.google_drive.driver_instance import driver_instance
from automation_file.utils.logging.loggin_instance import file_automation_logger


def drive_add_folder(folder_name: str) -> Union[dict, None]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from googleapiclient.errors import HttpError
from googleapiclient.http import MediaIoBaseDownload

from file_automation.remote.google_drive.driver_instance import driver_instance
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.remote.google_drive.driver_instance import driver_instance
from automation_file.utils.logging.loggin_instance import file_automation_logger


def drive_download_file(file_id: str, file_name: str) -> BytesIO:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError

from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.utils.logging.loggin_instance import file_automation_logger


class GoogleDrive(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from googleapiclient.errors import HttpError

from file_automation.remote.google_drive.driver_instance import driver_instance
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.remote.google_drive.driver_instance import driver_instance
from automation_file.utils.logging.loggin_instance import file_automation_logger


def drive_search_all_file() -> Union[dict, None]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from googleapiclient.errors import HttpError

from file_automation.remote.google_drive.driver_instance import driver_instance
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.remote.google_drive.driver_instance import driver_instance
from automation_file.utils.logging.loggin_instance import file_automation_logger


def drive_share_file_to_user(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from googleapiclient.errors import HttpError
from googleapiclient.http import MediaFileUpload

from file_automation.remote.google_drive.driver_instance import driver_instance
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.remote.google_drive.driver_instance import driver_instance
from automation_file.utils.logging.loggin_instance import file_automation_logger


def drive_upload_to_drive(file_path: str, file_name: str = None) -> Union[dict, None]:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import typing

from file_automation.local.dir.dir_process import copy_dir, create_dir, remove_dir_tree
from file_automation.local.file.file_process import copy_file, remove_file, rename_file, copy_specify_extension_file, \
from automation_file.local.dir.dir_process import copy_dir, create_dir, remove_dir_tree
from automation_file.local.file.file_process import copy_file, remove_file, rename_file, copy_specify_extension_file, \
copy_all_file_to_dir
from file_automation.local.zip.zip_process import zip_dir, zip_file, zip_info, zip_file_info, set_zip_password, \
from automation_file.local.zip.zip_process import zip_dir, zip_file, zip_info, zip_file_info, set_zip_password, \
read_zip_file, unzip_file, unzip_all
from file_automation.remote.google_drive.delete.delete_manager import drive_delete_file
from file_automation.remote.google_drive.dir.folder_manager import drive_add_folder
from file_automation.remote.google_drive.download.download_file import drive_download_file, drive_download_file_from_folder
from file_automation.remote.google_drive.driver_instance import driver_instance
from file_automation.remote.google_drive.search.search_drive import \
from automation_file.remote.google_drive.delete.delete_manager import drive_delete_file
from automation_file.remote.google_drive.dir.folder_manager import drive_add_folder
from automation_file.remote.google_drive.download.download_file import drive_download_file, drive_download_file_from_folder
from automation_file.remote.google_drive.driver_instance import driver_instance
from automation_file.remote.google_drive.search.search_drive import \
drive_search_all_file, drive_search_field, drive_search_file_mimetype
from file_automation.remote.google_drive.share.share_file import \
from automation_file.remote.google_drive.share.share_file import \
drive_share_file_to_anyone, drive_share_file_to_domain, drive_share_file_to_user
from file_automation.remote.google_drive.upload.upload_to_driver import \
from automation_file.remote.google_drive.upload.upload_to_driver import \
drive_upload_dir_to_folder, drive_upload_to_folder, drive_upload_dir_to_drive, drive_upload_to_drive
from file_automation.utils.exception.exception_tags import get_bad_trigger_function, get_bad_trigger_method
from file_automation.utils.exception.exceptions import CallbackExecutorException
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.utils.exception.exception_tags import get_bad_trigger_function, get_bad_trigger_method
from automation_file.utils.exception.exceptions import CallbackExecutorException
from automation_file.utils.logging.loggin_instance import file_automation_logger


class CallbackFunctionExecutor(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
from inspect import getmembers, isbuiltin
from typing import Union, Any

from file_automation.local.dir.dir_process import copy_dir, create_dir, remove_dir_tree
from file_automation.local.file.file_process import copy_file, remove_file, rename_file, copy_specify_extension_file, \
from automation_file.local.dir.dir_process import copy_dir, create_dir, remove_dir_tree
from automation_file.local.file.file_process import copy_file, remove_file, rename_file, copy_specify_extension_file, \
copy_all_file_to_dir, create_file
from file_automation.local.zip.zip_process import zip_dir, zip_file, zip_info, zip_file_info, set_zip_password, \
from automation_file.local.zip.zip_process import zip_dir, zip_file, zip_info, zip_file_info, set_zip_password, \
read_zip_file, unzip_file, unzip_all
from file_automation.remote.google_drive.delete.delete_manager import drive_delete_file
from file_automation.remote.google_drive.dir.folder_manager import drive_add_folder
from file_automation.remote.google_drive.download.download_file import drive_download_file, \
from automation_file.remote.google_drive.delete.delete_manager import drive_delete_file
from automation_file.remote.google_drive.dir.folder_manager import drive_add_folder
from automation_file.remote.google_drive.download.download_file import drive_download_file, \
drive_download_file_from_folder
from file_automation.remote.google_drive.driver_instance import driver_instance
from file_automation.remote.google_drive.search.search_drive import \
from automation_file.remote.google_drive.driver_instance import driver_instance
from automation_file.remote.google_drive.search.search_drive import \
drive_search_all_file, drive_search_field, drive_search_file_mimetype
from file_automation.remote.google_drive.share.share_file import \
from automation_file.remote.google_drive.share.share_file import \
drive_share_file_to_anyone, drive_share_file_to_domain, drive_share_file_to_user
from file_automation.remote.google_drive.upload.upload_to_driver import \
from automation_file.remote.google_drive.upload.upload_to_driver import \
drive_upload_dir_to_folder, drive_upload_to_folder, drive_upload_dir_to_drive, drive_upload_to_drive
from file_automation.utils.exception.exception_tags import add_command_exception, executor_list_error, \
from automation_file.utils.exception.exception_tags import add_command_exception, executor_list_error, \
action_is_null_error, cant_execute_action_error
from file_automation.utils.exception.exceptions import ExecuteActionException, AddCommandException
from file_automation.utils.json.json_file import read_action_json
from file_automation.utils.logging.loggin_instance import file_automation_logger
from file_automation.utils.package_manager.package_manager_class import package_manager
from file_automation.utils.scheduler.extend_apscheduler import scheduler_manager
from automation_file.utils.exception.exceptions import ExecuteActionException, AddCommandException
from automation_file.utils.json.json_file import read_action_json
from automation_file.utils.logging.loggin_instance import file_automation_logger
from automation_file.utils.package_manager.package_manager_class import package_manager
from automation_file.utils.scheduler.extend_apscheduler import scheduler_manager


class Executor(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from pathlib import Path
from threading import Lock

from file_automation.utils.exception.exception_tags import cant_find_json_error, cant_save_json_error
from file_automation.utils.exception.exceptions import JsonActionException
from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.utils.exception.exception_tags import cant_find_json_error, cant_save_json_error
from automation_file.utils.exception.exceptions import JsonActionException
from automation_file.utils.logging.loggin_instance import file_automation_logger

_lock = Lock()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from inspect import getmembers, isfunction, isbuiltin, isclass
from sys import stderr

from file_automation.utils.logging.loggin_instance import file_automation_logger
from automation_file.utils.logging.loggin_instance import file_automation_logger


class PackageManager(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from pathlib import Path
from threading import Lock

from file_automation.utils.json.json_file import write_action_json
from file_automation.utils.logging.loggin_instance import file_automation_logger
from file_automation.utils.project.template.template_executor import executor_template_1, \
from automation_file.utils.json.json_file import write_action_json
from automation_file.utils.logging.loggin_instance import file_automation_logger
from automation_file.utils.project.template.template_executor import executor_template_1, \
executor_template_2, bad_executor_template_1
from file_automation.utils.project.template.template_keyword import template_keyword_1, \
from automation_file.utils.project.template.template_keyword import template_keyword_1, \
template_keyword_2, bad_template_1


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
import threading

from file_automation.utils.executor.action_executor import execute_action
from automation_file.utils.executor.action_executor import execute_action


class TCPServerHandler(socketserver.BaseRequestHandler):
Expand Down
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 = "automation_file_dev"
version = "0.0.18"
version = "0.0.19"
authors = [
{ name = "JE-Chen", email = "zenmailman@gmail.com" },
]
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 = "automation_file"
version = "0.0.16"
version = "0.0.17"
authors = [
{ name = "JE-Chen", email = "zenmailman@gmail.com" },
]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_test/executor/executor_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from file_automation import execute_action
from automation_file import execute_action

test_list = [
["FA_drive_later_init", {"token_path": "token.json", "credentials_path": "credentials.json"}],
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_test/local/dir/dir_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

from file_automation import copy_dir, remove_dir_tree, rename_dir, create_dir
from automation_file import copy_dir, remove_dir_tree, rename_dir, create_dir

copy_dir_path = Path(str(Path.cwd()) + "/test_dir")
rename_dir_path = Path(str(Path.cwd()) + "/rename_dir")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_test/local/file/test_file.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path

from file_automation import copy_file, copy_specify_extension_file, copy_all_file_to_dir, rename_file, remove_file
from file_automation import create_dir
from automation_file import copy_file, copy_specify_extension_file, copy_all_file_to_dir, rename_file, remove_file
from automation_file import create_dir

create_dir(str(Path.cwd()) + "/first_file_dir")
create_dir(str(Path.cwd()) + "/second_file_dir")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_test/local/zip/zip_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path

from file_automation import create_dir
from file_automation import zip_dir, zip_file, read_zip_file, unzip_file, unzip_all, zip_info, zip_file_info, \
from automation_file import create_dir
from automation_file import zip_dir, zip_file, read_zip_file, unzip_file, unzip_all, zip_info, zip_file_info, \
set_zip_password

zip_file_path = Path(Path.cwd(), "test.zip")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_test/remote/google_drive/quick_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path

from file_automation import driver_instance
from file_automation.remote.google_drive.search.search_drive import drive_search_all_file
from automation_file import driver_instance
from automation_file.remote.google_drive.search.search_drive import drive_search_all_file

driver_instance.later_init(str(Path(Path.cwd(), "token.json")), str(Path(Path.cwd(), "credentials.json")))
print(drive_search_all_file())