From e437ed68b35dd85e3abfaa01cea9300322fe1f3c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Sat, 21 Oct 2023 13:20:13 +0000 Subject: [PATCH 1/6] fix: drop usage of distutils --- .../operations_v1/abstract_operations_client.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/google/api_core/operations_v1/abstract_operations_client.py b/google/api_core/operations_v1/abstract_operations_client.py index 714c2aae..1930d86e 100644 --- a/google/api_core/operations_v1/abstract_operations_client.py +++ b/google/api_core/operations_v1/abstract_operations_client.py @@ -14,7 +14,6 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union @@ -293,14 +292,14 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) - ) + # Create SSL credentials for mutual TLS if needed. + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + if use_client_cert.lower() not in ("true", "false"): + raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") client_cert_source_func = None is_mtls = False - if use_client_cert: + if use_client_cert.lower() == "true": if client_options.client_cert_source: is_mtls = True client_cert_source_func = client_options.client_cert_source From d42b5e76d8c586d2257cd3376d238e906a6a8a22 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Sat, 21 Oct 2023 13:25:32 +0000 Subject: [PATCH 2/6] lint --- google/api_core/operations_v1/abstract_operations_client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/google/api_core/operations_v1/abstract_operations_client.py b/google/api_core/operations_v1/abstract_operations_client.py index 1930d86e..84c218fb 100644 --- a/google/api_core/operations_v1/abstract_operations_client.py +++ b/google/api_core/operations_v1/abstract_operations_client.py @@ -292,11 +292,12 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") if use_client_cert.lower() not in ("true", "false"): - raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) client_cert_source_func = None is_mtls = False if use_client_cert.lower() == "true": From 3854b0ec8c5448c06a745a8709f562987ee201cf Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Sat, 21 Oct 2023 13:25:59 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- google/api_core/operations_v1/abstract_operations_client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/google/api_core/operations_v1/abstract_operations_client.py b/google/api_core/operations_v1/abstract_operations_client.py index 1930d86e..84c218fb 100644 --- a/google/api_core/operations_v1/abstract_operations_client.py +++ b/google/api_core/operations_v1/abstract_operations_client.py @@ -292,11 +292,12 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") if use_client_cert.lower() not in ("true", "false"): - raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) client_cert_source_func = None is_mtls = False if use_client_cert.lower() == "true": From 614150d26ee14e697f0afab655da794b745bc99e Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 2 Nov 2023 16:46:06 -0400 Subject: [PATCH 4/6] address review feedback --- google/api_core/operations_v1/abstract_operations_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/google/api_core/operations_v1/abstract_operations_client.py b/google/api_core/operations_v1/abstract_operations_client.py index 84c218fb..2c1bbd9f 100644 --- a/google/api_core/operations_v1/abstract_operations_client.py +++ b/google/api_core/operations_v1/abstract_operations_client.py @@ -293,14 +293,14 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - if use_client_cert.lower() not in ("true", "false"): + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false").lower() + if use_client_cert not in ("true", "false"): raise ValueError( "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" ) client_cert_source_func = None is_mtls = False - if use_client_cert.lower() == "true": + if use_client_cert == "true": if client_options.client_cert_source: is_mtls = True client_cert_source_func = client_options.client_cert_source From 897adf4dbe8a96e1154eb6eeed6bb1c533e56038 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 2 Nov 2023 20:47:43 +0000 Subject: [PATCH 5/6] lint --- google/api_core/operations_v1/abstract_operations_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/google/api_core/operations_v1/abstract_operations_client.py b/google/api_core/operations_v1/abstract_operations_client.py index 2c1bbd9f..38f532af 100644 --- a/google/api_core/operations_v1/abstract_operations_client.py +++ b/google/api_core/operations_v1/abstract_operations_client.py @@ -293,7 +293,9 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false").lower() + use_client_cert = os.getenv( + "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false" + ).lower() if use_client_cert not in ("true", "false"): raise ValueError( "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" From 88fe0525eaea53ea9da466e1deaaf1149ab9596f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 2 Nov 2023 20:48:00 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- google/api_core/operations_v1/abstract_operations_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/google/api_core/operations_v1/abstract_operations_client.py b/google/api_core/operations_v1/abstract_operations_client.py index 2c1bbd9f..38f532af 100644 --- a/google/api_core/operations_v1/abstract_operations_client.py +++ b/google/api_core/operations_v1/abstract_operations_client.py @@ -293,7 +293,9 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false").lower() + use_client_cert = os.getenv( + "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false" + ).lower() if use_client_cert not in ("true", "false"): raise ValueError( "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"