From e20f6acc947b8a05bce01200af1a2862a8596323 Mon Sep 17 00:00:00 2001 From: "colin.chamabchan@gmail.com" Date: Fri, 28 Mar 2025 16:42:57 -0400 Subject: [PATCH 1/5] refactor: update to Google style docstrings --- google/cloud/sql/connector/asyncpg.py | 26 +++++----- google/cloud/sql/connector/client.py | 54 +++++++++------------ google/cloud/sql/connector/pg8000.py | 24 ++++----- google/cloud/sql/connector/pymysql.py | 22 +++++---- google/cloud/sql/connector/pytds.py | 23 ++++----- google/cloud/sql/connector/rate_limiter.py | 26 ++++------ google/cloud/sql/connector/refresh_utils.py | 23 +++++---- google/cloud/sql/connector/utils.py | 18 +++---- 8 files changed, 99 insertions(+), 117 deletions(-) diff --git a/google/cloud/sql/connector/asyncpg.py b/google/cloud/sql/connector/asyncpg.py index 47d34895..a3a436cb 100644 --- a/google/cloud/sql/connector/asyncpg.py +++ b/google/cloud/sql/connector/asyncpg.py @@ -28,21 +28,19 @@ async def connect( ) -> "asyncpg.Connection": """Helper function to create an asyncpg DB-API connection object. - :type ip_address: str - :param ip_address: A string containing an IP address for the Cloud SQL - instance. - - :type ctx: ssl.SSLContext - :param ctx: An SSLContext object created from the Cloud SQL server CA - cert and ephemeral cert. - - :type kwargs: Any - :param kwargs: Keyword arguments for establishing asyncpg connection - object to Cloud SQL instance. - - :rtype: asyncpg.Connection - :returns: An asyncpg.Connection object to a Cloud SQL instance. + Args: + ip_address (str): A string containing an IP address for the Cloud SQL + instance. + ctx (ssl.SSLContext): An SSLContext object created from the Cloud SQL + kwargs: Additional arguments to pass to the asyncpg connect method. + + Returns: + asyncpg.Connection: A asyncpg Connection object for the Cloud SQL + instance. + Raises: + ImportError: The asyncpg module cannot be imported. """ + try: import asyncpg except ImportError: diff --git a/google/cloud/sql/connector/client.py b/google/cloud/sql/connector/client.py index 556a01bd..c7450788 100644 --- a/google/cloud/sql/connector/client.py +++ b/google/cloud/sql/connector/client.py @@ -59,8 +59,7 @@ def __init__( driver: Optional[str] = None, user_agent: Optional[str] = None, ) -> None: - """ - Establish the client to be used for Cloud SQL Admin API requests. + """Establishes the client to be used for Cloud SQL Admin API requests. Args: sqladmin_api_endpoint (str): Base URL to use when calling @@ -100,24 +99,22 @@ async def _get_metadata( region: str, instance: str, ) -> dict[str, Any]: - """Requests metadata from the Cloud SQL Instance - and returns a dictionary containing the IP addresses and certificate - authority of the Cloud SQL Instance. - - :type project: str - :param project: - A string representing the name of the project. + """Requests metadata from the Cloud SQL Instance and returns a dictionary + containing the IP addresses and certificate authority of the Cloud SQL + Instance. - :type region: str - :param region : A string representing the name of the region. + Args: + project (str): A string representing the name of the project. + region (str): A string representing the name of the region. + instance (str): A string representing the name of the instance. - :type instance: str - :param instance: A string representing the name of the instance. + Returns: + A dictionary containing a dictionary of all IP addresses + and their type and a string representing the certificate authority. - :rtype: dict[str: Union[dict, str]] - :returns: Returns a dictionary containing a dictionary of all IP - addresses and their type and a string representing the - certificate authority. + Raises: + ValueError: Provided region does not match the region of the + Cloud SQL instance. """ headers = { @@ -189,22 +186,15 @@ async def _get_ephemeral( ) -> tuple[str, datetime.datetime]: """Asynchronously requests an ephemeral certificate from the Cloud SQL Instance. - :type project: str - :param project : A string representing the name of the project. - - :type instance: str - :param instance: A string representing the name of the instance. - - :type pub_key: - :param str: A string representing PEM-encoded RSA public key. - - :type enable_iam_auth: bool - :param enable_iam_auth - Enables automatic IAM database authentication for Postgres or MySQL - instances. + Args: + project (str): A string representing the name of the project. + instance (str): string representing the name of the instance. + pub_key (str): A string representing PEM-encoded RSA public key. + enable_iam_auth (bool): Enables automatic IAM database + authentication for Postgres or MySQL instances. - :rtype: str - :returns: An ephemeral certificate from the Cloud SQL instance that allows + Returns: + An ephemeral certificate from the Cloud SQL instance that allows authorized connections to the instance. """ headers = { diff --git a/google/cloud/sql/connector/pg8000.py b/google/cloud/sql/connector/pg8000.py index baaee661..750d128a 100644 --- a/google/cloud/sql/connector/pg8000.py +++ b/google/cloud/sql/connector/pg8000.py @@ -26,17 +26,19 @@ def connect( ) -> "pg8000.dbapi.Connection": """Helper function to create a pg8000 DB-API connection object. - :type ip_address: str - :param ip_address: A string containing an IP address for the Cloud SQL - instance. - - :type sock: ssl.SSLSocket - :param sock: An SSLSocket object created from the Cloud SQL server CA - cert and ephemeral cert. - - - :rtype: pg8000.dbapi.Connection - :returns: A pg8000 Connection object for the Cloud SQL instance. + Args: + ip_address (str): A string containing an IP address for the Cloud SQL + instance. + sock (ssl.SSLSocket): An SSLSocket object created from the Cloud SQL + server CA cert and ephemeral cert. + kwargs: Additional arguments to pass to the pg8000 connect method. + + Returns: + pg8000.dbapi.Connection: A pg8000 Connection object for the Cloud SQL + instance. + + Raises: + ImportError: The pg8000 module cannot be imported. """ try: import pg8000 diff --git a/google/cloud/sql/connector/pymysql.py b/google/cloud/sql/connector/pymysql.py index f83f7076..f798b5cb 100644 --- a/google/cloud/sql/connector/pymysql.py +++ b/google/cloud/sql/connector/pymysql.py @@ -26,16 +26,18 @@ def connect( ) -> "pymysql.connections.Connection": """Helper function to create a pymysql DB-API connection object. - :type ip_address: str - :param ip_address: A string containing an IP address for the Cloud SQL - instance. - - :type sock: ssl.SSLSocket - :param sock: An SSLSocket object created from the Cloud SQL server CA - cert and ephemeral cert. - - :rtype: pymysql.Connection - :returns: A PyMySQL Connection object for the Cloud SQL instance. + Args: + ip_address (str): A string containing an IP address for the Cloud SQL + instance. + sock (ssl.SSLSocket): An SSLSocket object created from the Cloud SQL + server CA cert and ephemeral cert. + + Returns: + pymysql.connections.Connection: A pymysql Connection object for the Cloud SQL + instance. + + Raises: + ImportError: The pymysql module cannot be imported. """ try: import pymysql diff --git a/google/cloud/sql/connector/pytds.py b/google/cloud/sql/connector/pytds.py index 3128fdb6..a569cf99 100644 --- a/google/cloud/sql/connector/pytds.py +++ b/google/cloud/sql/connector/pytds.py @@ -27,17 +27,18 @@ def connect(ip_address: str, sock: ssl.SSLSocket, **kwargs: Any) -> "pytds.Connection": """Helper function to create a pytds DB-API connection object. - :type ip_address: str - :param ip_address: A string containing an IP address for the Cloud SQL - instance. - - :type sock: ssl.SSLSocket - :param sock: An SSLSocket object created from the Cloud SQL server CA - cert and ephemeral cert. - - - :rtype: pytds.Connection - :returns: A pytds Connection object for the Cloud SQL instance. + Args: + ip_address (str): A string containing an IP address for the Cloud SQL + instance. + sock (ssl.SSLSocket): An SSLSocket object created from the Cloud SQL + server CA cert and ephemeral cert. + + Returns: + pytds.Connection: A pytds Connection object for the Cloud SQL + instance. + + Raises: + ImportError: The pytds module cannot be imported. """ try: import pytds diff --git a/google/cloud/sql/connector/rate_limiter.py b/google/cloud/sql/connector/rate_limiter.py index 38e7b94b..150f2816 100644 --- a/google/cloud/sql/connector/rate_limiter.py +++ b/google/cloud/sql/connector/rate_limiter.py @@ -19,24 +19,16 @@ class AsyncRateLimiter(object): - """ - An asyncio-compatible rate limiter which uses the Token Bucket algorithm - (https://en.wikipedia.org/wiki/Token_bucket) to limit the number of function calls over a time interval using an event queue. - - :type max_capacity: int - :param: max_capacity: - The maximum capacity of tokens the bucket will store at any one time. - Default: 1 - - :type rate: float - :param: rate: - The number of tokens that should be added per second. - - :type loop: asyncio.AbstractEventLoop - :param: loop: - The event loop to use. If not provided, the default event loop will be used. - + """An asyncio-compatible rate limiter which uses the Token Bucket algorithm + (https://en.wikipedia.org/wiki/Token_bucket) to limit the number + of function calls over a time interval using an event queue. + Args: + max_capacity (int): The maximum capacity of tokens the bucket will store at any one time. + Default: 1 + rate (float): The number of tokens that should be added per second. + loop (asyncio.AbstractEventLoop): The event loop to use. + If not provided, the default event loop will be used. """ def __init__( diff --git a/google/cloud/sql/connector/refresh_utils.py b/google/cloud/sql/connector/refresh_utils.py index 173f0d2e..0e203bbd 100644 --- a/google/cloud/sql/connector/refresh_utils.py +++ b/google/cloud/sql/connector/refresh_utils.py @@ -44,8 +44,11 @@ def _seconds_until_refresh( Usually the duration will be half of the time until certificate expiration. - :rtype: int - :returns: Time in seconds to wait before performing next refresh. + Args: + expiration (datetime.datetime): The expiration time of the certificate. + + Returns: + int: Time in seconds to wait before performing next refresh. """ duration = int( @@ -81,16 +84,12 @@ def _downscope_credentials( ) -> Credentials: """Generate a down-scoped credential. - :type credentials: google.auth.credentials.Credentials - :param credentials - Credentials object used to generate down-scoped credentials. - - :type scopes: list[str] - :param scopes - List of Google scopes to include in down-scoped credentials object. - - :rtype: google.auth.credentials.Credentials - :returns: Down-scoped credentials object. + Args: + credentials (google.auth.credentials.Credentials): Credentials object used to generate down-scoped credentials. + scopes (list[str]): List of Google scopes to include in down-scoped credentials object. + + Returns: + google.auth.credentials.Credentials: Down-scoped credentials object. """ # credentials sourced from a service account or metadata are children of # Scoped class and are capable of being re-scoped diff --git a/google/cloud/sql/connector/utils.py b/google/cloud/sql/connector/utils.py index 8caa73af..67a4c66e 100755 --- a/google/cloud/sql/connector/utils.py +++ b/google/cloud/sql/connector/utils.py @@ -79,16 +79,14 @@ async def write_to_file( def format_database_user(database_version: str, user: str) -> str: - """ - Format database `user` param for Cloud SQL automatic IAM authentication. - - :type database_version: str - :param database_version - Cloud SQL database version. (i.e. POSTGRES_14, MYSQL8_0, etc.) - - :type user: str - :param user - Database username to connect to Cloud SQL database with. + """Format database `user` param for Cloud SQL automatic IAM authentication. + + Args: + database_version (str): Cloud SQL database version. + user (str): Database username to connect to Cloud SQL database with. + + Returns: + str: Formatted database username. """ # remove suffix for Postgres service accounts if database_version.startswith("POSTGRES"): From bbdd32d802e909df03c767fe281584a4e6c9e5c1 Mon Sep 17 00:00:00 2001 From: "colin.chamabchan@gmail.com" Date: Fri, 28 Mar 2025 16:49:07 -0400 Subject: [PATCH 2/5] chore: minor comment reword --- google/cloud/sql/connector/asyncpg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google/cloud/sql/connector/asyncpg.py b/google/cloud/sql/connector/asyncpg.py index a3a436cb..18da6116 100644 --- a/google/cloud/sql/connector/asyncpg.py +++ b/google/cloud/sql/connector/asyncpg.py @@ -32,7 +32,8 @@ async def connect( ip_address (str): A string containing an IP address for the Cloud SQL instance. ctx (ssl.SSLContext): An SSLContext object created from the Cloud SQL - kwargs: Additional arguments to pass to the asyncpg connect method. + kwargs: Keyword arguments for establishing asyncpg connection + object to Cloud SQL instance. Returns: asyncpg.Connection: A asyncpg Connection object for the Cloud SQL From 585cb85ecb8e8abf55dae0238bc8b2945690c275 Mon Sep 17 00:00:00 2001 From: Colin Date: Sat, 29 Mar 2025 18:23:01 -0400 Subject: [PATCH 3/5] docs: implement docstring feedback --- google/cloud/sql/connector/asyncpg.py | 3 ++- google/cloud/sql/connector/client.py | 5 +++-- google/cloud/sql/connector/pg8000.py | 2 +- google/cloud/sql/connector/pymysql.py | 2 +- google/cloud/sql/connector/pytds.py | 2 +- google/cloud/sql/connector/rate_limiter.py | 4 ++-- google/cloud/sql/connector/refresh_utils.py | 6 ++++-- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/google/cloud/sql/connector/asyncpg.py b/google/cloud/sql/connector/asyncpg.py index 18da6116..0d4d8b7d 100644 --- a/google/cloud/sql/connector/asyncpg.py +++ b/google/cloud/sql/connector/asyncpg.py @@ -32,11 +32,12 @@ async def connect( ip_address (str): A string containing an IP address for the Cloud SQL instance. ctx (ssl.SSLContext): An SSLContext object created from the Cloud SQL + server CA cert and ephemeral cert. kwargs: Keyword arguments for establishing asyncpg connection object to Cloud SQL instance. Returns: - asyncpg.Connection: A asyncpg Connection object for the Cloud SQL + asyncpg.Connection: An asyncpg connection to the Cloud SQL instance. Raises: ImportError: The asyncpg module cannot be imported. diff --git a/google/cloud/sql/connector/client.py b/google/cloud/sql/connector/client.py index c7450788..5ddbdfac 100644 --- a/google/cloud/sql/connector/client.py +++ b/google/cloud/sql/connector/client.py @@ -194,8 +194,9 @@ async def _get_ephemeral( authentication for Postgres or MySQL instances. Returns: - An ephemeral certificate from the Cloud SQL instance that allows - authorized connections to the instance. + A tuple containing an ephemeral certificate from + the Cloud SQL instance as well as a datetime object + representing the expiration time of the certificate. """ headers = { "Authorization": f"Bearer {self._credentials.token}", diff --git a/google/cloud/sql/connector/pg8000.py b/google/cloud/sql/connector/pg8000.py index 750d128a..0514cd5e 100644 --- a/google/cloud/sql/connector/pg8000.py +++ b/google/cloud/sql/connector/pg8000.py @@ -34,7 +34,7 @@ def connect( kwargs: Additional arguments to pass to the pg8000 connect method. Returns: - pg8000.dbapi.Connection: A pg8000 Connection object for the Cloud SQL + pg8000.dbapi.Connection: A pg8000 connection to the Cloud SQL instance. Raises: diff --git a/google/cloud/sql/connector/pymysql.py b/google/cloud/sql/connector/pymysql.py index f798b5cb..857ec33c 100644 --- a/google/cloud/sql/connector/pymysql.py +++ b/google/cloud/sql/connector/pymysql.py @@ -33,7 +33,7 @@ def connect( server CA cert and ephemeral cert. Returns: - pymysql.connections.Connection: A pymysql Connection object for the Cloud SQL + pymysql.connections.Connection: A pymysql connection to the Cloud SQL instance. Raises: diff --git a/google/cloud/sql/connector/pytds.py b/google/cloud/sql/connector/pytds.py index a569cf99..792d9032 100644 --- a/google/cloud/sql/connector/pytds.py +++ b/google/cloud/sql/connector/pytds.py @@ -34,7 +34,7 @@ def connect(ip_address: str, sock: ssl.SSLSocket, **kwargs: Any) -> "pytds.Conne server CA cert and ephemeral cert. Returns: - pytds.Connection: A pytds Connection object for the Cloud SQL + pytds.Connection: A pytds connection to the Cloud SQL instance. Raises: diff --git a/google/cloud/sql/connector/rate_limiter.py b/google/cloud/sql/connector/rate_limiter.py index 150f2816..211c7fdb 100644 --- a/google/cloud/sql/connector/rate_limiter.py +++ b/google/cloud/sql/connector/rate_limiter.py @@ -24,8 +24,8 @@ class AsyncRateLimiter(object): of function calls over a time interval using an event queue. Args: - max_capacity (int): The maximum capacity of tokens the bucket will store at any one time. - Default: 1 + max_capacity (int): The maximum capacity of tokens the bucket + will store at any one time. Default: 1 rate (float): The number of tokens that should be added per second. loop (asyncio.AbstractEventLoop): The event loop to use. If not provided, the default event loop will be used. diff --git a/google/cloud/sql/connector/refresh_utils.py b/google/cloud/sql/connector/refresh_utils.py index 0e203bbd..5be3a1d9 100644 --- a/google/cloud/sql/connector/refresh_utils.py +++ b/google/cloud/sql/connector/refresh_utils.py @@ -85,8 +85,10 @@ def _downscope_credentials( """Generate a down-scoped credential. Args: - credentials (google.auth.credentials.Credentials): Credentials object used to generate down-scoped credentials. - scopes (list[str]): List of Google scopes to include in down-scoped credentials object. + credentials (google.auth.credentials.Credentials): + Credentials object used to generate down-scoped credentials. + scopes (list[str]): List of Google scopes to + include in down-scoped credentials object. Returns: google.auth.credentials.Credentials: Down-scoped credentials object. From 7ed9cedb6b2c3fdd93122bcef656d7bb29e5ade1 Mon Sep 17 00:00:00 2001 From: Jack Wotherspoon Date: Sun, 30 Mar 2025 20:52:09 -0400 Subject: [PATCH 4/5] chore: Update google/cloud/sql/connector/asyncpg.py --- google/cloud/sql/connector/asyncpg.py | 1 + 1 file changed, 1 insertion(+) diff --git a/google/cloud/sql/connector/asyncpg.py b/google/cloud/sql/connector/asyncpg.py index 0d4d8b7d..f7803c01 100644 --- a/google/cloud/sql/connector/asyncpg.py +++ b/google/cloud/sql/connector/asyncpg.py @@ -33,6 +33,7 @@ async def connect( instance. ctx (ssl.SSLContext): An SSLContext object created from the Cloud SQL server CA cert and ephemeral cert. + server CA cert and ephemeral cert. kwargs: Keyword arguments for establishing asyncpg connection object to Cloud SQL instance. From fb79283e3bfba41b4a7270e63c5470a628f32dbd Mon Sep 17 00:00:00 2001 From: jackwotherspoon Date: Mon, 31 Mar 2025 00:57:28 +0000 Subject: [PATCH 5/5] chore: lint --- google/cloud/sql/connector/asyncpg.py | 2 +- google/cloud/sql/connector/client.py | 8 ++++---- google/cloud/sql/connector/pg8000.py | 4 ++-- google/cloud/sql/connector/pymysql.py | 2 +- google/cloud/sql/connector/pytds.py | 4 ++-- google/cloud/sql/connector/rate_limiter.py | 6 +++--- google/cloud/sql/connector/refresh_utils.py | 8 ++++---- google/cloud/sql/connector/utils.py | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/google/cloud/sql/connector/asyncpg.py b/google/cloud/sql/connector/asyncpg.py index f7803c01..2fbc3027 100644 --- a/google/cloud/sql/connector/asyncpg.py +++ b/google/cloud/sql/connector/asyncpg.py @@ -36,7 +36,7 @@ async def connect( server CA cert and ephemeral cert. kwargs: Keyword arguments for establishing asyncpg connection object to Cloud SQL instance. - + Returns: asyncpg.Connection: An asyncpg connection to the Cloud SQL instance. diff --git a/google/cloud/sql/connector/client.py b/google/cloud/sql/connector/client.py index 5ddbdfac..11508ce1 100644 --- a/google/cloud/sql/connector/client.py +++ b/google/cloud/sql/connector/client.py @@ -100,7 +100,7 @@ async def _get_metadata( instance: str, ) -> dict[str, Any]: """Requests metadata from the Cloud SQL Instance and returns a dictionary - containing the IP addresses and certificate authority of the Cloud SQL + containing the IP addresses and certificate authority of the Cloud SQL Instance. Args: @@ -109,7 +109,7 @@ async def _get_metadata( instance (str): A string representing the name of the instance. Returns: - A dictionary containing a dictionary of all IP addresses + A dictionary containing a dictionary of all IP addresses and their type and a string representing the certificate authority. Raises: @@ -194,8 +194,8 @@ async def _get_ephemeral( authentication for Postgres or MySQL instances. Returns: - A tuple containing an ephemeral certificate from - the Cloud SQL instance as well as a datetime object + A tuple containing an ephemeral certificate from + the Cloud SQL instance as well as a datetime object representing the expiration time of the certificate. """ headers = { diff --git a/google/cloud/sql/connector/pg8000.py b/google/cloud/sql/connector/pg8000.py index 0514cd5e..5a43ad31 100644 --- a/google/cloud/sql/connector/pg8000.py +++ b/google/cloud/sql/connector/pg8000.py @@ -32,11 +32,11 @@ def connect( sock (ssl.SSLSocket): An SSLSocket object created from the Cloud SQL server CA cert and ephemeral cert. kwargs: Additional arguments to pass to the pg8000 connect method. - + Returns: pg8000.dbapi.Connection: A pg8000 connection to the Cloud SQL instance. - + Raises: ImportError: The pg8000 module cannot be imported. """ diff --git a/google/cloud/sql/connector/pymysql.py b/google/cloud/sql/connector/pymysql.py index 857ec33c..e01cfed0 100644 --- a/google/cloud/sql/connector/pymysql.py +++ b/google/cloud/sql/connector/pymysql.py @@ -35,7 +35,7 @@ def connect( Returns: pymysql.connections.Connection: A pymysql connection to the Cloud SQL instance. - + Raises: ImportError: The pymysql module cannot be imported. """ diff --git a/google/cloud/sql/connector/pytds.py b/google/cloud/sql/connector/pytds.py index 792d9032..6cc3c093 100644 --- a/google/cloud/sql/connector/pytds.py +++ b/google/cloud/sql/connector/pytds.py @@ -32,11 +32,11 @@ def connect(ip_address: str, sock: ssl.SSLSocket, **kwargs: Any) -> "pytds.Conne instance. sock (ssl.SSLSocket): An SSLSocket object created from the Cloud SQL server CA cert and ephemeral cert. - + Returns: pytds.Connection: A pytds connection to the Cloud SQL instance. - + Raises: ImportError: The pytds module cannot be imported. """ diff --git a/google/cloud/sql/connector/rate_limiter.py b/google/cloud/sql/connector/rate_limiter.py index 211c7fdb..be9c68c6 100644 --- a/google/cloud/sql/connector/rate_limiter.py +++ b/google/cloud/sql/connector/rate_limiter.py @@ -20,14 +20,14 @@ class AsyncRateLimiter(object): """An asyncio-compatible rate limiter which uses the Token Bucket algorithm - (https://en.wikipedia.org/wiki/Token_bucket) to limit the number + (https://en.wikipedia.org/wiki/Token_bucket) to limit the number of function calls over a time interval using an event queue. Args: - max_capacity (int): The maximum capacity of tokens the bucket + max_capacity (int): The maximum capacity of tokens the bucket will store at any one time. Default: 1 rate (float): The number of tokens that should be added per second. - loop (asyncio.AbstractEventLoop): The event loop to use. + loop (asyncio.AbstractEventLoop): The event loop to use. If not provided, the default event loop will be used. """ diff --git a/google/cloud/sql/connector/refresh_utils.py b/google/cloud/sql/connector/refresh_utils.py index 5be3a1d9..a90d4053 100644 --- a/google/cloud/sql/connector/refresh_utils.py +++ b/google/cloud/sql/connector/refresh_utils.py @@ -46,7 +46,7 @@ def _seconds_until_refresh( Args: expiration (datetime.datetime): The expiration time of the certificate. - + Returns: int: Time in seconds to wait before performing next refresh. """ @@ -85,11 +85,11 @@ def _downscope_credentials( """Generate a down-scoped credential. Args: - credentials (google.auth.credentials.Credentials): + credentials (google.auth.credentials.Credentials): Credentials object used to generate down-scoped credentials. - scopes (list[str]): List of Google scopes to + scopes (list[str]): List of Google scopes to include in down-scoped credentials object. - + Returns: google.auth.credentials.Credentials: Down-scoped credentials object. """ diff --git a/google/cloud/sql/connector/utils.py b/google/cloud/sql/connector/utils.py index 67a4c66e..dd0aec34 100755 --- a/google/cloud/sql/connector/utils.py +++ b/google/cloud/sql/connector/utils.py @@ -84,7 +84,7 @@ def format_database_user(database_version: str, user: str) -> str: Args: database_version (str): Cloud SQL database version. user (str): Database username to connect to Cloud SQL database with. - + Returns: str: Formatted database username. """