Skip to content

Update dev and stable version #37

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

Merged
merged 1 commit into from
Jul 22, 2024
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
3 changes: 3 additions & 0 deletions .idea/misc.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions automation_file/remote/google_drive/driver_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,"
Expand All @@ -58,4 +54,3 @@ def later_init(self, token_path: str, credentials_path: str):


driver_instance = GoogleDrive()

6 changes: 2 additions & 4 deletions automation_file/utils/executor/action_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions automation_file/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
4 changes: 2 additions & 2 deletions stable.toml → dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down
Loading