diff --git a/.idea/misc.xml b/.idea/misc.xml index 84a34af..35233d5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,7 @@ + + \ No newline at end of file diff --git a/automation_file/remote/google_drive/download/download_file.py b/automation_file/remote/google_drive/download/download_file.py index 53e50d3..24d5289 100644 --- a/automation_file/remote/google_drive/download/download_file.py +++ b/automation_file/remote/google_drive/download/download_file.py @@ -9,7 +9,7 @@ from automation_file.utils.logging.loggin_instance import file_automation_logger -def drive_download_file(file_id: str, file_name: str) -> BytesIO: +def drive_download_file(file_id: str, file_name: str) -> Union[BytesIO, None]: """ :param file_id: file have this id will download :param file_name: file save on local name diff --git a/automation_file/remote/google_drive/driver_instance.py b/automation_file/remote/google_drive/driver_instance.py index a6055cb..591eb92 100644 --- a/automation_file/remote/google_drive/driver_instance.py +++ b/automation_file/remote/google_drive/driver_instance.py @@ -30,9 +30,7 @@ def later_init(self, token_path: str, credentials_path: str): # created automatically when the authorization flow completes for the first # time. if token_path.exists(): - file_automation_logger.info( - f"Token exists try to load." - ) + file_automation_logger.info("Token exists try to load.") creds = Credentials.from_authorized_user_file(str(token_path), self.scopes) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: @@ -47,9 +45,7 @@ def later_init(self, token_path: str, credentials_path: str): token.write(creds.to_json()) try: self.service = build('drive', 'v3', credentials=creds) - file_automation_logger.info( - f"Loading service successfully." - ) + file_automation_logger.info("Loading service successfully.") except HttpError as error: file_automation_logger.error( f"Delete file failed," @@ -58,4 +54,3 @@ def later_init(self, token_path: str, credentials_path: str): driver_instance = GoogleDrive() - diff --git a/automation_file/utils/executor/action_executor.py b/automation_file/utils/executor/action_executor.py index 76c7ee6..f8f7e66 100644 --- a/automation_file/utils/executor/action_executor.py +++ b/automation_file/utils/executor/action_executor.py @@ -105,14 +105,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: file_automation_logger.error( diff --git a/automation_file/utils/scheduler/extend_apscheduler.py b/automation_file/utils/scheduler/extend_apscheduler.py index 7ed0c98..36abd01 100644 --- a/automation_file/utils/scheduler/extend_apscheduler.py +++ b/automation_file/utils/scheduler/extend_apscheduler.py @@ -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( @@ -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: diff --git a/stable.toml b/dev.toml similarity index 95% rename from stable.toml rename to dev.toml index 10b9aae..874e4c3 100644 --- a/stable.toml +++ b/dev.toml @@ -5,8 +5,8 @@ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] -name = "automation_file" -version = "0.0.20" +name = "automation_file_dev" +version = "0.0.23" authors = [ { name = "JE-Chen", email = "zenmailman@gmail.com" }, ] diff --git a/pyproject.toml b/pyproject.toml index 752f74a..6fe95f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,8 +5,8 @@ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] -name = "automation_file_dev" -version = "0.0.22" +name = "automation_file" +version = "0.0.21" authors = [ { name = "JE-Chen", email = "zenmailman@gmail.com" }, ]