From 3d1e0b12d10c3c69b06b9fc69847b922cf04260a Mon Sep 17 00:00:00 2001 From: Troy Raen Date: Mon, 22 Jul 2024 07:42:26 -0700 Subject: [PATCH] fix codacy stuff --- pittgoogle/bigquery.py | 5 +++-- pittgoogle/pubsub.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pittgoogle/bigquery.py b/pittgoogle/bigquery.py index a089419..d7959f0 100644 --- a/pittgoogle/bigquery.py +++ b/pittgoogle/bigquery.py @@ -166,7 +166,7 @@ def _check_bqstorage_client(user_value: bool | None) -> bool: return user_value try: - import google.cloud.bigquery_storage + import google.cloud.bigquery_storage # noqa: W0611 except ModuleNotFoundError: return False return True @@ -308,7 +308,8 @@ def schema(self) -> "pd.DataFrame": child_fields = fld.pop("fields", []) # Append parent field name so that the child field name has the syntax 'parent_name.child_name'. # This is the syntax that should be used in SQL queries and also the one shown on BigQuery Console page. - [cfld.update(name=f"{fld['name']}.{cfld['name']}") for cfld in child_fields] + # The dicts update in place. + _ = [cfld.update(name=f"{fld['name']}.{cfld['name']}") for cfld in child_fields] fields.extend([fld] + child_fields) self._schema = pd.DataFrame(fields) diff --git a/pittgoogle/pubsub.py b/pittgoogle/pubsub.py index 2a89020..abb0560 100644 --- a/pittgoogle/pubsub.py +++ b/pittgoogle/pubsub.py @@ -235,10 +235,10 @@ def touch(self) -> None: # Assume this is a simple IAM problem rather than the user being confused about when # to call this method (as can happen below). msg = ( - f"PermissionDenied: You seem to have appropriate IAM permissions to get topics " + "PermissionDenied: You seem to have appropriate IAM permissions to get topics " "in this project but not to create them." ) - raise exceptions.CloudConnectionError(msg) from excep + raise exceptions.CloudConnectionError(msg) from excep except google.api_core.exceptions.PermissionDenied as excep: # User does not have permission to get this topic.