Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

fix: remove workarounds in image_annotator #529

Merged
merged 3 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 0 additions & 12 deletions google/cloud/vision_v1/services/image_annotator/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,6 @@ def sample_batch_annotate_images():
# there are no flattened fields.
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
request = image_annotator.BatchAnnotateImagesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down Expand Up @@ -658,9 +655,6 @@ def sample_batch_annotate_files():
# there are no flattened fields.
if not isinstance(request, image_annotator.BatchAnnotateFilesRequest):
request = image_annotator.BatchAnnotateFilesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AnnotateFileRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down Expand Up @@ -786,9 +780,6 @@ def sample_async_batch_annotate_images():
# there are no flattened fields.
if not isinstance(request, image_annotator.AsyncBatchAnnotateImagesRequest):
request = image_annotator.AsyncBatchAnnotateImagesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down Expand Up @@ -914,9 +905,6 @@ def sample_async_batch_annotate_files():
# there are no flattened fields.
if not isinstance(request, image_annotator.AsyncBatchAnnotateFilesRequest):
request = image_annotator.AsyncBatchAnnotateFilesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,6 @@ def sample_batch_annotate_images():
# there are no flattened fields.
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
request = image_annotator.BatchAnnotateImagesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,6 @@ def sample_batch_annotate_images():
# there are no flattened fields.
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
request = image_annotator.BatchAnnotateImagesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down Expand Up @@ -621,9 +618,6 @@ def sample_async_batch_annotate_files():
# there are no flattened fields.
if not isinstance(request, image_annotator.AsyncBatchAnnotateFilesRequest):
request = image_annotator.AsyncBatchAnnotateFilesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,6 @@ def sample_batch_annotate_images():
# there are no flattened fields.
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
request = image_annotator.BatchAnnotateImagesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down Expand Up @@ -667,9 +664,6 @@ def sample_async_batch_annotate_files():
# there are no flattened fields.
if not isinstance(request, image_annotator.AsyncBatchAnnotateFilesRequest):
request = image_annotator.AsyncBatchAnnotateFilesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down
12 changes: 0 additions & 12 deletions google/cloud/vision_v1p4beta1/services/image_annotator/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,6 @@ def sample_batch_annotate_images():
# there are no flattened fields.
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
request = image_annotator.BatchAnnotateImagesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down Expand Up @@ -658,9 +655,6 @@ def sample_batch_annotate_files():
# there are no flattened fields.
if not isinstance(request, image_annotator.BatchAnnotateFilesRequest):
request = image_annotator.BatchAnnotateFilesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AnnotateFileRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down Expand Up @@ -786,9 +780,6 @@ def sample_async_batch_annotate_images():
# there are no flattened fields.
if not isinstance(request, image_annotator.AsyncBatchAnnotateImagesRequest):
request = image_annotator.AsyncBatchAnnotateImagesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down Expand Up @@ -914,9 +905,6 @@ def sample_async_batch_annotate_files():
# there are no flattened fields.
if not isinstance(request, image_annotator.AsyncBatchAnnotateFilesRequest):
request = image_annotator.AsyncBatchAnnotateFilesRequest(request)
if requests is not None:
for i in range(len(requests)):
requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if requests is not None:
Expand Down
37 changes: 0 additions & 37 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,43 +63,6 @@
"__all__ = (",
)

# Temporary workaround due to bug https://github.com/googleapis/proto-plus-python/issues/135
s.replace(
library / f"google/cloud/vision_{library.name}/services/image_annotator/client.py",
"request = image_annotator.BatchAnnotateImagesRequest\(request\)",
"request = image_annotator.BatchAnnotateImagesRequest(request)\n"
" if requests is not None:\n"
" for i in range(len(requests)):\n"
" requests[i] = image_annotator.AnnotateImageRequest(requests[i])"
)

s.replace(
library / f"google/cloud/vision_{library.name}/services/image_annotator/client.py",
"request = image_annotator.BatchAnnotateFilesRequest\(request\)",
"request = image_annotator.BatchAnnotateFilesRequest(request)\n"
" if requests is not None:\n"
" for i in range(len(requests)):\n"
" requests[i] = image_annotator.AnnotateFileRequest(requests[i])"
)

s.replace(
library / f"google/cloud/vision_{library.name}/services/image_annotator/client.py",
"request = image_annotator.AsyncBatchAnnotateImagesRequest\(request\)",
"request = image_annotator.AsyncBatchAnnotateImagesRequest(request)\n"
" if requests is not None:\n"
" for i in range(len(requests)):\n"
" requests[i] = image_annotator.AnnotateImageRequest(requests[i])"
)

s.replace(
library / f"google/cloud/vision_{library.name}/services/image_annotator/client.py",
"request = image_annotator.AsyncBatchAnnotateFilesRequest\(request\)",
"request = image_annotator.AsyncBatchAnnotateFilesRequest(request)\n"
" if requests is not None:\n"
" for i in range(len(requests)):\n"
" requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])"
)

s.move([library], excludes=["**/gapic_version.py", "README.rst", "docs/index.rst", "docs/vision_v1p1beta1", "google/cloud/vision/__init__.py"])
s.remove_staging_dirs()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down