Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#263)
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 f051f94 commit 4dcb970
Show file tree
Hide file tree
Showing 52 changed files with 464 additions and 1,317 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.vision_v1.types import image_annotator
Expand Down Expand Up @@ -170,18 +172,18 @@ def __init__(

async def batch_annotate_images(
self,
request: image_annotator.BatchAnnotateImagesRequest = None,
request: Union[image_annotator.BatchAnnotateImagesRequest, dict] = None,
*,
requests: Sequence[image_annotator.AnnotateImageRequest] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> image_annotator.BatchAnnotateImagesResponse:
r"""Run image detection and annotation for a batch of
images.
Args:
request (:class:`google.cloud.vision_v1.types.BatchAnnotateImagesRequest`):
request (Union[google.cloud.vision_v1.types.BatchAnnotateImagesRequest, dict]):
The request object. Multiple image annotation requests
are batched into a single service call.
requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]`):
Expand Down Expand Up @@ -246,10 +248,10 @@ async def batch_annotate_images(

async def batch_annotate_files(
self,
request: image_annotator.BatchAnnotateFilesRequest = None,
request: Union[image_annotator.BatchAnnotateFilesRequest, dict] = None,
*,
requests: Sequence[image_annotator.AnnotateFileRequest] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> image_annotator.BatchAnnotateFilesResponse:
Expand All @@ -263,7 +265,7 @@ async def batch_annotate_files(
extracted.
Args:
request (:class:`google.cloud.vision_v1.types.BatchAnnotateFilesRequest`):
request (Union[google.cloud.vision_v1.types.BatchAnnotateFilesRequest, dict]):
The request object. A list of requests to annotate files
using the BatchAnnotateFiles API.
requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]`):
Expand Down Expand Up @@ -328,11 +330,11 @@ async def batch_annotate_files(

async def async_batch_annotate_images(
self,
request: image_annotator.AsyncBatchAnnotateImagesRequest = None,
request: Union[image_annotator.AsyncBatchAnnotateImagesRequest, dict] = None,
*,
requests: Sequence[image_annotator.AnnotateImageRequest] = None,
output_config: image_annotator.OutputConfig = 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 @@ -350,7 +352,7 @@ async def async_batch_annotate_images(
BatchAnnotateImagesResponse proto.
Args:
request (:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest`):
request (Union[google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest, dict]):
The request object. Request for async image annotation
for a list of images.
requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]`):
Expand Down Expand Up @@ -435,10 +437,10 @@ async def async_batch_annotate_images(

async def async_batch_annotate_files(
self,
request: image_annotator.AsyncBatchAnnotateFilesRequest = None,
request: Union[image_annotator.AsyncBatchAnnotateFilesRequest, dict] = None,
*,
requests: Sequence[image_annotator.AsyncAnnotateFileRequest] = 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 @@ -451,7 +453,7 @@ async def async_batch_annotate_files(
``AsyncBatchAnnotateFilesResponse`` (results).
Args:
request (:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest`):
request (Union[google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest, dict]):
The request object. Multiple async file annotation
requests are batched into a single service call.
requests (:class:`Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]`):
Expand Down
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.vision_v1.types import image_annotator
Expand Down Expand Up @@ -373,7 +375,7 @@ def batch_annotate_images(
request: Union[image_annotator.BatchAnnotateImagesRequest, dict] = None,
*,
requests: Sequence[image_annotator.AnnotateImageRequest] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> image_annotator.BatchAnnotateImagesResponse:
Expand Down Expand Up @@ -442,7 +444,7 @@ def batch_annotate_files(
request: Union[image_annotator.BatchAnnotateFilesRequest, dict] = None,
*,
requests: Sequence[image_annotator.AnnotateFileRequest] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> image_annotator.BatchAnnotateFilesResponse:
Expand Down Expand Up @@ -518,7 +520,7 @@ def async_batch_annotate_images(
*,
requests: Sequence[image_annotator.AnnotateImageRequest] = None,
output_config: image_annotator.OutputConfig = 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 @@ -619,7 +621,7 @@ def async_batch_annotate_files(
request: Union[image_annotator.AsyncBatchAnnotateFilesRequest, dict] = None,
*,
requests: Sequence[image_annotator.AsyncAnnotateFileRequest] = 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
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 @@ -37,15 +36,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 ImageAnnotatorTransport(abc.ABC):
"""Abstract transport class for ImageAnnotator."""
Expand Down Expand Up @@ -98,7 +88,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 @@ -131,29 +121,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 @@ -229,7 +196,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 @@ -115,7 +115,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 @@ -162,7 +161,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
Loading

0 comments on commit 4dcb970

Please sign in to comment.