Skip to content

Commit 1888b2e

Browse files
committed
fix: address reviewer comments on api-core
1 parent 3e9393a commit 1888b2e

6 files changed

Lines changed: 5 additions & 47 deletions

File tree

packages/google-api-core/google/api_core/gapic_v1/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
# limitations under the License.
1414

1515
from google.api_core.gapic_v1 import (
16-
_client_cert,
17-
_config_helpers,
18-
_method_helpers,
19-
_routing,
2016
client_info,
2117
config,
2218
config_async,
@@ -26,14 +22,10 @@
2622
)
2723

2824
__all__ = [
29-
"_client_cert",
3025
"client_info",
3126
"config",
3227
"config_async",
33-
"_config_helpers",
3428
"method",
3529
"method_async",
36-
"_method_helpers",
37-
"_routing",
3830
"routing_header",
3931
]

packages/google-api-core/google/api_core/gapic_v1/_client_cert.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ def get_client_cert_source(
5959
"""Return the client cert source to be used by the client.
6060
6161
Args:
62-
provided_cert_source (bytes): The client certificate source provided.
62+
provided_cert_source (Callable[[], Tuple[bytes, bytes]]): The client certificate source provided.
6363
use_cert_flag (bool): A flag indicating whether to use the
6464
client certificate.
6565
6666
Returns:
67-
bytes or None: The client cert source to be used by the client.
67+
Callable[[], Tuple[bytes, bytes]] or None: The client cert source to be used by the client.
6868
"""
6969
client_cert_source = None
7070
if use_cert_flag:
@@ -76,9 +76,3 @@ def get_client_cert_source(
7676
):
7777
client_cert_source = mtls.default_client_cert_source()
7878
return client_cert_source
79-
80-
81-
# Backward compatibility aliases for private methods
82-
# Previously, gapic-generator-python generated clients used these methods
83-
_use_client_cert_effective = use_client_cert_effective
84-
_get_client_cert_source = get_client_cert_source

packages/google-api-core/google/api_core/gapic_v1/_config_helpers.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,11 @@ def read_environment_variables() -> Tuple[bool, str, Optional[str]]:
3939
["auto", "never", "always"].
4040
"""
4141
use_client_cert = use_client_cert_effective()
42-
use_mtls_endpoint = os.getenv(
43-
"GOOGLE_API_USE_MTLS_ENDPOINT", "auto"
44-
).lower() # noqa: E501
42+
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
4543
universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
4644
if use_mtls_endpoint not in ("auto", "never", "always"):
4745
raise MutualTLSChannelError(
4846
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` "
4947
"must be `never`, `auto` or `always`"
5048
)
5149
return use_client_cert, use_mtls_endpoint, universe_domain_env
52-
53-
54-
# Backward compatibility aliases for private methods
55-
# Previously, gapic-generator-python generated clients used these methods
56-
_read_environment_variables = read_environment_variables

packages/google-api-core/google/api_core/gapic_v1/_method_helpers.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
from typing import Any
2121

2222

23-
def setup_request_id(
24-
request: Any, field_name: str, is_proto3_optional: bool
25-
) -> None: # noqa: E501
23+
def setup_request_id(request: Any, field_name: str, is_proto3_optional: bool) -> None:
2624
"""Populate a UUID4 field in the request if it is not already set.
2725
2826
Args:
@@ -51,8 +49,3 @@ def setup_request_id(
5149
else:
5250
if not getattr(request, field_name):
5351
setattr(request, field_name, str(uuid.uuid4()))
54-
55-
56-
# Backward compatibility aliases for private methods
57-
# Previously, gapic-generator-python generated clients used these methods
58-
_setup_request_id = setup_request_id

packages/google-api-core/google/api_core/gapic_v1/_routing.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def get_api_endpoint(
7979
)
8080
return default_mtls_endpoint
8181
else:
82-
return default_endpoint_template.format(
83-
UNIVERSE_DOMAIN=universe_domain
84-
) # noqa: E501
82+
return default_endpoint_template.format(UNIVERSE_DOMAIN=universe_domain)
8583

8684

8785
def get_universe_domain(
@@ -98,9 +96,3 @@ def get_universe_domain(
9896
if len(universe_domain.strip()) == 0:
9997
raise ValueError("Universe Domain cannot be an empty string.")
10098
return universe_domain
101-
102-
103-
# Backward compatibility aliases for private methods
104-
# Previously, gapic-generator-python generated clients used these methods
105-
_get_default_mtls_endpoint = get_default_mtls_endpoint
106-
_get_universe_domain = get_universe_domain

packages/google-api-core/tests/unit/gapic/test_method_helpers.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
import pytest
17-
18-
try:
19-
import grpc # noqa: F401
20-
except ImportError:
21-
pytest.skip("No GRPC", allow_module_level=True)
2216

2317
from google.api_core.gapic_v1._method_helpers import setup_request_id
2418

0 commit comments

Comments
 (0)