Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .librarian/generate-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"id": "google-cloud-vision",
"version": "3.12.0",
"apis": [
{
"path": "google/cloud/vision/v1p3beta1",
"service_config": "vision_v1p3beta1.yaml"
},
{
"path": "google/cloud/vision/v1",
"service_config": "vision_v1.yaml"
},
{
"path": "google/cloud/vision/v1p1beta1",
"service_config": "vision_v1p1beta1.yaml"
},
{
"path": "google/cloud/vision/v1p2beta1",
"service_config": "vision_v1p2beta1.yaml"
},
{
"path": "google/cloud/vision/v1p4beta1",
"service_config": "vision_v1p4beta1.yaml"
}
],
Comment on lines +4 to +25
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and easier maintenance, consider sorting the API versions in the apis array. For example, v1, v1p1beta1, v1p2beta1, etc.

"source_roots": [
"packages/google-cloud-vision"
],
"preserve_regex": [
"packages/google-cloud-vision/CHANGELOG.md",
"docs/CHANGELOG.md",
"samples/README.txt",
"samples/snippets/README.rst",
"tests/system"
],
"remove_regex": [
"packages/google-cloud-vision/"
],
"tag_format": "{id}-v{version}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from google.cloud.vision_v1.services.image_annotator.async_client import (
ImageAnnotatorAsyncClient,
)
from google.cloud.vision_v1 import ImageAnnotatorClient
from google.cloud.vision_v1.services.image_annotator.client import ImageAnnotatorClient
from google.cloud.vision_v1.services.product_search.async_client import (
ProductSearchAsyncClient,
)
Expand Down
13 changes: 1 addition & 12 deletions packages/google-cloud-vision/google/cloud/vision_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@
# this code path once we drop support for Python 3.7
import importlib_metadata as metadata

from google.cloud.vision_helpers import VisionHelpers
from google.cloud.vision_helpers.decorators import add_single_feature_methods

from .services.image_annotator import ImageAnnotatorAsyncClient
from .services.image_annotator import ImageAnnotatorClient as IacImageAnnotatorClient
from .services.image_annotator import ImageAnnotatorAsyncClient, ImageAnnotatorClient
from .services.product_search import ProductSearchAsyncClient, ProductSearchClient
from .types.geometry import BoundingPoly, NormalizedVertex, Position, Vertex
from .types.image_annotator import (
Expand Down Expand Up @@ -208,13 +204,6 @@ def _get_version(dependency_name):
+ "https://devguide.python.org/versions/"
)


@add_single_feature_methods
class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient):
__doc__ = IacImageAnnotatorClient.__doc__
Feature = Feature


__all__ = (
"ImageAnnotatorAsyncClient",
"ProductSearchAsyncClient",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,17 +533,16 @@ async def async_batch_annotate_images(
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation_async.AsyncOperation:
r"""Run asynchronous image detection and annotation for a list of
images.

r"""Run asynchronous image detection and annotation for a
list of images.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``OperationMetadata``
(metadata). ``Operation.response`` contains
``AsyncBatchAnnotateImagesResponse`` (results).

This service will write image annotation outputs to json files
in customer GCS bucket, each json file containing
This service will write image annotation outputs to json
files in customer GCS bucket, each json file containing
BatchAnnotateImagesResponse proto.

.. code-block:: python
Expand Down Expand Up @@ -603,11 +602,13 @@ async def sample_async_batch_annotate_images():

Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.

The result type for the operation will be
An object representing a long-running
operation.
The result type for the operation will
be
:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesResponse`
Response to an async batch image annotation request.
Response to an async batch image
annotation request.

"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -676,11 +677,12 @@ async def async_batch_annotate_files(
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation_async.AsyncOperation:
r"""Run asynchronous image detection and annotation for a list of
generic files, such as PDF files, which may contain multiple
pages and multiple images per page. Progress and results can be
retrieved through the ``google.longrunning.Operations``
interface. ``Operation.metadata`` contains ``OperationMetadata``
r"""Run asynchronous image detection and annotation for a
list of generic files, such as PDF files, which may
contain multiple pages and multiple images per page.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``OperationMetadata``
(metadata). ``Operation.response`` contains
``AsyncBatchAnnotateFilesResponse`` (results).

Expand Down Expand Up @@ -735,11 +737,13 @@ async def sample_async_batch_annotate_files():

Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.

The result type for the operation will be
An object representing a long-running
operation.
The result type for the operation will
be
:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse`
Response to an async batch file annotation request.
Response to an async batch file
annotation request.

"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,17 +990,16 @@ def async_batch_annotate_images(
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation.Operation:
r"""Run asynchronous image detection and annotation for a list of
images.

r"""Run asynchronous image detection and annotation for a
list of images.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``OperationMetadata``
(metadata). ``Operation.response`` contains
``AsyncBatchAnnotateImagesResponse`` (results).

This service will write image annotation outputs to json files
in customer GCS bucket, each json file containing
This service will write image annotation outputs to json
files in customer GCS bucket, each json file containing
BatchAnnotateImagesResponse proto.

.. code-block:: python
Expand Down Expand Up @@ -1060,11 +1059,13 @@ def sample_async_batch_annotate_images():

Returns:
google.api_core.operation.Operation:
An object representing a long-running operation.

The result type for the operation will be
An object representing a long-running
operation.
The result type for the operation will
be
:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesResponse`
Response to an async batch image annotation request.
Response to an async batch image
annotation request.

"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -1132,11 +1133,12 @@ def async_batch_annotate_files(
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation.Operation:
r"""Run asynchronous image detection and annotation for a list of
generic files, such as PDF files, which may contain multiple
pages and multiple images per page. Progress and results can be
retrieved through the ``google.longrunning.Operations``
interface. ``Operation.metadata`` contains ``OperationMetadata``
r"""Run asynchronous image detection and annotation for a
list of generic files, such as PDF files, which may
contain multiple pages and multiple images per page.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``OperationMetadata``
(metadata). ``Operation.response`` contains
``AsyncBatchAnnotateFilesResponse`` (results).

Expand Down Expand Up @@ -1191,11 +1193,13 @@ def sample_async_batch_annotate_files():

Returns:
google.api_core.operation.Operation:
An object representing a long-running operation.

The result type for the operation will be
An object representing a long-running
operation.
The result type for the operation will
be
:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse`
Response to an async batch file annotation request.
Response to an async batch file
annotation request.

"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ def __init__(
be used for service account credentials.
"""

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
Expand All @@ -102,11 +100,16 @@ def __init__(

if credentials_file is not None:
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
credentials_file,
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,16 @@ def async_batch_annotate_images(
]:
r"""Return a callable for the async batch annotate images method over gRPC.

Run asynchronous image detection and annotation for a list of
images.

Run asynchronous image detection and annotation for a
list of images.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``OperationMetadata``
(metadata). ``Operation.response`` contains
``AsyncBatchAnnotateImagesResponse`` (results).

This service will write image annotation outputs to json files
in customer GCS bucket, each json file containing
This service will write image annotation outputs to json
files in customer GCS bucket, each json file containing
BatchAnnotateImagesResponse proto.

Returns:
Expand Down Expand Up @@ -458,11 +457,12 @@ def async_batch_annotate_files(
]:
r"""Return a callable for the async batch annotate files method over gRPC.

Run asynchronous image detection and annotation for a list of
generic files, such as PDF files, which may contain multiple
pages and multiple images per page. Progress and results can be
retrieved through the ``google.longrunning.Operations``
interface. ``Operation.metadata`` contains ``OperationMetadata``
Run asynchronous image detection and annotation for a
list of generic files, such as PDF files, which may
contain multiple pages and multiple images per page.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``OperationMetadata``
(metadata). ``Operation.response`` contains
``AsyncBatchAnnotateFilesResponse`` (results).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,16 @@ def async_batch_annotate_images(
]:
r"""Return a callable for the async batch annotate images method over gRPC.

Run asynchronous image detection and annotation for a list of
images.

Run asynchronous image detection and annotation for a
list of images.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``OperationMetadata``
(metadata). ``Operation.response`` contains
``AsyncBatchAnnotateImagesResponse`` (results).

This service will write image annotation outputs to json files
in customer GCS bucket, each json file containing
This service will write image annotation outputs to json
files in customer GCS bucket, each json file containing
BatchAnnotateImagesResponse proto.

Returns:
Expand Down Expand Up @@ -468,11 +467,12 @@ def async_batch_annotate_files(
]:
r"""Return a callable for the async batch annotate files method over gRPC.

Run asynchronous image detection and annotation for a list of
generic files, such as PDF files, which may contain multiple
pages and multiple images per page. Progress and results can be
retrieved through the ``google.longrunning.Operations``
interface. ``Operation.metadata`` contains ``OperationMetadata``
Run asynchronous image detection and annotation for a
list of generic files, such as PDF files, which may
contain multiple pages and multiple images per page.
Progress and results can be retrieved through the
``google.longrunning.Operations`` interface.
``Operation.metadata`` contains ``OperationMetadata``
(metadata). ``Operation.response`` contains
``AsyncBatchAnnotateFilesResponse`` (results).

Expand Down
Loading
Loading