Skip to content
This repository was archived by the owner on Nov 14, 2023. It is now read-only.

Commit 8df989c

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#88)
* chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud.<api>.__version__` PiperOrigin-RevId: 484665853 Source-Link: googleapis/googleapis@8eb249a Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add .release-please-manifest.json with correct version * chore: Update to gapic-generator-python 1.6.0 feat(python): Add typing to proto.Message based class attributes feat(python): Snippetgen handling of repeated enum field PiperOrigin-RevId: 487326846 Source-Link: googleapis/googleapis@da380c7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/61ef5762ee6731a0cbbfea22fd0eecee51ab1c8e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: new APIs added to reflect updates to the filestore service - Add ENTERPRISE Tier - Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot - Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare - Add ConnectMode to NetworkConfig (for Private Service Access support) - New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING) - Add SuspensionReason (for KMS related suspension) - Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled PiperOrigin-RevId: 487492758 Source-Link: googleapis/googleapis@5be5981 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.6.1 PiperOrigin-RevId: 488036204 Source-Link: googleapis/googleapis@08f275f Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: fix minor docstring formatting PiperOrigin-RevId: 491440092 Source-Link: googleapis/googleapis@16db2fb Source-Link: https://github.com/googleapis/googleapis-gen/commit/5ac3b73a0af5e1dccee53431e3d5124fd16e3073 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWFjM2I3M2EwYWY1ZTFkY2NlZTUzNDMxZTNkNTEyNGZkMTZlMzA3MyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: googleapis/googleapis@fea4387 Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add gapic_version.py * use templated owlbot.py and autogenerated setup.py * workaround docs issue Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 6bd655d commit 8df989c

26 files changed

+677
-459
lines changed

.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ exclude_lines =
1010
pragma: NO COVER
1111
# Ignore debug-only repr
1212
def __repr__
13-
# Ignore pkg_resources exceptions.
14-
# This is added at the module level as a safeguard for if someone
15-
# generates the code and tries to run it without pip installing. This
16-
# makes it virtually impossible to test properly.
17-
except pkg_resources.DistributionNotFound

.github/release-please.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
releaseType: python
22
handleGHRelease: true
3+
manifest: true

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.1.3"
3+
}

docs/optimization_v1/types.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ Types for Google Cloud Optimization v1 API
33

44
.. automodule:: google.cloud.optimization_v1.types
55
:members:
6-
:undoc-members:
76
:show-inheritance:

google/cloud/optimization/__init__.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
from google.cloud.optimization import gapic_version as package_version
17+
18+
__version__ = package_version.__version__
19+
20+
21+
from google.cloud.optimization_v1.services.fleet_routing.client import (
22+
FleetRoutingClient,
23+
)
24+
from google.cloud.optimization_v1.services.fleet_routing.async_client import (
25+
FleetRoutingAsyncClient,
26+
)
27+
28+
from google.cloud.optimization_v1.types.async_model import AsyncModelMetadata
29+
from google.cloud.optimization_v1.types.async_model import GcsDestination
30+
from google.cloud.optimization_v1.types.async_model import GcsSource
31+
from google.cloud.optimization_v1.types.async_model import InputConfig
32+
from google.cloud.optimization_v1.types.async_model import OutputConfig
33+
from google.cloud.optimization_v1.types.async_model import DataFormat
34+
from google.cloud.optimization_v1.types.fleet_routing import AggregatedMetrics
35+
from google.cloud.optimization_v1.types.fleet_routing import BatchOptimizeToursRequest
36+
from google.cloud.optimization_v1.types.fleet_routing import BatchOptimizeToursResponse
37+
from google.cloud.optimization_v1.types.fleet_routing import BreakRule
38+
from google.cloud.optimization_v1.types.fleet_routing import CapacityQuantity
39+
from google.cloud.optimization_v1.types.fleet_routing import CapacityQuantityInterval
40+
from google.cloud.optimization_v1.types.fleet_routing import DistanceLimit
41+
from google.cloud.optimization_v1.types.fleet_routing import InjectedSolutionConstraint
42+
from google.cloud.optimization_v1.types.fleet_routing import Location
43+
from google.cloud.optimization_v1.types.fleet_routing import OptimizeToursRequest
44+
from google.cloud.optimization_v1.types.fleet_routing import OptimizeToursResponse
45+
from google.cloud.optimization_v1.types.fleet_routing import (
46+
OptimizeToursValidationError,
47+
)
48+
from google.cloud.optimization_v1.types.fleet_routing import Shipment
49+
from google.cloud.optimization_v1.types.fleet_routing import ShipmentModel
50+
from google.cloud.optimization_v1.types.fleet_routing import ShipmentRoute
51+
from google.cloud.optimization_v1.types.fleet_routing import ShipmentTypeIncompatibility
52+
from google.cloud.optimization_v1.types.fleet_routing import ShipmentTypeRequirement
53+
from google.cloud.optimization_v1.types.fleet_routing import SkippedShipment
54+
from google.cloud.optimization_v1.types.fleet_routing import TimeWindow
55+
from google.cloud.optimization_v1.types.fleet_routing import TransitionAttributes
56+
from google.cloud.optimization_v1.types.fleet_routing import Vehicle
57+
from google.cloud.optimization_v1.types.fleet_routing import Waypoint
58+
59+
__all__ = (
60+
"FleetRoutingClient",
61+
"FleetRoutingAsyncClient",
62+
"AsyncModelMetadata",
63+
"GcsDestination",
64+
"GcsSource",
65+
"InputConfig",
66+
"OutputConfig",
67+
"DataFormat",
68+
"AggregatedMetrics",
69+
"BatchOptimizeToursRequest",
70+
"BatchOptimizeToursResponse",
71+
"BreakRule",
72+
"CapacityQuantity",
73+
"CapacityQuantityInterval",
74+
"DistanceLimit",
75+
"InjectedSolutionConstraint",
76+
"Location",
77+
"OptimizeToursRequest",
78+
"OptimizeToursResponse",
79+
"OptimizeToursValidationError",
80+
"Shipment",
81+
"ShipmentModel",
82+
"ShipmentRoute",
83+
"ShipmentTypeIncompatibility",
84+
"ShipmentTypeRequirement",
85+
"SkippedShipment",
86+
"TimeWindow",
87+
"TransitionAttributes",
88+
"Vehicle",
89+
"Waypoint",
90+
)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "1.1.3" # {x-release-please-version}

google/cloud/optimization/py.typed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Marker file for PEP 561.
2+
# The google-cloud-optimization package uses inline types.

google/cloud/optimization_v1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
from google.cloud.optimization import gapic_version as package_version
17+
18+
__version__ = package_version.__version__
19+
1620

1721
from .services.fleet_routing import FleetRoutingClient
1822
from .services.fleet_routing import FleetRoutingAsyncClient
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "1.1.3" # {x-release-please-version}

google/cloud/optimization_v1/services/fleet_routing/async_client.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,19 @@
1616
from collections import OrderedDict
1717
import functools
1818
import re
19-
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
20-
import pkg_resources
19+
from typing import (
20+
Dict,
21+
Mapping,
22+
MutableMapping,
23+
MutableSequence,
24+
Optional,
25+
Sequence,
26+
Tuple,
27+
Type,
28+
Union,
29+
)
30+
31+
from google.cloud.optimization_v1 import gapic_version as package_version
2132

2233
from google.api_core.client_options import ClientOptions
2334
from google.api_core import exceptions as core_exceptions
@@ -177,9 +188,9 @@ def transport(self) -> FleetRoutingTransport:
177188
def __init__(
178189
self,
179190
*,
180-
credentials: ga_credentials.Credentials = None,
191+
credentials: Optional[ga_credentials.Credentials] = None,
181192
transport: Union[str, FleetRoutingTransport] = "grpc_asyncio",
182-
client_options: ClientOptions = None,
193+
client_options: Optional[ClientOptions] = None,
183194
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
184195
) -> None:
185196
"""Instantiates the fleet routing client.
@@ -223,10 +234,10 @@ def __init__(
223234

224235
async def optimize_tours(
225236
self,
226-
request: Union[fleet_routing.OptimizeToursRequest, dict] = None,
237+
request: Optional[Union[fleet_routing.OptimizeToursRequest, dict]] = None,
227238
*,
228239
retry: OptionalRetry = gapic_v1.method.DEFAULT,
229-
timeout: float = None,
240+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
230241
metadata: Sequence[Tuple[str, str]] = (),
231242
) -> fleet_routing.OptimizeToursResponse:
232243
r"""Sends an ``OptimizeToursRequest`` containing a ``ShipmentModel``
@@ -273,7 +284,7 @@ async def sample_optimize_tours():
273284
print(response)
274285
275286
Args:
276-
request (Union[google.cloud.optimization_v1.types.OptimizeToursRequest, dict]):
287+
request (Optional[Union[google.cloud.optimization_v1.types.OptimizeToursRequest, dict]]):
277288
The request object. Request to be given to a tour
278289
optimization solver which defines the shipment model to
279290
solve as well as optimization parameters.
@@ -331,10 +342,10 @@ async def sample_optimize_tours():
331342

332343
async def batch_optimize_tours(
333344
self,
334-
request: Union[fleet_routing.BatchOptimizeToursRequest, dict] = None,
345+
request: Optional[Union[fleet_routing.BatchOptimizeToursRequest, dict]] = None,
335346
*,
336347
retry: OptionalRetry = gapic_v1.method.DEFAULT,
337-
timeout: float = None,
348+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
338349
metadata: Sequence[Tuple[str, str]] = (),
339350
) -> operation_async.AsyncOperation:
340351
r"""Optimizes vehicle tours for one or more ``OptimizeToursRequest``
@@ -379,13 +390,13 @@ async def sample_batch_optimize_tours():
379390
380391
print("Waiting for operation to complete...")
381392
382-
response = await operation.result()
393+
response = (await operation).result()
383394
384395
# Handle the response
385396
print(response)
386397
387398
Args:
388-
request (Union[google.cloud.optimization_v1.types.BatchOptimizeToursRequest, dict]):
399+
request (Optional[Union[google.cloud.optimization_v1.types.BatchOptimizeToursRequest, dict]]):
389400
The request object. Request to batch optimize tours as
390401
an asynchronous operation. Each input file should
391402
contain one `OptimizeToursRequest`, and each output file
@@ -459,14 +470,9 @@ async def __aexit__(self, exc_type, exc, tb):
459470
await self.transport.close()
460471

461472

462-
try:
463-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
464-
gapic_version=pkg_resources.get_distribution(
465-
"google-cloud-optimization",
466-
).version,
467-
)
468-
except pkg_resources.DistributionNotFound:
469-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
473+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
474+
gapic_version=package_version.__version__
475+
)
470476

471477

472478
__all__ = ("FleetRoutingAsyncClient",)

google/cloud/optimization_v1/services/fleet_routing/client.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,20 @@
1616
from collections import OrderedDict
1717
import os
1818
import re
19-
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
20-
import pkg_resources
19+
from typing import (
20+
Dict,
21+
Mapping,
22+
MutableMapping,
23+
MutableSequence,
24+
Optional,
25+
Sequence,
26+
Tuple,
27+
Type,
28+
Union,
29+
cast,
30+
)
31+
32+
from google.cloud.optimization_v1 import gapic_version as package_version
2133

2234
from google.api_core import client_options as client_options_lib
2335
from google.api_core import exceptions as core_exceptions
@@ -57,7 +69,7 @@ class FleetRoutingClientMeta(type):
5769

5870
def get_transport_class(
5971
cls,
60-
label: str = None,
72+
label: Optional[str] = None,
6173
) -> Type[FleetRoutingTransport]:
6274
"""Returns an appropriate transport class.
6375
@@ -333,8 +345,8 @@ def __init__(
333345
self,
334346
*,
335347
credentials: Optional[ga_credentials.Credentials] = None,
336-
transport: Union[str, FleetRoutingTransport, None] = None,
337-
client_options: Optional[client_options_lib.ClientOptions] = None,
348+
transport: Optional[Union[str, FleetRoutingTransport]] = None,
349+
client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
338350
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
339351
) -> None:
340352
"""Instantiates the fleet routing client.
@@ -348,7 +360,7 @@ def __init__(
348360
transport (Union[str, FleetRoutingTransport]): The
349361
transport to use. If set to None, a transport is chosen
350362
automatically.
351-
client_options (google.api_core.client_options.ClientOptions): Custom options for the
363+
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the
352364
client. It won't take effect if a ``transport`` instance is provided.
353365
(1) The ``api_endpoint`` property can be used to override the
354366
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
@@ -378,6 +390,7 @@ def __init__(
378390
client_options = client_options_lib.from_dict(client_options)
379391
if client_options is None:
380392
client_options = client_options_lib.ClientOptions()
393+
client_options = cast(client_options_lib.ClientOptions, client_options)
381394

382395
api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(
383396
client_options
@@ -430,10 +443,10 @@ def __init__(
430443

431444
def optimize_tours(
432445
self,
433-
request: Union[fleet_routing.OptimizeToursRequest, dict] = None,
446+
request: Optional[Union[fleet_routing.OptimizeToursRequest, dict]] = None,
434447
*,
435448
retry: OptionalRetry = gapic_v1.method.DEFAULT,
436-
timeout: float = None,
449+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
437450
metadata: Sequence[Tuple[str, str]] = (),
438451
) -> fleet_routing.OptimizeToursResponse:
439452
r"""Sends an ``OptimizeToursRequest`` containing a ``ShipmentModel``
@@ -530,10 +543,10 @@ def sample_optimize_tours():
530543

531544
def batch_optimize_tours(
532545
self,
533-
request: Union[fleet_routing.BatchOptimizeToursRequest, dict] = None,
546+
request: Optional[Union[fleet_routing.BatchOptimizeToursRequest, dict]] = None,
534547
*,
535548
retry: OptionalRetry = gapic_v1.method.DEFAULT,
536-
timeout: float = None,
549+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
537550
metadata: Sequence[Tuple[str, str]] = (),
538551
) -> operation.Operation:
539552
r"""Optimizes vehicle tours for one or more ``OptimizeToursRequest``
@@ -657,14 +670,9 @@ def __exit__(self, type, value, traceback):
657670
self.transport.close()
658671

659672

660-
try:
661-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
662-
gapic_version=pkg_resources.get_distribution(
663-
"google-cloud-optimization",
664-
).version,
665-
)
666-
except pkg_resources.DistributionNotFound:
667-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
673+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
674+
gapic_version=package_version.__version__
675+
)
668676

669677

670678
__all__ = ("FleetRoutingClient",)

0 commit comments

Comments
 (0)