diff --git a/packages/google-cloud-monitoring-metrics-scopes/.coveragerc b/packages/google-cloud-monitoring-metrics-scopes/.coveragerc index 8e754a99c782..810774f214fe 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/.coveragerc +++ b/packages/google-cloud-monitoring-metrics-scopes/.coveragerc @@ -10,8 +10,3 @@ exclude_lines = pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore pkg_resources exceptions. - # This is added at the module level as a safeguard for if someone - # generates the code and tries to run it without pip installing. This - # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound diff --git a/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/gapic_version.py b/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/gapic_version.py new file mode 100644 index 000000000000..82c1d4ca8713 --- /dev/null +++ b/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "1.2.4" # {x-release-please-version} diff --git a/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/async_client.py b/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/async_client.py index d051d55cd478..ac2510f34489 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/async_client.py +++ b/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.monitoring_metrics_scope_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -231,7 +232,7 @@ async def get_metrics_scope( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> metrics_scope.MetricsScope: r"""Returns a specific ``Metrics Scope``. @@ -338,7 +339,7 @@ async def list_metrics_scopes_by_monitored_project( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> metrics_scopes.ListMetricsScopesByMonitoredProjectResponse: r"""Returns a list of every ``Metrics Scope`` that a specific @@ -419,7 +420,7 @@ async def create_monitored_project( parent: Optional[str] = None, monitored_project: Optional[metrics_scope.MonitoredProject] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Adds a ``MonitoredProject`` with the given project ID to the @@ -450,7 +451,7 @@ async def sample_create_monitored_project(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -554,7 +555,7 @@ async def delete_monitored_project( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes a ``MonitoredProject`` from the specified @@ -585,7 +586,7 @@ async def sample_delete_monitored_project(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -686,14 +687,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-monitoring-metrics-scopes", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("MetricsScopesAsyncClient",) diff --git a/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/client.py b/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/client.py index bdf00a508ddd..82e81ff09869 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/client.py +++ b/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.monitoring_metrics_scope_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -465,7 +466,7 @@ def get_metrics_scope( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> metrics_scope.MetricsScope: r"""Returns a specific ``Metrics Scope``. @@ -572,7 +573,7 @@ def list_metrics_scopes_by_monitored_project( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> metrics_scopes.ListMetricsScopesByMonitoredProjectResponse: r"""Returns a list of every ``Metrics Scope`` that a specific @@ -658,7 +659,7 @@ def create_monitored_project( parent: Optional[str] = None, monitored_project: Optional[metrics_scope.MonitoredProject] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Adds a ``MonitoredProject`` with the given project ID to the @@ -793,7 +794,7 @@ def delete_monitored_project( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes a ``MonitoredProject`` from the specified @@ -932,14 +933,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-monitoring-metrics-scopes", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("MetricsScopesClient",) diff --git a/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/transports/base.py b/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/transports/base.py index a27909d019a7..a673122dbc5f 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/transports/base.py +++ b/packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.monitoring_metrics_scope_v1 import gapic_version as package_version from google.cloud.monitoring_metrics_scope_v1.types import metrics_scope, metrics_scopes -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-monitoring-metrics-scopes", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class MetricsScopesTransport(abc.ABC): diff --git a/packages/google-cloud-monitoring-metrics-scopes/release-please-config.json b/packages/google-cloud-monitoring-metrics-scopes/release-please-config.json index 5924a319a4e1..90183a8ac8de 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/release-please-config.json +++ b/packages/google-cloud-monitoring-metrics-scopes/release-please-config.json @@ -4,6 +4,7 @@ ".": { "release-type": "python", "extra-files": [ + "google/cloud/monitoring_metrics_scope_v1/gapic_version.py", "google/cloud/monitoring_metrics_scope/gapic_version.py", { "type": "json", diff --git a/packages/google-cloud-monitoring-metrics-scopes/samples/generated_samples/monitoring_v1_generated_metrics_scopes_create_monitored_project_async.py b/packages/google-cloud-monitoring-metrics-scopes/samples/generated_samples/monitoring_v1_generated_metrics_scopes_create_monitored_project_async.py index 687c96c90bd8..f49395241660 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/samples/generated_samples/monitoring_v1_generated_metrics_scopes_create_monitored_project_async.py +++ b/packages/google-cloud-monitoring-metrics-scopes/samples/generated_samples/monitoring_v1_generated_metrics_scopes_create_monitored_project_async.py @@ -48,7 +48,7 @@ async def sample_create_monitored_project(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/packages/google-cloud-monitoring-metrics-scopes/samples/generated_samples/monitoring_v1_generated_metrics_scopes_delete_monitored_project_async.py b/packages/google-cloud-monitoring-metrics-scopes/samples/generated_samples/monitoring_v1_generated_metrics_scopes_delete_monitored_project_async.py index 8d8fb85e762a..49ab9f4bb53d 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/samples/generated_samples/monitoring_v1_generated_metrics_scopes_delete_monitored_project_async.py +++ b/packages/google-cloud-monitoring-metrics-scopes/samples/generated_samples/monitoring_v1_generated_metrics_scopes_delete_monitored_project_async.py @@ -48,7 +48,7 @@ async def sample_delete_monitored_project(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/packages/google-cloud-monitoring-metrics-scopes/setup.py b/packages/google-cloud-monitoring-metrics-scopes/setup.py index b94e59cc1e76..dff39e5b687c 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/setup.py +++ b/packages/google-cloud-monitoring-metrics-scopes/setup.py @@ -38,7 +38,7 @@ release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-monitoring-metrics-scopes/testing/constraints-3.7.txt b/packages/google-cloud-monitoring-metrics-scopes/testing/constraints-3.7.txt index 6f3158cc2034..6c44adfea7ee 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/testing/constraints-3.7.txt +++ b/packages/google-cloud-monitoring-metrics-scopes/testing/constraints-3.7.txt @@ -4,6 +4,6 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.33.2 +google-api-core==1.34.0 proto-plus==1.22.0 protobuf==3.19.5