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

Commit 6692feb

Browse files
dizcologyparthea
andauthored
fix: remove workarounds in image_annotator (#529)
* feat: remove workaround * regenerate client with workarounds removed --------- Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent d957273 commit 6692feb

File tree

11 files changed

+5
-81
lines changed

11 files changed

+5
-81
lines changed

google/cloud/vision_v1/services/image_annotator/client.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,6 @@ def sample_batch_annotate_images():
551551
# there are no flattened fields.
552552
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
553553
request = image_annotator.BatchAnnotateImagesRequest(request)
554-
if requests is not None:
555-
for i in range(len(requests)):
556-
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
557554
# If we have keyword arguments corresponding to fields on the
558555
# request, apply these.
559556
if requests is not None:
@@ -658,9 +655,6 @@ def sample_batch_annotate_files():
658655
# there are no flattened fields.
659656
if not isinstance(request, image_annotator.BatchAnnotateFilesRequest):
660657
request = image_annotator.BatchAnnotateFilesRequest(request)
661-
if requests is not None:
662-
for i in range(len(requests)):
663-
requests[i] = image_annotator.AnnotateFileRequest(requests[i])
664658
# If we have keyword arguments corresponding to fields on the
665659
# request, apply these.
666660
if requests is not None:
@@ -786,9 +780,6 @@ def sample_async_batch_annotate_images():
786780
# there are no flattened fields.
787781
if not isinstance(request, image_annotator.AsyncBatchAnnotateImagesRequest):
788782
request = image_annotator.AsyncBatchAnnotateImagesRequest(request)
789-
if requests is not None:
790-
for i in range(len(requests)):
791-
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
792783
# If we have keyword arguments corresponding to fields on the
793784
# request, apply these.
794785
if requests is not None:
@@ -914,9 +905,6 @@ def sample_async_batch_annotate_files():
914905
# there are no flattened fields.
915906
if not isinstance(request, image_annotator.AsyncBatchAnnotateFilesRequest):
916907
request = image_annotator.AsyncBatchAnnotateFilesRequest(request)
917-
if requests is not None:
918-
for i in range(len(requests)):
919-
requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])
920908
# If we have keyword arguments corresponding to fields on the
921909
# request, apply these.
922910
if requests is not None:

google/cloud/vision_v1p1beta1/services/image_annotator/client.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,6 @@ def sample_batch_annotate_images():
503503
# there are no flattened fields.
504504
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
505505
request = image_annotator.BatchAnnotateImagesRequest(request)
506-
if requests is not None:
507-
for i in range(len(requests)):
508-
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
509506
# If we have keyword arguments corresponding to fields on the
510507
# request, apply these.
511508
if requests is not None:

google/cloud/vision_v1p2beta1/services/image_annotator/client.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,6 @@ def sample_batch_annotate_images():
505505
# there are no flattened fields.
506506
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
507507
request = image_annotator.BatchAnnotateImagesRequest(request)
508-
if requests is not None:
509-
for i in range(len(requests)):
510-
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
511508
# If we have keyword arguments corresponding to fields on the
512509
# request, apply these.
513510
if requests is not None:
@@ -621,9 +618,6 @@ def sample_async_batch_annotate_files():
621618
# there are no flattened fields.
622619
if not isinstance(request, image_annotator.AsyncBatchAnnotateFilesRequest):
623620
request = image_annotator.AsyncBatchAnnotateFilesRequest(request)
624-
if requests is not None:
625-
for i in range(len(requests)):
626-
requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])
627621
# If we have keyword arguments corresponding to fields on the
628622
# request, apply these.
629623
if requests is not None:

google/cloud/vision_v1p3beta1/services/image_annotator/client.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,6 @@ def sample_batch_annotate_images():
551551
# there are no flattened fields.
552552
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
553553
request = image_annotator.BatchAnnotateImagesRequest(request)
554-
if requests is not None:
555-
for i in range(len(requests)):
556-
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
557554
# If we have keyword arguments corresponding to fields on the
558555
# request, apply these.
559556
if requests is not None:
@@ -667,9 +664,6 @@ def sample_async_batch_annotate_files():
667664
# there are no flattened fields.
668665
if not isinstance(request, image_annotator.AsyncBatchAnnotateFilesRequest):
669666
request = image_annotator.AsyncBatchAnnotateFilesRequest(request)
670-
if requests is not None:
671-
for i in range(len(requests)):
672-
requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])
673667
# If we have keyword arguments corresponding to fields on the
674668
# request, apply these.
675669
if requests is not None:

google/cloud/vision_v1p4beta1/services/image_annotator/client.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,6 @@ def sample_batch_annotate_images():
551551
# there are no flattened fields.
552552
if not isinstance(request, image_annotator.BatchAnnotateImagesRequest):
553553
request = image_annotator.BatchAnnotateImagesRequest(request)
554-
if requests is not None:
555-
for i in range(len(requests)):
556-
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
557554
# If we have keyword arguments corresponding to fields on the
558555
# request, apply these.
559556
if requests is not None:
@@ -658,9 +655,6 @@ def sample_batch_annotate_files():
658655
# there are no flattened fields.
659656
if not isinstance(request, image_annotator.BatchAnnotateFilesRequest):
660657
request = image_annotator.BatchAnnotateFilesRequest(request)
661-
if requests is not None:
662-
for i in range(len(requests)):
663-
requests[i] = image_annotator.AnnotateFileRequest(requests[i])
664658
# If we have keyword arguments corresponding to fields on the
665659
# request, apply these.
666660
if requests is not None:
@@ -786,9 +780,6 @@ def sample_async_batch_annotate_images():
786780
# there are no flattened fields.
787781
if not isinstance(request, image_annotator.AsyncBatchAnnotateImagesRequest):
788782
request = image_annotator.AsyncBatchAnnotateImagesRequest(request)
789-
if requests is not None:
790-
for i in range(len(requests)):
791-
requests[i] = image_annotator.AnnotateImageRequest(requests[i])
792783
# If we have keyword arguments corresponding to fields on the
793784
# request, apply these.
794785
if requests is not None:
@@ -914,9 +905,6 @@ def sample_async_batch_annotate_files():
914905
# there are no flattened fields.
915906
if not isinstance(request, image_annotator.AsyncBatchAnnotateFilesRequest):
916907
request = image_annotator.AsyncBatchAnnotateFilesRequest(request)
917-
if requests is not None:
918-
for i in range(len(requests)):
919-
requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])
920908
# If we have keyword arguments corresponding to fields on the
921909
# request, apply these.
922910
if requests is not None:

owlbot.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -63,43 +63,6 @@
6363
"__all__ = (",
6464
)
6565

66-
# Temporary workaround due to bug https://github.com/googleapis/proto-plus-python/issues/135
67-
s.replace(
68-
library / f"google/cloud/vision_{library.name}/services/image_annotator/client.py",
69-
"request = image_annotator.BatchAnnotateImagesRequest\(request\)",
70-
"request = image_annotator.BatchAnnotateImagesRequest(request)\n"
71-
" if requests is not None:\n"
72-
" for i in range(len(requests)):\n"
73-
" requests[i] = image_annotator.AnnotateImageRequest(requests[i])"
74-
)
75-
76-
s.replace(
77-
library / f"google/cloud/vision_{library.name}/services/image_annotator/client.py",
78-
"request = image_annotator.BatchAnnotateFilesRequest\(request\)",
79-
"request = image_annotator.BatchAnnotateFilesRequest(request)\n"
80-
" if requests is not None:\n"
81-
" for i in range(len(requests)):\n"
82-
" requests[i] = image_annotator.AnnotateFileRequest(requests[i])"
83-
)
84-
85-
s.replace(
86-
library / f"google/cloud/vision_{library.name}/services/image_annotator/client.py",
87-
"request = image_annotator.AsyncBatchAnnotateImagesRequest\(request\)",
88-
"request = image_annotator.AsyncBatchAnnotateImagesRequest(request)\n"
89-
" if requests is not None:\n"
90-
" for i in range(len(requests)):\n"
91-
" requests[i] = image_annotator.AnnotateImageRequest(requests[i])"
92-
)
93-
94-
s.replace(
95-
library / f"google/cloud/vision_{library.name}/services/image_annotator/client.py",
96-
"request = image_annotator.AsyncBatchAnnotateFilesRequest\(request\)",
97-
"request = image_annotator.AsyncBatchAnnotateFilesRequest(request)\n"
98-
" if requests is not None:\n"
99-
" for i in range(len(requests)):\n"
100-
" requests[i] = image_annotator.AsyncAnnotateFileRequest(requests[i])"
101-
)
102-
10366
s.move([library], excludes=["**/gapic_version.py", "README.rst", "docs/index.rst", "docs/vision_v1p1beta1", "google/cloud/vision/__init__.py"])
10467
s.remove_staging_dirs()
10568

samples/generated_samples/snippet_metadata_google.cloud.vision.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-vision",
11-
"version": "3.4.1"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.cloud.vision.v1p1beta1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-vision",
11-
"version": "3.4.1"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.cloud.vision.v1p2beta1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-vision",
11-
"version": "3.4.1"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.cloud.vision.v1p3beta1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-vision",
11-
"version": "3.4.1"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)