google-maps-routeoptimization 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {google_maps_routeoptimization-0.3.0/google_maps_routeoptimization.egg-info → google_maps_routeoptimization-0.4.0}/PKG-INFO +6 -8
  2. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/README.rst +2 -2
  3. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization/gapic_version.py +1 -1
  4. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/__init__.py +1 -0
  5. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/gapic_version.py +1 -1
  6. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/route_optimization/async_client.py +22 -12
  7. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/route_optimization/client.py +29 -26
  8. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/base.py +15 -6
  9. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/grpc.py +17 -13
  10. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/grpc_asyncio.py +16 -12
  11. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/rest.py +20 -22
  12. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/types/route_optimization_service.py +69 -59
  13. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0/google_maps_routeoptimization.egg-info}/PKG-INFO +6 -8
  14. google_maps_routeoptimization-0.4.0/google_maps_routeoptimization.egg-info/requires.txt +11 -0
  15. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/setup.py +3 -5
  16. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/tests/unit/gapic/routeoptimization_v1/test_route_optimization.py +172 -116
  17. google_maps_routeoptimization-0.3.0/google_maps_routeoptimization.egg-info/requires.txt +0 -11
  18. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/LICENSE +0 -0
  19. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/MANIFEST.in +0 -0
  20. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization/__init__.py +0 -0
  21. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization/py.typed +0 -0
  22. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/gapic_metadata.json +0 -0
  23. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/py.typed +0 -0
  24. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/__init__.py +0 -0
  25. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/route_optimization/__init__.py +0 -0
  26. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/__init__.py +0 -0
  27. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/rest_base.py +0 -0
  28. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google/maps/routeoptimization_v1/types/__init__.py +0 -0
  29. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google_maps_routeoptimization.egg-info/SOURCES.txt +0 -0
  30. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google_maps_routeoptimization.egg-info/dependency_links.txt +0 -0
  31. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google_maps_routeoptimization.egg-info/not-zip-safe +0 -0
  32. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/google_maps_routeoptimization.egg-info/top_level.txt +0 -0
  33. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/setup.cfg +0 -0
  34. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/tests/__init__.py +0 -0
  35. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/tests/unit/__init__.py +0 -0
  36. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/tests/unit/gapic/__init__.py +0 -0
  37. {google_maps_routeoptimization-0.3.0 → google_maps_routeoptimization-0.4.0}/tests/unit/gapic/routeoptimization_v1/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-maps-routeoptimization
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Google Maps Routeoptimization API client library
5
5
  Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-maps-routeoptimization
6
6
  Author: Google LLC
@@ -12,8 +12,6 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.7
16
- Classifier: Programming Language :: Python :: 3.8
17
15
  Classifier: Programming Language :: Python :: 3.9
18
16
  Classifier: Programming Language :: Python :: 3.10
19
17
  Classifier: Programming Language :: Python :: 3.11
@@ -22,15 +20,15 @@ Classifier: Programming Language :: Python :: 3.13
22
20
  Classifier: Programming Language :: Python :: 3.14
23
21
  Classifier: Operating System :: OS Independent
24
22
  Classifier: Topic :: Internet
25
- Requires-Python: >=3.7
23
+ Requires-Python: >=3.9
26
24
  License-File: LICENSE
27
- Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.1
25
+ Requires-Dist: google-api-core[grpc]<3.0.0,>=2.11.0
28
26
  Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
29
27
  Requires-Dist: grpcio<2.0.0,>=1.33.2
30
28
  Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14"
31
29
  Requires-Dist: proto-plus<2.0.0,>=1.22.3
32
30
  Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
33
- Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2
31
+ Requires-Dist: protobuf<8.0.0,>=4.25.8
34
32
  Dynamic: author
35
33
  Dynamic: author-email
36
34
  Dynamic: classifier
@@ -106,14 +104,14 @@ Supported Python Versions
106
104
  Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
107
105
  Python.
108
106
 
109
- Python >= 3.7, including 3.14
107
+ Python >= 3.9, including 3.14
110
108
 
111
109
  .. _active: https://devguide.python.org/devcycle/#in-development-main-branch
112
110
  .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
113
111
 
114
112
  Unsupported Python Versions
115
113
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
116
- Python <= 3.6
114
+ Python <= 3.8
117
115
 
118
116
  If you are using an `end-of-life`_
119
117
  version of Python, we recommend that you update as soon as possible to an actively supported version.
@@ -61,14 +61,14 @@ Supported Python Versions
61
61
  Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
62
62
  Python.
63
63
 
64
- Python >= 3.7, including 3.14
64
+ Python >= 3.9, including 3.14
65
65
 
66
66
  .. _active: https://devguide.python.org/devcycle/#in-development-main-branch
67
67
  .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
68
68
 
69
69
  Unsupported Python Versions
70
70
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
71
- Python <= 3.6
71
+ Python <= 3.8
72
72
 
73
73
  If you are using an `end-of-life`_
74
74
  version of Python, we recommend that you update as soon as possible to an actively supported version.
@@ -13,4 +13,4 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- __version__ = "0.3.0" # {x-release-please-version}
16
+ __version__ = "0.4.0" # {x-release-please-version}
@@ -28,6 +28,7 @@ else: # pragma: NO COVER
28
28
  # this code path once we drop support for Python 3.7
29
29
  import importlib_metadata as metadata
30
30
 
31
+
31
32
  from .services.route_optimization import (
32
33
  RouteOptimizationAsyncClient,
33
34
  RouteOptimizationClient,
@@ -13,4 +13,4 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- __version__ = "0.3.0" # {x-release-please-version}
16
+ __version__ = "0.4.0" # {x-release-please-version}
@@ -13,9 +13,9 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- from collections import OrderedDict
17
16
  import logging as std_logging
18
17
  import re
18
+ from collections import OrderedDict
19
19
  from typing import (
20
20
  Callable,
21
21
  Dict,
@@ -29,13 +29,13 @@ from typing import (
29
29
  Union,
30
30
  )
31
31
 
32
+ import google.protobuf
32
33
  from google.api_core import exceptions as core_exceptions
33
34
  from google.api_core import gapic_v1
34
35
  from google.api_core import retry_async as retries
35
36
  from google.api_core.client_options import ClientOptions
36
37
  from google.auth import credentials as ga_credentials # type: ignore
37
38
  from google.oauth2 import service_account # type: ignore
38
- import google.protobuf
39
39
 
40
40
  from google.maps.routeoptimization_v1 import gapic_version as package_version
41
41
 
@@ -44,8 +44,8 @@ try:
44
44
  except AttributeError: # pragma: NO COVER
45
45
  OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
46
 
47
- from google.api_core import operation # type: ignore
48
- from google.api_core import operation_async # type: ignore
47
+ import google.api_core.operation as operation # type: ignore
48
+ import google.api_core.operation_async as operation_async # type: ignore
49
49
  from google.longrunning import operations_pb2 # type: ignore
50
50
 
51
51
  from google.maps.routeoptimization_v1.types import route_optimization_service
@@ -136,7 +136,10 @@ class RouteOptimizationAsyncClient:
136
136
  Returns:
137
137
  RouteOptimizationAsyncClient: The constructed client.
138
138
  """
139
- return RouteOptimizationClient.from_service_account_info.__func__(RouteOptimizationAsyncClient, info, *args, **kwargs) # type: ignore
139
+ sa_info_func = (
140
+ RouteOptimizationClient.from_service_account_info.__func__ # type: ignore
141
+ )
142
+ return sa_info_func(RouteOptimizationAsyncClient, info, *args, **kwargs)
140
143
 
141
144
  @classmethod
142
145
  def from_service_account_file(cls, filename: str, *args, **kwargs):
@@ -152,7 +155,10 @@ class RouteOptimizationAsyncClient:
152
155
  Returns:
153
156
  RouteOptimizationAsyncClient: The constructed client.
154
157
  """
155
- return RouteOptimizationClient.from_service_account_file.__func__(RouteOptimizationAsyncClient, filename, *args, **kwargs) # type: ignore
158
+ sa_file_func = (
159
+ RouteOptimizationClient.from_service_account_file.__func__ # type: ignore
160
+ )
161
+ return sa_file_func(RouteOptimizationAsyncClient, filename, *args, **kwargs)
156
162
 
157
163
  from_service_account_json = from_service_account_file
158
164
 
@@ -202,7 +208,7 @@ class RouteOptimizationAsyncClient:
202
208
  return self._client.transport
203
209
 
204
210
  @property
205
- def api_endpoint(self):
211
+ def api_endpoint(self) -> str:
206
212
  """Return the API endpoint used by the client instance.
207
213
 
208
214
  Returns:
@@ -819,7 +825,7 @@ class RouteOptimizationAsyncClient:
819
825
 
820
826
  async def get_operation(
821
827
  self,
822
- request: Optional[operations_pb2.GetOperationRequest] = None,
828
+ request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None,
823
829
  *,
824
830
  retry: OptionalRetry = gapic_v1.method.DEFAULT,
825
831
  timeout: Union[float, object] = gapic_v1.method.DEFAULT,
@@ -845,8 +851,12 @@ class RouteOptimizationAsyncClient:
845
851
  # Create or coerce a protobuf request object.
846
852
  # The request isn't a proto-plus wrapped type,
847
853
  # so it must be constructed via keyword expansion.
848
- if isinstance(request, dict):
849
- request = operations_pb2.GetOperationRequest(**request)
854
+ if request is None:
855
+ request_pb = operations_pb2.GetOperationRequest()
856
+ elif isinstance(request, dict):
857
+ request_pb = operations_pb2.GetOperationRequest(**request)
858
+ else:
859
+ request_pb = request
850
860
 
851
861
  # Wrap the RPC method; this adds retry and timeout information,
852
862
  # and friendly error handling.
@@ -855,7 +865,7 @@ class RouteOptimizationAsyncClient:
855
865
  # Certain fields should be provided within the metadata header;
856
866
  # add these here.
857
867
  metadata = tuple(metadata) + (
858
- gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
868
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
859
869
  )
860
870
 
861
871
  # Validate the universe domain.
@@ -863,7 +873,7 @@ class RouteOptimizationAsyncClient:
863
873
 
864
874
  # Send the request.
865
875
  response = await rpc(
866
- request,
876
+ request_pb,
867
877
  retry=retry,
868
878
  timeout=timeout,
869
879
  metadata=metadata,
@@ -13,12 +13,13 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- from collections import OrderedDict
17
- from http import HTTPStatus
18
16
  import json
19
17
  import logging as std_logging
20
18
  import os
21
19
  import re
20
+ import warnings
21
+ from collections import OrderedDict
22
+ from http import HTTPStatus
22
23
  from typing import (
23
24
  Callable,
24
25
  Dict,
@@ -32,8 +33,8 @@ from typing import (
32
33
  Union,
33
34
  cast,
34
35
  )
35
- import warnings
36
36
 
37
+ import google.protobuf
37
38
  from google.api_core import client_options as client_options_lib
38
39
  from google.api_core import exceptions as core_exceptions
39
40
  from google.api_core import gapic_v1
@@ -43,7 +44,6 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore
43
44
  from google.auth.transport import mtls # type: ignore
44
45
  from google.auth.transport.grpc import SslCredentials # type: ignore
45
46
  from google.oauth2 import service_account # type: ignore
46
- import google.protobuf
47
47
 
48
48
  from google.maps.routeoptimization_v1 import gapic_version as package_version
49
49
 
@@ -61,8 +61,8 @@ except ImportError: # pragma: NO COVER
61
61
 
62
62
  _LOGGER = std_logging.getLogger(__name__)
63
63
 
64
- from google.api_core import operation # type: ignore
65
- from google.api_core import operation_async # type: ignore
64
+ import google.api_core.operation as operation # type: ignore
65
+ import google.api_core.operation_async as operation_async # type: ignore
66
66
  from google.longrunning import operations_pb2 # type: ignore
67
67
 
68
68
  from google.maps.routeoptimization_v1.types import route_optimization_service
@@ -81,9 +81,7 @@ class RouteOptimizationClientMeta(type):
81
81
  objects.
82
82
  """
83
83
 
84
- _transport_registry = (
85
- OrderedDict()
86
- ) # type: Dict[str, Type[RouteOptimizationTransport]]
84
+ _transport_registry = OrderedDict() # type: Dict[str, Type[RouteOptimizationTransport]]
87
85
  _transport_registry["grpc"] = RouteOptimizationGrpcTransport
88
86
  _transport_registry["grpc_asyncio"] = RouteOptimizationGrpcAsyncIOTransport
89
87
  _transport_registry["rest"] = RouteOptimizationRestTransport
@@ -136,7 +134,7 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
136
134
  """
137
135
 
138
136
  @staticmethod
139
- def _get_default_mtls_endpoint(api_endpoint):
137
+ def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]:
140
138
  """Converts api endpoint to mTLS endpoint.
141
139
 
142
140
  Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
@@ -144,7 +142,7 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
144
142
  Args:
145
143
  api_endpoint (Optional[str]): the api endpoint to convert.
146
144
  Returns:
147
- str: converted mTLS api endpoint.
145
+ Optional[str]: converted mTLS api endpoint.
148
146
  """
149
147
  if not api_endpoint:
150
148
  return api_endpoint
@@ -154,6 +152,10 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
154
152
  )
155
153
 
156
154
  m = mtls_endpoint_re.match(api_endpoint)
155
+ if m is None:
156
+ # Could not parse api_endpoint; return as-is.
157
+ return api_endpoint
158
+
157
159
  name, mtls, sandbox, googledomain = m.groups()
158
160
  if mtls or not googledomain:
159
161
  return api_endpoint
@@ -439,7 +441,7 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
439
441
  @staticmethod
440
442
  def _get_api_endpoint(
441
443
  api_override, client_cert_source, universe_domain, use_mtls_endpoint
442
- ):
444
+ ) -> str:
443
445
  """Return the API endpoint used by the client.
444
446
 
445
447
  Args:
@@ -536,7 +538,7 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
536
538
  error._details.append(json.dumps(cred_info))
537
539
 
538
540
  @property
539
- def api_endpoint(self):
541
+ def api_endpoint(self) -> str:
540
542
  """Return the API endpoint used by the client instance.
541
543
 
542
544
  Returns:
@@ -627,18 +629,16 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
627
629
 
628
630
  universe_domain_opt = getattr(self._client_options, "universe_domain", None)
629
631
 
630
- (
631
- self._use_client_cert,
632
- self._use_mtls_endpoint,
633
- self._universe_domain_env,
634
- ) = RouteOptimizationClient._read_environment_variables()
632
+ self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = (
633
+ RouteOptimizationClient._read_environment_variables()
634
+ )
635
635
  self._client_cert_source = RouteOptimizationClient._get_client_cert_source(
636
636
  self._client_options.client_cert_source, self._use_client_cert
637
637
  )
638
638
  self._universe_domain = RouteOptimizationClient._get_universe_domain(
639
639
  universe_domain_opt, self._universe_domain_env
640
640
  )
641
- self._api_endpoint = None # updated below, depending on `transport`
641
+ self._api_endpoint: str = "" # updated below, depending on `transport`
642
642
 
643
643
  # Initialize the universe domain validation.
644
644
  self._is_universe_domain_valid = False
@@ -666,8 +666,7 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
666
666
  )
667
667
  if self._client_options.scopes:
668
668
  raise ValueError(
669
- "When providing a transport instance, provide its scopes "
670
- "directly."
669
+ "When providing a transport instance, provide its scopes directly."
671
670
  )
672
671
  self._transport = cast(RouteOptimizationTransport, transport)
673
672
  self._api_endpoint = self._transport.host
@@ -1248,7 +1247,7 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
1248
1247
 
1249
1248
  def get_operation(
1250
1249
  self,
1251
- request: Optional[operations_pb2.GetOperationRequest] = None,
1250
+ request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None,
1252
1251
  *,
1253
1252
  retry: OptionalRetry = gapic_v1.method.DEFAULT,
1254
1253
  timeout: Union[float, object] = gapic_v1.method.DEFAULT,
@@ -1274,8 +1273,12 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
1274
1273
  # Create or coerce a protobuf request object.
1275
1274
  # The request isn't a proto-plus wrapped type,
1276
1275
  # so it must be constructed via keyword expansion.
1277
- if isinstance(request, dict):
1278
- request = operations_pb2.GetOperationRequest(**request)
1276
+ if request is None:
1277
+ request_pb = operations_pb2.GetOperationRequest()
1278
+ elif isinstance(request, dict):
1279
+ request_pb = operations_pb2.GetOperationRequest(**request)
1280
+ else:
1281
+ request_pb = request
1279
1282
 
1280
1283
  # Wrap the RPC method; this adds retry and timeout information,
1281
1284
  # and friendly error handling.
@@ -1284,7 +1287,7 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
1284
1287
  # Certain fields should be provided within the metadata header;
1285
1288
  # add these here.
1286
1289
  metadata = tuple(metadata) + (
1287
- gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1290
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
1288
1291
  )
1289
1292
 
1290
1293
  # Validate the universe domain.
@@ -1293,7 +1296,7 @@ class RouteOptimizationClient(metaclass=RouteOptimizationClientMeta):
1293
1296
  try:
1294
1297
  # Send the request.
1295
1298
  response = rpc(
1296
- request,
1299
+ request_pb,
1297
1300
  retry=retry,
1298
1301
  timeout=timeout,
1299
1302
  metadata=metadata,
@@ -17,14 +17,14 @@ import abc
17
17
  from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
18
 
19
19
  import google.api_core
20
+ import google.auth # type: ignore
21
+ import google.protobuf
20
22
  from google.api_core import exceptions as core_exceptions
21
23
  from google.api_core import gapic_v1, operations_v1
22
24
  from google.api_core import retry as retries
23
- import google.auth # type: ignore
24
25
  from google.auth import credentials as ga_credentials # type: ignore
25
26
  from google.longrunning import operations_pb2 # type: ignore
26
27
  from google.oauth2 import service_account # type: ignore
27
- import google.protobuf
28
28
 
29
29
  from google.maps.routeoptimization_v1 import gapic_version as package_version
30
30
  from google.maps.routeoptimization_v1.types import route_optimization_service
@@ -81,10 +81,12 @@ class RouteOptimizationTransport(abc.ABC):
81
81
  your own client library.
82
82
  always_use_jwt_access (Optional[bool]): Whether self signed JWT should
83
83
  be used for service account credentials.
84
+ api_audience (Optional[str]): The intended audience for the API calls
85
+ to the service that will be set when using certain 3rd party
86
+ authentication flows. Audience is typically a resource identifier.
87
+ If not set, the host value will be used as a default.
84
88
  """
85
89
 
86
- scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
87
-
88
90
  # Save the scopes.
89
91
  self._scopes = scopes
90
92
  if not hasattr(self, "_ignore_credentials"):
@@ -99,11 +101,16 @@ class RouteOptimizationTransport(abc.ABC):
99
101
 
100
102
  if credentials_file is not None:
101
103
  credentials, _ = google.auth.load_credentials_from_file(
102
- credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
104
+ credentials_file,
105
+ scopes=scopes,
106
+ quota_project_id=quota_project_id,
107
+ default_scopes=self.AUTH_SCOPES,
103
108
  )
104
109
  elif credentials is None and not self._ignore_credentials:
105
110
  credentials, _ = google.auth.default(
106
- **scopes_kwargs, quota_project_id=quota_project_id
111
+ scopes=scopes,
112
+ quota_project_id=quota_project_id,
113
+ default_scopes=self.AUTH_SCOPES,
107
114
  )
108
115
  # Don't apply audience if the credentials file passed from user.
109
116
  if hasattr(credentials, "with_gdch_audience"):
@@ -127,6 +134,8 @@ class RouteOptimizationTransport(abc.ABC):
127
134
  host += ":443"
128
135
  self._host = host
129
136
 
137
+ self._wrapped_methods: Dict[Callable, Callable] = {}
138
+
130
139
  @property
131
140
  def host(self):
132
141
  return self._host
@@ -16,18 +16,18 @@
16
16
  import json
17
17
  import logging as std_logging
18
18
  import pickle
19
- from typing import Callable, Dict, Optional, Sequence, Tuple, Union
20
19
  import warnings
20
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
21
21
 
22
- from google.api_core import gapic_v1, grpc_helpers, operations_v1
23
22
  import google.auth # type: ignore
23
+ import google.protobuf.message
24
+ import grpc # type: ignore
25
+ import proto # type: ignore
26
+ from google.api_core import gapic_v1, grpc_helpers, operations_v1
24
27
  from google.auth import credentials as ga_credentials # type: ignore
25
28
  from google.auth.transport.grpc import SslCredentials # type: ignore
26
29
  from google.longrunning import operations_pb2 # type: ignore
27
30
  from google.protobuf.json_format import MessageToJson
28
- import google.protobuf.message
29
- import grpc # type: ignore
30
- import proto # type: ignore
31
31
 
32
32
  from google.maps.routeoptimization_v1.types import route_optimization_service
33
33
 
@@ -55,7 +55,7 @@ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO
55
55
  elif isinstance(request, google.protobuf.message.Message):
56
56
  request_payload = MessageToJson(request)
57
57
  else:
58
- request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
58
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}"
59
59
 
60
60
  request_metadata = {
61
61
  key: value.decode("utf-8") if isinstance(value, bytes) else value
@@ -90,7 +90,7 @@ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO
90
90
  elif isinstance(result, google.protobuf.message.Message):
91
91
  response_payload = MessageToJson(result)
92
92
  else:
93
- response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
93
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}"
94
94
  grpc_response = {
95
95
  "payload": response_payload,
96
96
  "metadata": metadata,
@@ -206,6 +206,10 @@ class RouteOptimizationGrpcTransport(RouteOptimizationTransport):
206
206
  your own client library.
207
207
  always_use_jwt_access (Optional[bool]): Whether self signed JWT should
208
208
  be used for service account credentials.
209
+ api_audience (Optional[str]): The intended audience for the API calls
210
+ to the service that will be set when using certain 3rd party
211
+ authentication flows. Audience is typically a resource identifier.
212
+ If not set, the host value will be used as a default.
209
213
 
210
214
  Raises:
211
215
  google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
@@ -496,12 +500,12 @@ class RouteOptimizationGrpcTransport(RouteOptimizationTransport):
496
500
  # gRPC handles serialization and deserialization, so we just need
497
501
  # to pass in the functions for each.
498
502
  if "optimize_tours_long_running" not in self._stubs:
499
- self._stubs[
500
- "optimize_tours_long_running"
501
- ] = self._logged_channel.unary_unary(
502
- "/google.maps.routeoptimization.v1.RouteOptimization/OptimizeToursLongRunning",
503
- request_serializer=route_optimization_service.OptimizeToursRequest.serialize,
504
- response_deserializer=operations_pb2.Operation.FromString,
503
+ self._stubs["optimize_tours_long_running"] = (
504
+ self._logged_channel.unary_unary(
505
+ "/google.maps.routeoptimization.v1.RouteOptimization/OptimizeToursLongRunning",
506
+ request_serializer=route_optimization_service.OptimizeToursRequest.serialize,
507
+ response_deserializer=operations_pb2.Operation.FromString,
508
+ )
505
509
  )
506
510
  return self._stubs["optimize_tours_long_running"]
507
511
 
@@ -17,9 +17,12 @@ import inspect
17
17
  import json
18
18
  import logging as std_logging
19
19
  import pickle
20
- from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
21
20
  import warnings
21
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
22
22
 
23
+ import google.protobuf.message
24
+ import grpc # type: ignore
25
+ import proto # type: ignore
23
26
  from google.api_core import exceptions as core_exceptions
24
27
  from google.api_core import gapic_v1, grpc_helpers_async, operations_v1
25
28
  from google.api_core import retry_async as retries
@@ -27,10 +30,7 @@ from google.auth import credentials as ga_credentials # type: ignore
27
30
  from google.auth.transport.grpc import SslCredentials # type: ignore
28
31
  from google.longrunning import operations_pb2 # type: ignore
29
32
  from google.protobuf.json_format import MessageToJson
30
- import google.protobuf.message
31
- import grpc # type: ignore
32
33
  from grpc.experimental import aio # type: ignore
33
- import proto # type: ignore
34
34
 
35
35
  from google.maps.routeoptimization_v1.types import route_optimization_service
36
36
 
@@ -61,7 +61,7 @@ class _LoggingClientAIOInterceptor(
61
61
  elif isinstance(request, google.protobuf.message.Message):
62
62
  request_payload = MessageToJson(request)
63
63
  else:
64
- request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
64
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}"
65
65
 
66
66
  request_metadata = {
67
67
  key: value.decode("utf-8") if isinstance(value, bytes) else value
@@ -96,7 +96,7 @@ class _LoggingClientAIOInterceptor(
96
96
  elif isinstance(result, google.protobuf.message.Message):
97
97
  response_payload = MessageToJson(result)
98
98
  else:
99
- response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
99
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}"
100
100
  grpc_response = {
101
101
  "payload": response_payload,
102
102
  "metadata": metadata,
@@ -257,6 +257,10 @@ class RouteOptimizationGrpcAsyncIOTransport(RouteOptimizationTransport):
257
257
  your own client library.
258
258
  always_use_jwt_access (Optional[bool]): Whether self signed JWT should
259
259
  be used for service account credentials.
260
+ api_audience (Optional[str]): The intended audience for the API calls
261
+ to the service that will be set when using certain 3rd party
262
+ authentication flows. Audience is typically a resource identifier.
263
+ If not set, the host value will be used as a default.
260
264
 
261
265
  Raises:
262
266
  google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
@@ -506,12 +510,12 @@ class RouteOptimizationGrpcAsyncIOTransport(RouteOptimizationTransport):
506
510
  # gRPC handles serialization and deserialization, so we just need
507
511
  # to pass in the functions for each.
508
512
  if "optimize_tours_long_running" not in self._stubs:
509
- self._stubs[
510
- "optimize_tours_long_running"
511
- ] = self._logged_channel.unary_unary(
512
- "/google.maps.routeoptimization.v1.RouteOptimization/OptimizeToursLongRunning",
513
- request_serializer=route_optimization_service.OptimizeToursRequest.serialize,
514
- response_deserializer=operations_pb2.Operation.FromString,
513
+ self._stubs["optimize_tours_long_running"] = (
514
+ self._logged_channel.unary_unary(
515
+ "/google.maps.routeoptimization.v1.RouteOptimization/OptimizeToursLongRunning",
516
+ request_serializer=route_optimization_service.OptimizeToursRequest.serialize,
517
+ response_deserializer=operations_pb2.Operation.FromString,
518
+ )
515
519
  )
516
520
  return self._stubs["optimize_tours_long_running"]
517
521