Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#60)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

docs: list oneofs in docstring
fix(deps): require google-api-core >= 1.28.0
fix(deps): drop packaging dependency

committer: busunkim96@
PiperOrigin-RevId: 406468269

Source-Link: googleapis/googleapis@83d81b0

Source-Link: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Nov 1, 2021
1 parent 5920d66 commit 57a982c
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.service_usage_v1.services.service_usage import pagers
Expand Down Expand Up @@ -166,17 +168,17 @@ def __init__(

async def enable_service(
self,
request: serviceusage.EnableServiceRequest = None,
request: Union[serviceusage.EnableServiceRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Enable a service so that it can be used with a
project.
Args:
request (:class:`google.cloud.service_usage_v1.types.EnableServiceRequest`):
request (Union[google.cloud.service_usage_v1.types.EnableServiceRequest, dict]):
The request object. Request message for the
`EnableService` method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -228,9 +230,9 @@ async def enable_service(

async def disable_service(
self,
request: serviceusage.DisableServiceRequest = None,
request: Union[serviceusage.DisableServiceRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
Expand All @@ -244,7 +246,7 @@ async def disable_service(
currently enabled.
Args:
request (:class:`google.cloud.service_usage_v1.types.DisableServiceRequest`):
request (Union[google.cloud.service_usage_v1.types.DisableServiceRequest, dict]):
The request object. Request message for the
`DisableService` method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -296,17 +298,17 @@ async def disable_service(

async def get_service(
self,
request: serviceusage.GetServiceRequest = None,
request: Union[serviceusage.GetServiceRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Service:
r"""Returns the service configuration and enabled state
for a given service.
Args:
request (:class:`google.cloud.service_usage_v1.types.GetServiceRequest`):
request (Union[google.cloud.service_usage_v1.types.GetServiceRequest, dict]):
The request object. Request message for the `GetService`
method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -346,9 +348,9 @@ async def get_service(

async def list_services(
self,
request: serviceusage.ListServicesRequest = None,
request: Union[serviceusage.ListServicesRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListServicesAsyncPager:
Expand All @@ -368,7 +370,7 @@ async def list_services(
capability.
Args:
request (:class:`google.cloud.service_usage_v1.types.ListServicesRequest`):
request (Union[google.cloud.service_usage_v1.types.ListServicesRequest, dict]):
The request object. Request message for the
`ListServices` method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -416,9 +418,9 @@ async def list_services(

async def batch_enable_services(
self,
request: serviceusage.BatchEnableServicesRequest = None,
request: Union[serviceusage.BatchEnableServicesRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
Expand All @@ -428,7 +430,7 @@ async def batch_enable_services(
``EnableService`` method instead.
Args:
request (:class:`google.cloud.service_usage_v1.types.BatchEnableServicesRequest`):
request (Union[google.cloud.service_usage_v1.types.BatchEnableServicesRequest, dict]):
The request object. Request message for the
`BatchEnableServices` method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -480,17 +482,17 @@ async def batch_enable_services(

async def batch_get_services(
self,
request: serviceusage.BatchGetServicesRequest = None,
request: Union[serviceusage.BatchGetServicesRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> serviceusage.BatchGetServicesResponse:
r"""Returns the service configurations and enabled states
for a given list of services.
Args:
request (:class:`google.cloud.service_usage_v1.types.BatchGetServicesRequest`):
request (Union[google.cloud.service_usage_v1.types.BatchGetServicesRequest, dict]):
The request object. Request message for the
`BatchGetServices` method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down
14 changes: 8 additions & 6 deletions google/cloud/service_usage_v1/services/service_usage/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.service_usage_v1.services.service_usage import pagers
Expand Down Expand Up @@ -342,7 +344,7 @@ def enable_service(
self,
request: Union[serviceusage.EnableServiceRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -405,7 +407,7 @@ def disable_service(
self,
request: Union[serviceusage.DisableServiceRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -474,7 +476,7 @@ def get_service(
self,
request: Union[serviceusage.GetServiceRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Service:
Expand Down Expand Up @@ -525,7 +527,7 @@ def list_services(
self,
request: Union[serviceusage.ListServicesRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListServicesPager:
Expand Down Expand Up @@ -596,7 +598,7 @@ def batch_enable_services(
self,
request: Union[serviceusage.BatchEnableServicesRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -661,7 +663,7 @@ def batch_get_services(
self,
request: Union[serviceusage.BatchGetServicesRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> serviceusage.BatchGetServicesResponse:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import packaging.version
import pkg_resources

import google.auth # type: ignore
Expand All @@ -40,15 +39,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None


class ServiceUsageTransport(abc.ABC):
"""Abstract transport class for ServiceUsage."""
Expand Down Expand Up @@ -102,7 +92,7 @@ def __init__(
host += ":443"
self._host = host

scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
Expand Down Expand Up @@ -135,29 +125,6 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# TODO(busunkim): This method is in the base transport
# to avoid duplicating code across the transport classes. These functions
# should be deleted once the minimum required versions of google-auth is increased.

# TODO: Remove this function once google-auth >= 1.25.0 is required
@classmethod
def _get_scopes_kwargs(
cls, host: str, scopes: Optional[Sequence[str]]
) -> Dict[str, Optional[Sequence[str]]]:
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""

scopes_kwargs = {}

if _GOOGLE_AUTH_VERSION and (
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down Expand Up @@ -193,7 +160,7 @@ def close(self):
raise NotImplementedError()

@property
def operations_client(self) -> operations_v1.OperationsClient:
def operations_client(self):
"""Return the client designed to process long-running operations."""
raise NotImplementedError()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from google.api_core import operations_v1 # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down Expand Up @@ -165,7 +164,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
"proto-plus >= 1.15.0",
"packaging >= 14.3",
]

package_root = os.path.abspath(os.path.dirname(__file__))
Expand Down
4 changes: 1 addition & 3 deletions testing/constraints-3.6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
# 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.26.0
google-api-core==1.28.0
proto-plus==1.15.0
packaging==14.3
google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 si transitively required through google-api-core
Loading

0 comments on commit 57a982c

Please sign in to comment.