From 67518cfa63197a4fe4a5e8c80a5657fe0584c6c5 Mon Sep 17 00:00:00 2001 From: bhazuka Date: Tue, 26 Sep 2023 09:23:21 -0500 Subject: [PATCH] Fixed minor linting issues discovered after fixing scripts. --- tasks/db_deploy/install/orca_sql.py | 12 ++++++------ .../migrate_versions_1_to_2/migrate_sql.py | 12 ++++++------ .../get_current_archive_list.py | 6 +++--- .../perform_orca_reconcile/perform_orca_reconcile.py | 12 ++++++------ .../post_copy_request_to_queue.py | 4 ++-- .../unit_tests/test_post_copy_request_to_queue.py | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tasks/db_deploy/install/orca_sql.py b/tasks/db_deploy/install/orca_sql.py index c963036d6..22aefc3b0 100644 --- a/tasks/db_deploy/install/orca_sql.py +++ b/tasks/db_deploy/install/orca_sql.py @@ -58,7 +58,7 @@ def dbo_role_sql(db_name: str, admin_username: str) -> text: Returns: SQL for creating orca_dbo role. """ - return text( + return text( # nosec f""" DO $$ @@ -81,7 +81,7 @@ def dbo_role_sql(db_name: str, admin_username: str) -> text: GRANT orca_dbo TO "{admin_username}"; END $$ - """ # nosec + """ ) @@ -93,7 +93,7 @@ def app_role_sql(db_name: str) -> text: Returns: SQL for creating orca_app role. """ - return text( + return text( # nosec f""" DO $$ @@ -114,7 +114,7 @@ def app_role_sql(db_name: str) -> text: GRANT CONNECT ON DATABASE "{db_name}" TO orca_app; END $$; - """ # nosec + """ ) @@ -177,7 +177,7 @@ def app_user_sql(user_name: str) -> text: Returns: SQL for creating PREFIX_orcauser user. """ - return text( + return text( # nosec f""" DO $$ @@ -202,7 +202,7 @@ def app_user_sql(user_name: str) -> text: ALTER ROLE "{user_name}" SET search_path = orca, public; END $$; - """ # nosec + """ ) diff --git a/tasks/db_deploy/migrations/migrate_versions_1_to_2/migrate_sql.py b/tasks/db_deploy/migrations/migrate_versions_1_to_2/migrate_sql.py index 9218a8c26..e588c3020 100644 --- a/tasks/db_deploy/migrations/migrate_versions_1_to_2/migrate_sql.py +++ b/tasks/db_deploy/migrations/migrate_versions_1_to_2/migrate_sql.py @@ -17,7 +17,7 @@ def dbo_role_sql(db_name: str, admin_username: str) -> text: Returns: SQL for creating orca_dbo role. """ - return text( + return text( # nosec f""" DO $$ @@ -40,7 +40,7 @@ def dbo_role_sql(db_name: str, admin_username: str) -> text: GRANT orca_dbo TO "{admin_username}"; END $$ - """ # nosec + """ ) @@ -52,7 +52,7 @@ def app_role_sql(db_name: str) -> text: Returns: SQL for creating orca_app role. """ - return text( + return text( # nosec f""" DO $$ @@ -73,7 +73,7 @@ def app_role_sql(db_name: str) -> text: GRANT CONNECT ON DATABASE "{db_name}" TO orca_app; END $$; - """ # nosec + """ ) @@ -136,7 +136,7 @@ def app_user_sql(user_name: str) -> text: Returns: SQL for creating PREFIX_orcauser user. """ - return text( + return text( # nosec f""" DO $$ @@ -161,7 +161,7 @@ def app_user_sql(user_name: str) -> text: ALTER ROLE "{user_name}" SET search_path = orca, public; END $$; - """ # nosec + """ ) diff --git a/tasks/get_current_archive_list/get_current_archive_list.py b/tasks/get_current_archive_list/get_current_archive_list.py index 4a13dbed0..2fd390577 100644 --- a/tasks/get_current_archive_list/get_current_archive_list.py +++ b/tasks/get_current_archive_list/get_current_archive_list.py @@ -436,8 +436,8 @@ def translate_s3_import_to_partitioned_data_sql() -> text: # pragma: no cover """ SQL for translating between the temporary table and Orca table. """ - return text( - f""" + return text( # nosec # noqa + """ INSERT INTO orca.reconcile_s3_object ( job_id, orca_archive_location, @@ -460,7 +460,7 @@ def translate_s3_import_to_partitioned_data_sql() -> text: # pragma: no cover storage_class, delete_marker FROM s3_import WHERE is_latest = TRUE - """ # nosec # noqa + """ ) diff --git a/tasks/perform_orca_reconcile/perform_orca_reconcile.py b/tasks/perform_orca_reconcile/perform_orca_reconcile.py index f50c9c073..a6f15ea18 100644 --- a/tasks/perform_orca_reconcile/perform_orca_reconcile.py +++ b/tasks/perform_orca_reconcile/perform_orca_reconcile.py @@ -209,8 +209,8 @@ def generate_orphan_reports_sql() -> text: # pragma: no cover """ SQL for generating reports on files in S3, but not the Orca catalog. """ - return text( - f""" + return text( # nosec # noqa + """ WITH orphan_reports AS ( @@ -247,7 +247,7 @@ def generate_orphan_reports_sql() -> text: # pragma: no cover size_in_bytes, storage_class FROM - orphan_reports""" # nosec # noqa + orphan_reports""" ) @@ -255,8 +255,8 @@ def generate_mismatch_reports_sql() -> text: # pragma: no cover """ SQL for retrieving mismatches between entries in S3 and the Orca catalog. """ - return text( - f""" + return text( # nosec # noqa + """ INSERT INTO orca.reconcile_catalog_mismatch_report ( job_id, @@ -333,7 +333,7 @@ def generate_mismatch_reports_sql() -> text: # pragma: no cover files.etag != reconcile_s3_object.etag OR files.size_in_bytes != reconcile_s3_object.size_in_bytes OR storage_class.value != reconcile_s3_object.storage_class - )""" # nosec # noqa + )""" ) diff --git a/tasks/post_copy_request_to_queue/post_copy_request_to_queue.py b/tasks/post_copy_request_to_queue/post_copy_request_to_queue.py index ae06aacd0..e3b1371de 100644 --- a/tasks/post_copy_request_to_queue/post_copy_request_to_queue.py +++ b/tasks/post_copy_request_to_queue/post_copy_request_to_queue.py @@ -261,7 +261,7 @@ def get_metadata_sql(key_path: str) -> text: Returns: (sqlalchemy.text): SQL statement """ - return text( + return text( # nosec f""" SELECT job_id, granule_id, filename, restore_destination, multipart_chunksize_mb @@ -271,7 +271,7 @@ def get_metadata_sql(key_path: str) -> text: key_path = '{key_path}' AND status_id = {shared_recovery.OrcaStatus.PENDING.value} - """ # nosec + """ ) diff --git a/tasks/post_copy_request_to_queue/test/unit_tests/test_post_copy_request_to_queue.py b/tasks/post_copy_request_to_queue/test/unit_tests/test_post_copy_request_to_queue.py index 4f84af724..8747edb89 100644 --- a/tasks/post_copy_request_to_queue/test/unit_tests/test_post_copy_request_to_queue.py +++ b/tasks/post_copy_request_to_queue/test/unit_tests/test_post_copy_request_to_queue.py @@ -769,7 +769,7 @@ def test_query_db_exceptions_bubble_up( def test_get_metadata_sql_happy_path(self): key_path = uuid.uuid4().__str__() result = post_copy_request_to_queue.get_metadata_sql(key_path) - self.assertEqual( + self.assertEqual( # nosec f""" SELECT job_id, granule_id, filename, restore_destination, multipart_chunksize_mb @@ -779,6 +779,6 @@ def test_get_metadata_sql_happy_path(self): key_path = '{key_path}' AND status_id = {shared_recovery.OrcaStatus.PENDING.value} - """, # nosec + """, result.text, )