diff --git a/vision/google/cloud/vision_v1/gapic/enums.py b/vision/google/cloud/vision_v1/gapic/enums.py index 9797085420ca..6b6cf6f28acb 100644 --- a/vision/google/cloud/vision_v1/gapic/enums.py +++ b/vision/google/cloud/vision_v1/gapic/enums.py @@ -13,8 +13,10 @@ # limitations under the License. """Wrappers for protocol buffer enum types.""" +import enum -class Likelihood(object): + +class Likelihood(enum.IntEnum): """ A bucketized representation of likelihood, which is intended to give clients highly stable results across model upgrades. @@ -37,7 +39,7 @@ class Likelihood(object): class TextAnnotation(object): class DetectedBreak(object): - class BreakType(object): + class BreakType(enum.IntEnum): """ Enum to denote the type of break found. New line, space etc. @@ -59,7 +61,7 @@ class BreakType(object): class Block(object): - class BlockType(object): + class BlockType(enum.IntEnum): """ Type of a block (text, image etc) as identified by OCR. @@ -80,7 +82,7 @@ class BlockType(object): class Feature(object): - class Type(object): + class Type(enum.IntEnum): """ Type of Google Cloud Vision API feature to be extracted. @@ -117,7 +119,7 @@ class Type(object): class FaceAnnotation(object): class Landmark(object): - class Type(object): + class Type(enum.IntEnum): """ Face landmark (feature) type. Left and right are defined from the vantage of the viewer of the image @@ -196,3 +198,22 @@ class Type(object): CHIN_GNATHION = 32 CHIN_LEFT_GONION = 33 CHIN_RIGHT_GONION = 34 + + +class OperationMetadata(object): + class State(enum.IntEnum): + """ + Batch operation states. + + Attributes: + STATE_UNSPECIFIED (int): Invalid. + CREATED (int): Request is received. + RUNNING (int): Request is actively being processed. + DONE (int): The batch processing is done. + CANCELLED (int): The batch processing was cancelled. + """ + STATE_UNSPECIFIED = 0 + CREATED = 1 + RUNNING = 2 + DONE = 3 + CANCELLED = 4 diff --git a/vision/google/cloud/vision_v1/gapic/image_annotator_client.py b/vision/google/cloud/vision_v1/gapic/image_annotator_client.py index d0ca1676f75c..33f19f301b6b 100644 --- a/vision/google/cloud/vision_v1/gapic/image_annotator_client.py +++ b/vision/google/cloud/vision_v1/gapic/image_annotator_client.py @@ -19,10 +19,15 @@ import google.api_core.gapic_v1.config import google.api_core.gapic_v1.method import google.api_core.grpc_helpers +import google.api_core.operation +import google.api_core.operations_v1 +import grpc from google.cloud.vision_v1.gapic import enums from google.cloud.vision_v1.gapic import image_annotator_client_config from google.cloud.vision_v1.proto import image_annotator_pb2 +from google.cloud.vision_v1.proto import image_annotator_pb2_grpc +from google.longrunning import operations_pb2 _GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( 'google-cloud-vision', ).version @@ -81,39 +86,60 @@ def __init__(self, 'exclusive.'.format(self.__class__.__name__), ) # Create the channel. - if channel is None: - channel = google.api_core.grpc_helpers.create_channel( + self.channel = channel + if self.channel is None: + self.channel = google.api_core.grpc_helpers.create_channel( self.SERVICE_ADDRESS, credentials=credentials, scopes=self._DEFAULT_SCOPES, ) # Create the gRPC stubs. - self.image_annotator_stub = ( - image_annotator_pb2.ImageAnnotatorStub(channel)) + self._image_annotator_stub = ( + image_annotator_pb2_grpc.ImageAnnotatorStub(self.channel)) + + # Operations client for methods that return long-running operations + # futures. + self._operations_client = ( + google.api_core.operations_v1.OperationsClient(self.channel)) if client_info is None: client_info = ( google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO) client_info.gapic_version = _GAPIC_LIBRARY_VERSION + self._client_info = client_info # Parse out the default settings for retry and timeout for each RPC # from the client configuration. # (Ordinarily, these are the defaults specified in the `*_config.py` # file next to this one.) - method_configs = google.api_core.gapic_v1.config.parse_method_configs( + self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( client_config['interfaces'][self._INTERFACE_NAME], ) - # Write the "inner API call" methods to the class. - # These are wrapped versions of the gRPC stub methods, with retry and - # timeout configuration applied, called by the public methods on - # this class. - self._batch_annotate_images = google.api_core.gapic_v1.method.wrap_method( - self.image_annotator_stub.BatchAnnotateImages, - default_retry=method_configs['BatchAnnotateImages'].retry, - default_timeout=method_configs['BatchAnnotateImages'].timeout, - client_info=client_info, - ) + self._inner_api_calls = {} + + def _intercept_channel(self, *interceptors): + """ Experimental. Bind gRPC interceptors to the gRPC channel. + + Args: + interceptors (*Union[grpc.UnaryUnaryClientInterceptor, grpc.UnaryStreamingClientInterceptor, grpc.StreamingUnaryClientInterceptor, grpc.StreamingStreamingClientInterceptor]): + Zero or more gRPC interceptors. Interceptors are given control in the order + they are listed. + Raises: + TypeError: If interceptor does not derive from any of + UnaryUnaryClientInterceptor, + UnaryStreamClientInterceptor, + StreamUnaryClientInterceptor, or + StreamStreamClientInterceptor. + """ + self.channel = grpc.intercept_channel(self.channel, *interceptors) + self._image_annotator_stub = ( + image_annotator_pb2_grpc.ImageAnnotatorStub(self.channel)) + # Operations client for methods that return long-running operations + # futures. + self._operations_client = ( + google.api_core.operations_v1.OperationsClient(self.channel)) + self._inner_api_calls.clear() # Service calls def batch_annotate_images(self, @@ -129,6 +155,7 @@ def batch_annotate_images(self, >>> >>> client = vision_v1.ImageAnnotatorClient() >>> + >>> # TODO: Initialize ``requests``: >>> requests = [] >>> >>> response = client.batch_annotate_images(requests) @@ -156,10 +183,96 @@ def batch_annotate_images(self, to a retryable error and retry attempts failed. ValueError: If the parameters are invalid. """ - if metadata is None: - metadata = [] - metadata = list(metadata) + if 'batch_annotate_images' not in self._inner_api_calls: + self._inner_api_calls[ + 'batch_annotate_images'] = google.api_core.gapic_v1.method.wrap_method( + self._image_annotator_stub.BatchAnnotateImages, + default_retry=self._method_configs[ + 'BatchAnnotateImages'].retry, + default_timeout=self._method_configs['BatchAnnotateImages'] + .timeout, + client_info=self._client_info, + ) + request = image_annotator_pb2.BatchAnnotateImagesRequest( requests=requests, ) - return self._batch_annotate_images( + return self._inner_api_calls['batch_annotate_images']( + request, retry=retry, timeout=timeout, metadata=metadata) + + def async_batch_annotate_files( + self, + requests, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None): + """ + 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). + + Example: + >>> from google.cloud import vision_v1 + >>> + >>> client = vision_v1.ImageAnnotatorClient() + >>> + >>> # TODO: Initialize ``requests``: + >>> requests = [] + >>> + >>> response = client.async_batch_annotate_files(requests) + >>> + >>> def callback(operation_future): + ... # Handle result. + ... result = operation_future.result() + >>> + >>> response.add_done_callback(callback) + >>> + >>> # Handle metadata. + >>> metadata = response.metadata() + + Args: + requests (list[Union[dict, ~google.cloud.vision_v1.types.AsyncAnnotateFileRequest]]): Individual async file annotation requests for this batch. + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.vision_v1.types.AsyncAnnotateFileRequest` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.vision_v1.types._OperationFuture` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + if 'async_batch_annotate_files' not in self._inner_api_calls: + self._inner_api_calls[ + 'async_batch_annotate_files'] = google.api_core.gapic_v1.method.wrap_method( + self._image_annotator_stub.AsyncBatchAnnotateFiles, + default_retry=self._method_configs[ + 'AsyncBatchAnnotateFiles'].retry, + default_timeout=self._method_configs[ + 'AsyncBatchAnnotateFiles'].timeout, + client_info=self._client_info, + ) + + request = image_annotator_pb2.AsyncBatchAnnotateFilesRequest( + requests=requests, ) + operation = self._inner_api_calls['async_batch_annotate_files']( request, retry=retry, timeout=timeout, metadata=metadata) + return google.api_core.operation.from_gapic( + operation, + self._operations_client, + image_annotator_pb2.AsyncBatchAnnotateFilesResponse, + metadata_type=image_annotator_pb2.OperationMetadata, + ) diff --git a/vision/google/cloud/vision_v1/gapic/image_annotator_client_config.py b/vision/google/cloud/vision_v1/gapic/image_annotator_client_config.py index 98a2c35cb96c..dfadcc2d2e96 100644 --- a/vision/google/cloud/vision_v1/gapic/image_annotator_client_config.py +++ b/vision/google/cloud/vision_v1/gapic/image_annotator_client_config.py @@ -21,6 +21,11 @@ "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" + }, + "AsyncBatchAnnotateFiles": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" } } } diff --git a/vision/google/cloud/vision_v1/proto/geometry_pb2.py b/vision/google/cloud/vision_v1/proto/geometry_pb2.py index d17df9ecc247..23d4ffaf2d01 100644 --- a/vision/google/cloud/vision_v1/proto/geometry_pb2.py +++ b/vision/google/cloud/vision_v1/proto/geometry_pb2.py @@ -19,9 +19,8 @@ name='google/cloud/vision_v1/proto/geometry.proto', package='google.cloud.vision.v1', syntax='proto3', - serialized_pb=_b('\n+google/cloud/vision_v1/proto/geometry.proto\x12\x16google.cloud.vision.v1\"\x1e\n\x06Vertex\x12\t\n\x01x\x18\x01 \x01(\x05\x12\t\n\x01y\x18\x02 \x01(\x05\"@\n\x0c\x42oundingPoly\x12\x30\n\x08vertices\x18\x01 \x03(\x0b\x32\x1e.google.cloud.vision.v1.Vertex\"+\n\x08Position\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\x42n\n\x1a\x63om.google.cloud.vision.v1B\rGeometryProtoP\x01Z\n\x10\x66\x64_bounding_poly\x18\x02 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12\x42\n\tlandmarks\x18\x03 \x03(\x0b\x32/.google.cloud.vision.v1.FaceAnnotation.Landmark\x12\x12\n\nroll_angle\x18\x04 \x01(\x02\x12\x11\n\tpan_angle\x18\x05 \x01(\x02\x12\x12\n\ntilt_angle\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tection_confidence\x18\x07 \x01(\x02\x12\x1e\n\x16landmarking_confidence\x18\x08 \x01(\x02\x12:\n\x0ejoy_likelihood\x18\t \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12=\n\x11sorrow_likelihood\x18\n \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12<\n\x10\x61nger_likelihood\x18\x0b \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12?\n\x13surprise_likelihood\x18\x0c \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x44\n\x18under_exposed_likelihood\x18\r \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12>\n\x12\x62lurred_likelihood\x18\x0e \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12?\n\x13headwear_likelihood\x18\x0f \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x1a\xb9\x07\n\x08Landmark\x12\x42\n\x04type\x18\x03 \x01(\x0e\x32\x34.google.cloud.vision.v1.FaceAnnotation.Landmark.Type\x12\x32\n\x08position\x18\x04 \x01(\x0b\x32 .google.cloud.vision.v1.Position\"\xb4\x06\n\x04Type\x12\x14\n\x10UNKNOWN_LANDMARK\x10\x00\x12\x0c\n\x08LEFT_EYE\x10\x01\x12\r\n\tRIGHT_EYE\x10\x02\x12\x18\n\x14LEFT_OF_LEFT_EYEBROW\x10\x03\x12\x19\n\x15RIGHT_OF_LEFT_EYEBROW\x10\x04\x12\x19\n\x15LEFT_OF_RIGHT_EYEBROW\x10\x05\x12\x1a\n\x16RIGHT_OF_RIGHT_EYEBROW\x10\x06\x12\x19\n\x15MIDPOINT_BETWEEN_EYES\x10\x07\x12\x0c\n\x08NOSE_TIP\x10\x08\x12\r\n\tUPPER_LIP\x10\t\x12\r\n\tLOWER_LIP\x10\n\x12\x0e\n\nMOUTH_LEFT\x10\x0b\x12\x0f\n\x0bMOUTH_RIGHT\x10\x0c\x12\x10\n\x0cMOUTH_CENTER\x10\r\x12\x15\n\x11NOSE_BOTTOM_RIGHT\x10\x0e\x12\x14\n\x10NOSE_BOTTOM_LEFT\x10\x0f\x12\x16\n\x12NOSE_BOTTOM_CENTER\x10\x10\x12\x19\n\x15LEFT_EYE_TOP_BOUNDARY\x10\x11\x12\x19\n\x15LEFT_EYE_RIGHT_CORNER\x10\x12\x12\x1c\n\x18LEFT_EYE_BOTTOM_BOUNDARY\x10\x13\x12\x18\n\x14LEFT_EYE_LEFT_CORNER\x10\x14\x12\x1a\n\x16RIGHT_EYE_TOP_BOUNDARY\x10\x15\x12\x1a\n\x16RIGHT_EYE_RIGHT_CORNER\x10\x16\x12\x1d\n\x19RIGHT_EYE_BOTTOM_BOUNDARY\x10\x17\x12\x19\n\x15RIGHT_EYE_LEFT_CORNER\x10\x18\x12\x1f\n\x1bLEFT_EYEBROW_UPPER_MIDPOINT\x10\x19\x12 \n\x1cRIGHT_EYEBROW_UPPER_MIDPOINT\x10\x1a\x12\x14\n\x10LEFT_EAR_TRAGION\x10\x1b\x12\x15\n\x11RIGHT_EAR_TRAGION\x10\x1c\x12\x12\n\x0eLEFT_EYE_PUPIL\x10\x1d\x12\x13\n\x0fRIGHT_EYE_PUPIL\x10\x1e\x12\x15\n\x11\x46OREHEAD_GLABELLA\x10\x1f\x12\x11\n\rCHIN_GNATHION\x10 \x12\x14\n\x10\x43HIN_LEFT_GONION\x10!\x12\x15\n\x11\x43HIN_RIGHT_GONION\x10\"\"4\n\x0cLocationInfo\x12$\n\x07lat_lng\x18\x01 \x01(\x0b\x32\x13.google.type.LatLng\"=\n\x08Property\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\x12\x14\n\x0cuint64_value\x18\x03 \x01(\x04\"\xa7\x02\n\x10\x45ntityAnnotation\x12\x0b\n\x03mid\x18\x01 \x01(\t\x12\x0e\n\x06locale\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\r\n\x05score\x18\x04 \x01(\x02\x12\x12\n\nconfidence\x18\x05 \x01(\x02\x12\x12\n\ntopicality\x18\x06 \x01(\x02\x12;\n\rbounding_poly\x18\x07 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12\x37\n\tlocations\x18\x08 \x03(\x0b\x32$.google.cloud.vision.v1.LocationInfo\x12\x34\n\nproperties\x18\t \x03(\x0b\x32 .google.cloud.vision.v1.Property\"\x99\x02\n\x14SafeSearchAnnotation\x12\x31\n\x05\x61\x64ult\x18\x01 \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x31\n\x05spoof\x18\x02 \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x33\n\x07medical\x18\x03 \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x34\n\x08violence\x18\x04 \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x30\n\x04racy\x18\t \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\"a\n\x0bLatLongRect\x12(\n\x0bmin_lat_lng\x18\x01 \x01(\x0b\x32\x13.google.type.LatLng\x12(\n\x0bmax_lat_lng\x18\x02 \x01(\x0b\x32\x13.google.type.LatLng\"U\n\tColorInfo\x12!\n\x05\x63olor\x18\x01 \x01(\x0b\x32\x12.google.type.Color\x12\r\n\x05score\x18\x02 \x01(\x02\x12\x16\n\x0epixel_fraction\x18\x03 \x01(\x02\"M\n\x18\x44ominantColorsAnnotation\x12\x31\n\x06\x63olors\x18\x01 \x03(\x0b\x32!.google.cloud.vision.v1.ColorInfo\"\\\n\x0fImageProperties\x12I\n\x0f\x64ominant_colors\x18\x01 \x01(\x0b\x32\x30.google.cloud.vision.v1.DominantColorsAnnotation\"x\n\x08\x43ropHint\x12;\n\rbounding_poly\x18\x01 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x1b\n\x13importance_fraction\x18\x03 \x01(\x02\"K\n\x13\x43ropHintsAnnotation\x12\x34\n\ncrop_hints\x18\x01 \x03(\x0b\x32 .google.cloud.vision.v1.CropHint\"(\n\x0f\x43ropHintsParams\x12\x15\n\raspect_ratios\x18\x01 \x03(\x02\"1\n\x12WebDetectionParams\x12\x1b\n\x13include_geo_results\x18\x02 \x01(\x08\"\xf0\x01\n\x0cImageContext\x12:\n\rlat_long_rect\x18\x01 \x01(\x0b\x32#.google.cloud.vision.v1.LatLongRect\x12\x16\n\x0elanguage_hints\x18\x02 \x03(\t\x12\x42\n\x11\x63rop_hints_params\x18\x04 \x01(\x0b\x32\'.google.cloud.vision.v1.CropHintsParams\x12H\n\x14web_detection_params\x18\x06 \x01(\x0b\x32*.google.cloud.vision.v1.WebDetectionParams\"\xb4\x01\n\x14\x41nnotateImageRequest\x12,\n\x05image\x18\x01 \x01(\x0b\x32\x1d.google.cloud.vision.v1.Image\x12\x31\n\x08\x66\x65\x61tures\x18\x02 \x03(\x0b\x32\x1f.google.cloud.vision.v1.Feature\x12;\n\rimage_context\x18\x03 \x01(\x0b\x32$.google.cloud.vision.v1.ImageContext\"\xfc\x05\n\x15\x41nnotateImageResponse\x12@\n\x10\x66\x61\x63\x65_annotations\x18\x01 \x03(\x0b\x32&.google.cloud.vision.v1.FaceAnnotation\x12\x46\n\x14landmark_annotations\x18\x02 \x03(\x0b\x32(.google.cloud.vision.v1.EntityAnnotation\x12\x42\n\x10logo_annotations\x18\x03 \x03(\x0b\x32(.google.cloud.vision.v1.EntityAnnotation\x12\x43\n\x11label_annotations\x18\x04 \x03(\x0b\x32(.google.cloud.vision.v1.EntityAnnotation\x12\x42\n\x10text_annotations\x18\x05 \x03(\x0b\x32(.google.cloud.vision.v1.EntityAnnotation\x12\x44\n\x14\x66ull_text_annotation\x18\x0c \x01(\x0b\x32&.google.cloud.vision.v1.TextAnnotation\x12L\n\x16safe_search_annotation\x18\x06 \x01(\x0b\x32,.google.cloud.vision.v1.SafeSearchAnnotation\x12L\n\x1bimage_properties_annotation\x18\x08 \x01(\x0b\x32\'.google.cloud.vision.v1.ImageProperties\x12J\n\x15\x63rop_hints_annotation\x18\x0b \x01(\x0b\x32+.google.cloud.vision.v1.CropHintsAnnotation\x12;\n\rweb_detection\x18\r \x01(\x0b\x32$.google.cloud.vision.v1.WebDetection\x12!\n\x05\x65rror\x18\t \x01(\x0b\x32\x12.google.rpc.Status\"\\\n\x1a\x42\x61tchAnnotateImagesRequest\x12>\n\x08requests\x18\x01 \x03(\x0b\x32,.google.cloud.vision.v1.AnnotateImageRequest\"_\n\x1b\x42\x61tchAnnotateImagesResponse\x12@\n\tresponses\x18\x01 \x03(\x0b\x32-.google.cloud.vision.v1.AnnotateImageResponse*e\n\nLikelihood\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x11\n\rVERY_UNLIKELY\x10\x01\x12\x0c\n\x08UNLIKELY\x10\x02\x12\x0c\n\x08POSSIBLE\x10\x03\x12\n\n\x06LIKELY\x10\x04\x12\x0f\n\x0bVERY_LIKELY\x10\x05\x32\xb1\x01\n\x0eImageAnnotator\x12\x9e\x01\n\x13\x42\x61tchAnnotateImages\x12\x32.google.cloud.vision.v1.BatchAnnotateImagesRequest\x1a\x33.google.cloud.vision.v1.BatchAnnotateImagesResponse\"\x1e\x82\xd3\xe4\x93\x02\x18\"\x13/v1/images:annotate:\x01*Bt\n\x1a\x63om.google.cloud.vision.v1B\x13ImageAnnotatorProtoP\x01Z\n\x10\x66\x64_bounding_poly\x18\x02 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12\x42\n\tlandmarks\x18\x03 \x03(\x0b\x32/.google.cloud.vision.v1.FaceAnnotation.Landmark\x12\x12\n\nroll_angle\x18\x04 \x01(\x02\x12\x11\n\tpan_angle\x18\x05 \x01(\x02\x12\x12\n\ntilt_angle\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tection_confidence\x18\x07 \x01(\x02\x12\x1e\n\x16landmarking_confidence\x18\x08 \x01(\x02\x12:\n\x0ejoy_likelihood\x18\t \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12=\n\x11sorrow_likelihood\x18\n \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12<\n\x10\x61nger_likelihood\x18\x0b \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12?\n\x13surprise_likelihood\x18\x0c \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x44\n\x18under_exposed_likelihood\x18\r \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12>\n\x12\x62lurred_likelihood\x18\x0e \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12?\n\x13headwear_likelihood\x18\x0f \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x1a\xb9\x07\n\x08Landmark\x12\x42\n\x04type\x18\x03 \x01(\x0e\x32\x34.google.cloud.vision.v1.FaceAnnotation.Landmark.Type\x12\x32\n\x08position\x18\x04 \x01(\x0b\x32 .google.cloud.vision.v1.Position\"\xb4\x06\n\x04Type\x12\x14\n\x10UNKNOWN_LANDMARK\x10\x00\x12\x0c\n\x08LEFT_EYE\x10\x01\x12\r\n\tRIGHT_EYE\x10\x02\x12\x18\n\x14LEFT_OF_LEFT_EYEBROW\x10\x03\x12\x19\n\x15RIGHT_OF_LEFT_EYEBROW\x10\x04\x12\x19\n\x15LEFT_OF_RIGHT_EYEBROW\x10\x05\x12\x1a\n\x16RIGHT_OF_RIGHT_EYEBROW\x10\x06\x12\x19\n\x15MIDPOINT_BETWEEN_EYES\x10\x07\x12\x0c\n\x08NOSE_TIP\x10\x08\x12\r\n\tUPPER_LIP\x10\t\x12\r\n\tLOWER_LIP\x10\n\x12\x0e\n\nMOUTH_LEFT\x10\x0b\x12\x0f\n\x0bMOUTH_RIGHT\x10\x0c\x12\x10\n\x0cMOUTH_CENTER\x10\r\x12\x15\n\x11NOSE_BOTTOM_RIGHT\x10\x0e\x12\x14\n\x10NOSE_BOTTOM_LEFT\x10\x0f\x12\x16\n\x12NOSE_BOTTOM_CENTER\x10\x10\x12\x19\n\x15LEFT_EYE_TOP_BOUNDARY\x10\x11\x12\x19\n\x15LEFT_EYE_RIGHT_CORNER\x10\x12\x12\x1c\n\x18LEFT_EYE_BOTTOM_BOUNDARY\x10\x13\x12\x18\n\x14LEFT_EYE_LEFT_CORNER\x10\x14\x12\x1a\n\x16RIGHT_EYE_TOP_BOUNDARY\x10\x15\x12\x1a\n\x16RIGHT_EYE_RIGHT_CORNER\x10\x16\x12\x1d\n\x19RIGHT_EYE_BOTTOM_BOUNDARY\x10\x17\x12\x19\n\x15RIGHT_EYE_LEFT_CORNER\x10\x18\x12\x1f\n\x1bLEFT_EYEBROW_UPPER_MIDPOINT\x10\x19\x12 \n\x1cRIGHT_EYEBROW_UPPER_MIDPOINT\x10\x1a\x12\x14\n\x10LEFT_EAR_TRAGION\x10\x1b\x12\x15\n\x11RIGHT_EAR_TRAGION\x10\x1c\x12\x12\n\x0eLEFT_EYE_PUPIL\x10\x1d\x12\x13\n\x0fRIGHT_EYE_PUPIL\x10\x1e\x12\x15\n\x11\x46OREHEAD_GLABELLA\x10\x1f\x12\x11\n\rCHIN_GNATHION\x10 \x12\x14\n\x10\x43HIN_LEFT_GONION\x10!\x12\x15\n\x11\x43HIN_RIGHT_GONION\x10\"\"4\n\x0cLocationInfo\x12$\n\x07lat_lng\x18\x01 \x01(\x0b\x32\x13.google.type.LatLng\"=\n\x08Property\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\x12\x14\n\x0cuint64_value\x18\x03 \x01(\x04\"\xa7\x02\n\x10\x45ntityAnnotation\x12\x0b\n\x03mid\x18\x01 \x01(\t\x12\x0e\n\x06locale\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\r\n\x05score\x18\x04 \x01(\x02\x12\x12\n\nconfidence\x18\x05 \x01(\x02\x12\x12\n\ntopicality\x18\x06 \x01(\x02\x12;\n\rbounding_poly\x18\x07 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12\x37\n\tlocations\x18\x08 \x03(\x0b\x32$.google.cloud.vision.v1.LocationInfo\x12\x34\n\nproperties\x18\t \x03(\x0b\x32 .google.cloud.vision.v1.Property\"\x99\x02\n\x14SafeSearchAnnotation\x12\x31\n\x05\x61\x64ult\x18\x01 \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x31\n\x05spoof\x18\x02 \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x33\n\x07medical\x18\x03 \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x34\n\x08violence\x18\x04 \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\x12\x30\n\x04racy\x18\t \x01(\x0e\x32\".google.cloud.vision.v1.Likelihood\"a\n\x0bLatLongRect\x12(\n\x0bmin_lat_lng\x18\x01 \x01(\x0b\x32\x13.google.type.LatLng\x12(\n\x0bmax_lat_lng\x18\x02 \x01(\x0b\x32\x13.google.type.LatLng\"U\n\tColorInfo\x12!\n\x05\x63olor\x18\x01 \x01(\x0b\x32\x12.google.type.Color\x12\r\n\x05score\x18\x02 \x01(\x02\x12\x16\n\x0epixel_fraction\x18\x03 \x01(\x02\"M\n\x18\x44ominantColorsAnnotation\x12\x31\n\x06\x63olors\x18\x01 \x03(\x0b\x32!.google.cloud.vision.v1.ColorInfo\"\\\n\x0fImageProperties\x12I\n\x0f\x64ominant_colors\x18\x01 \x01(\x0b\x32\x30.google.cloud.vision.v1.DominantColorsAnnotation\"x\n\x08\x43ropHint\x12;\n\rbounding_poly\x18\x01 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x1b\n\x13importance_fraction\x18\x03 \x01(\x02\"K\n\x13\x43ropHintsAnnotation\x12\x34\n\ncrop_hints\x18\x01 \x03(\x0b\x32 .google.cloud.vision.v1.CropHint\"(\n\x0f\x43ropHintsParams\x12\x15\n\raspect_ratios\x18\x01 \x03(\x02\"1\n\x12WebDetectionParams\x12\x1b\n\x13include_geo_results\x18\x02 \x01(\x08\"\xf0\x01\n\x0cImageContext\x12:\n\rlat_long_rect\x18\x01 \x01(\x0b\x32#.google.cloud.vision.v1.LatLongRect\x12\x16\n\x0elanguage_hints\x18\x02 \x03(\t\x12\x42\n\x11\x63rop_hints_params\x18\x04 \x01(\x0b\x32\'.google.cloud.vision.v1.CropHintsParams\x12H\n\x14web_detection_params\x18\x06 \x01(\x0b\x32*.google.cloud.vision.v1.WebDetectionParams\"\xb4\x01\n\x14\x41nnotateImageRequest\x12,\n\x05image\x18\x01 \x01(\x0b\x32\x1d.google.cloud.vision.v1.Image\x12\x31\n\x08\x66\x65\x61tures\x18\x02 \x03(\x0b\x32\x1f.google.cloud.vision.v1.Feature\x12;\n\rimage_context\x18\x03 \x01(\x0b\x32$.google.cloud.vision.v1.ImageContext\":\n\x16ImageAnnotationContext\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x13\n\x0bpage_number\x18\x02 \x01(\x05\"\xbd\x06\n\x15\x41nnotateImageResponse\x12@\n\x10\x66\x61\x63\x65_annotations\x18\x01 \x03(\x0b\x32&.google.cloud.vision.v1.FaceAnnotation\x12\x46\n\x14landmark_annotations\x18\x02 \x03(\x0b\x32(.google.cloud.vision.v1.EntityAnnotation\x12\x42\n\x10logo_annotations\x18\x03 \x03(\x0b\x32(.google.cloud.vision.v1.EntityAnnotation\x12\x43\n\x11label_annotations\x18\x04 \x03(\x0b\x32(.google.cloud.vision.v1.EntityAnnotation\x12\x42\n\x10text_annotations\x18\x05 \x03(\x0b\x32(.google.cloud.vision.v1.EntityAnnotation\x12\x44\n\x14\x66ull_text_annotation\x18\x0c \x01(\x0b\x32&.google.cloud.vision.v1.TextAnnotation\x12L\n\x16safe_search_annotation\x18\x06 \x01(\x0b\x32,.google.cloud.vision.v1.SafeSearchAnnotation\x12L\n\x1bimage_properties_annotation\x18\x08 \x01(\x0b\x32\'.google.cloud.vision.v1.ImageProperties\x12J\n\x15\x63rop_hints_annotation\x18\x0b \x01(\x0b\x32+.google.cloud.vision.v1.CropHintsAnnotation\x12;\n\rweb_detection\x18\r \x01(\x0b\x32$.google.cloud.vision.v1.WebDetection\x12!\n\x05\x65rror\x18\t \x01(\x0b\x32\x12.google.rpc.Status\x12?\n\x07\x63ontext\x18\x15 \x01(\x0b\x32..google.cloud.vision.v1.ImageAnnotationContext\"\x93\x01\n\x14\x41nnotateFileResponse\x12\x39\n\x0cinput_config\x18\x01 \x01(\x0b\x32#.google.cloud.vision.v1.InputConfig\x12@\n\tresponses\x18\x02 \x03(\x0b\x32-.google.cloud.vision.v1.AnnotateImageResponse\"\\\n\x1a\x42\x61tchAnnotateImagesRequest\x12>\n\x08requests\x18\x01 \x03(\x0b\x32,.google.cloud.vision.v1.AnnotateImageRequest\"_\n\x1b\x42\x61tchAnnotateImagesResponse\x12@\n\tresponses\x18\x01 \x03(\x0b\x32-.google.cloud.vision.v1.AnnotateImageResponse\"\x82\x02\n\x18\x41syncAnnotateFileRequest\x12\x39\n\x0cinput_config\x18\x01 \x01(\x0b\x32#.google.cloud.vision.v1.InputConfig\x12\x31\n\x08\x66\x65\x61tures\x18\x02 \x03(\x0b\x32\x1f.google.cloud.vision.v1.Feature\x12;\n\rimage_context\x18\x03 \x01(\x0b\x32$.google.cloud.vision.v1.ImageContext\x12;\n\routput_config\x18\x04 \x01(\x0b\x32$.google.cloud.vision.v1.OutputConfig\"X\n\x19\x41syncAnnotateFileResponse\x12;\n\routput_config\x18\x01 \x01(\x0b\x32$.google.cloud.vision.v1.OutputConfig\"d\n\x1e\x41syncBatchAnnotateFilesRequest\x12\x42\n\x08requests\x18\x01 \x03(\x0b\x32\x30.google.cloud.vision.v1.AsyncAnnotateFileRequest\"g\n\x1f\x41syncBatchAnnotateFilesResponse\x12\x44\n\tresponses\x18\x01 \x03(\x0b\x32\x31.google.cloud.vision.v1.AsyncAnnotateFileResponse\"W\n\x0bInputConfig\x12\x35\n\ngcs_source\x18\x01 \x01(\x0b\x32!.google.cloud.vision.v1.GcsSource\x12\x11\n\tmime_type\x18\x02 \x01(\t\"c\n\x0cOutputConfig\x12?\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32&.google.cloud.vision.v1.GcsDestination\x12\x12\n\nbatch_size\x18\x02 \x01(\x05\"\x18\n\tGcsSource\x12\x0b\n\x03uri\x18\x01 \x01(\t\"\x1d\n\x0eGcsDestination\x12\x0b\n\x03uri\x18\x01 \x01(\t\"\x88\x02\n\x11OperationMetadata\x12>\n\x05state\x18\x01 \x01(\x0e\x32/.google.cloud.vision.v1.OperationMetadata.State\x12/\n\x0b\x63reate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"Q\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x43REATED\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\x08\n\x04\x44ONE\x10\x03\x12\r\n\tCANCELLED\x10\x04*e\n\nLikelihood\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x11\n\rVERY_UNLIKELY\x10\x01\x12\x0c\n\x08UNLIKELY\x10\x02\x12\x0c\n\x08POSSIBLE\x10\x03\x12\n\n\x06LIKELY\x10\x04\x12\x0f\n\x0bVERY_LIKELY\x10\x05\x32\xcd\x02\n\x0eImageAnnotator\x12\x9e\x01\n\x13\x42\x61tchAnnotateImages\x12\x32.google.cloud.vision.v1.BatchAnnotateImagesRequest\x1a\x33.google.cloud.vision.v1.BatchAnnotateImagesResponse\"\x1e\x82\xd3\xe4\x93\x02\x18\"\x13/v1/images:annotate:\x01*\x12\x99\x01\n\x17\x41syncBatchAnnotateFiles\x12\x36.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest\x1a\x1d.google.longrunning.Operation\"\'\x82\xd3\xe4\x93\x02!\"\x1c/v1/files:asyncBatchAnnotate:\x01*Bt\n\x1a\x63om.google.cloud.vision.v1B\x13ImageAnnotatorProtoP\x01Z=0.15.0.""" - """Service that performs Google Cloud Vision API detection tasks over client - images, such as face, landmark, logo, label, and text detection. The - ImageAnnotator service returns detected entities from the images. - """ - def BatchAnnotateImages(self, request, context): - """Run image detection and annotation for a batch of images. - """ - context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) - - - class BetaImageAnnotatorStub(object): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This class was generated - only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" - """Service that performs Google Cloud Vision API detection tasks over client - images, such as face, landmark, logo, label, and text detection. The - ImageAnnotator service returns detected entities from the images. - """ - def BatchAnnotateImages(self, request, timeout, metadata=None, with_call=False, protocol_options=None): - """Run image detection and annotation for a batch of images. - """ - raise NotImplementedError() - BatchAnnotateImages.future = None - - - def beta_create_ImageAnnotator_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This function was - generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" - request_deserializers = { - ('google.cloud.vision.v1.ImageAnnotator', 'BatchAnnotateImages'): BatchAnnotateImagesRequest.FromString, - } - response_serializers = { - ('google.cloud.vision.v1.ImageAnnotator', 'BatchAnnotateImages'): BatchAnnotateImagesResponse.SerializeToString, - } - method_implementations = { - ('google.cloud.vision.v1.ImageAnnotator', 'BatchAnnotateImages'): face_utilities.unary_unary_inline(servicer.BatchAnnotateImages), - } - server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) - return beta_implementations.server(method_implementations, options=server_options) - - - def beta_create_ImageAnnotator_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This function was - generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" - request_serializers = { - ('google.cloud.vision.v1.ImageAnnotator', 'BatchAnnotateImages'): BatchAnnotateImagesRequest.SerializeToString, - } - response_deserializers = { - ('google.cloud.vision.v1.ImageAnnotator', 'BatchAnnotateImages'): BatchAnnotateImagesResponse.FromString, - } - cardinalities = { - 'BatchAnnotateImages': cardinality.Cardinality.UNARY_UNARY, - } - stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) - return beta_implementations.dynamic_stub(channel, 'google.cloud.vision.v1.ImageAnnotator', cardinalities, options=stub_options) -except ImportError: - pass + +_IMAGEANNOTATOR = _descriptor.ServiceDescriptor( + name='ImageAnnotator', + full_name='google.cloud.vision.v1.ImageAnnotator', + file=DESCRIPTOR, + index=0, + options=None, + serialized_start=6809, + serialized_end=7142, + methods=[ + _descriptor.MethodDescriptor( + name='BatchAnnotateImages', + full_name='google.cloud.vision.v1.ImageAnnotator.BatchAnnotateImages', + index=0, + containing_service=None, + input_type=_BATCHANNOTATEIMAGESREQUEST, + output_type=_BATCHANNOTATEIMAGESRESPONSE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002\030\"\023/v1/images:annotate:\001*')), + ), + _descriptor.MethodDescriptor( + name='AsyncBatchAnnotateFiles', + full_name='google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateFiles', + index=1, + containing_service=None, + input_type=_ASYNCBATCHANNOTATEFILESREQUEST, + output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002!\"\034/v1/files:asyncBatchAnnotate:\001*')), + ), +]) +_sym_db.RegisterServiceDescriptor(_IMAGEANNOTATOR) + +DESCRIPTOR.services_by_name['ImageAnnotator'] = _IMAGEANNOTATOR + # @@protoc_insertion_point(module_scope) diff --git a/vision/google/cloud/vision_v1/proto/image_annotator_pb2_grpc.py b/vision/google/cloud/vision_v1/proto/image_annotator_pb2_grpc.py index 62450f884703..6e752d5ff810 100644 --- a/vision/google/cloud/vision_v1/proto/image_annotator_pb2_grpc.py +++ b/vision/google/cloud/vision_v1/proto/image_annotator_pb2_grpc.py @@ -1,7 +1,8 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc -import google.cloud.vision_v1.proto.image_annotator_pb2 as google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2 +from google.cloud.vision_v1.proto import image_annotator_pb2 as google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2 +from google.longrunning import operations_pb2 as google_dot_longrunning_dot_operations__pb2 class ImageAnnotatorStub(object): @@ -21,6 +22,11 @@ def __init__(self, channel): request_serializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesRequest.SerializeToString, response_deserializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesResponse.FromString, ) + self.AsyncBatchAnnotateFiles = channel.unary_unary( + '/google.cloud.vision.v1.ImageAnnotator/AsyncBatchAnnotateFiles', + request_serializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.AsyncBatchAnnotateFilesRequest.SerializeToString, + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, + ) class ImageAnnotatorServicer(object): @@ -36,6 +42,18 @@ def BatchAnnotateImages(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def AsyncBatchAnnotateFiles(self, request, context): + """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). + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def add_ImageAnnotatorServicer_to_server(servicer, server): rpc_method_handlers = { @@ -44,6 +62,11 @@ def add_ImageAnnotatorServicer_to_server(servicer, server): request_deserializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesRequest.FromString, response_serializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesResponse.SerializeToString, ), + 'AsyncBatchAnnotateFiles': grpc.unary_unary_rpc_method_handler( + servicer.AsyncBatchAnnotateFiles, + request_deserializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.AsyncBatchAnnotateFilesRequest.FromString, + response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( 'google.cloud.vision.v1.ImageAnnotator', rpc_method_handlers) diff --git a/vision/google/cloud/vision_v1/proto/text_annotation_pb2.py b/vision/google/cloud/vision_v1/proto/text_annotation_pb2.py index 8bb5bcda04a1..94ccfb0a2f49 100644 --- a/vision/google/cloud/vision_v1/proto/text_annotation_pb2.py +++ b/vision/google/cloud/vision_v1/proto/text_annotation_pb2.py @@ -24,7 +24,6 @@ serialized_pb=_b('\n2google/cloud/vision_v1/proto/text_annotation.proto\x12\x16google.cloud.vision.v1\x1a\x1cgoogle/api/annotations.proto\x1a+google/cloud/vision_v1/proto/geometry.proto\"\x96\x04\n\x0eTextAnnotation\x12+\n\x05pages\x18\x01 \x03(\x0b\x32\x1c.google.cloud.vision.v1.Page\x12\x0c\n\x04text\x18\x02 \x01(\t\x1a=\n\x10\x44\x65tectedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x1a\xd5\x01\n\rDetectedBreak\x12L\n\x04type\x18\x01 \x01(\x0e\x32>.google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType\x12\x11\n\tis_prefix\x18\x02 \x01(\x08\"c\n\tBreakType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\t\n\x05SPACE\x10\x01\x12\x0e\n\nSURE_SPACE\x10\x02\x12\x12\n\x0e\x45OL_SURE_SPACE\x10\x03\x12\n\n\x06HYPHEN\x10\x04\x12\x0e\n\nLINE_BREAK\x10\x05\x1a\xb1\x01\n\x0cTextProperty\x12S\n\x12\x64\x65tected_languages\x18\x01 \x03(\x0b\x32\x37.google.cloud.vision.v1.TextAnnotation.DetectedLanguage\x12L\n\x0e\x64\x65tected_break\x18\x02 \x01(\x0b\x32\x34.google.cloud.vision.v1.TextAnnotation.DetectedBreak\"\xaf\x01\n\x04Page\x12\x45\n\x08property\x18\x01 \x01(\x0b\x32\x33.google.cloud.vision.v1.TextAnnotation.TextProperty\x12\r\n\x05width\x18\x02 \x01(\x05\x12\x0e\n\x06height\x18\x03 \x01(\x05\x12-\n\x06\x62locks\x18\x04 \x03(\x0b\x32\x1d.google.cloud.vision.v1.Block\x12\x12\n\nconfidence\x18\x05 \x01(\x02\"\xe6\x02\n\x05\x42lock\x12\x45\n\x08property\x18\x01 \x01(\x0b\x32\x33.google.cloud.vision.v1.TextAnnotation.TextProperty\x12:\n\x0c\x62ounding_box\x18\x02 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12\x35\n\nparagraphs\x18\x03 \x03(\x0b\x32!.google.cloud.vision.v1.Paragraph\x12;\n\nblock_type\x18\x04 \x01(\x0e\x32\'.google.cloud.vision.v1.Block.BlockType\x12\x12\n\nconfidence\x18\x05 \x01(\x02\"R\n\tBlockType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x08\n\x04TEXT\x10\x01\x12\t\n\x05TABLE\x10\x02\x12\x0b\n\x07PICTURE\x10\x03\x12\t\n\x05RULER\x10\x04\x12\x0b\n\x07\x42\x41RCODE\x10\x05\"\xcf\x01\n\tParagraph\x12\x45\n\x08property\x18\x01 \x01(\x0b\x32\x33.google.cloud.vision.v1.TextAnnotation.TextProperty\x12:\n\x0c\x62ounding_box\x18\x02 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12+\n\x05words\x18\x03 \x03(\x0b\x32\x1c.google.cloud.vision.v1.Word\x12\x12\n\nconfidence\x18\x04 \x01(\x02\"\xce\x01\n\x04Word\x12\x45\n\x08property\x18\x01 \x01(\x0b\x32\x33.google.cloud.vision.v1.TextAnnotation.TextProperty\x12:\n\x0c\x62ounding_box\x18\x02 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12/\n\x07symbols\x18\x03 \x03(\x0b\x32\x1e.google.cloud.vision.v1.Symbol\x12\x12\n\nconfidence\x18\x04 \x01(\x02\"\xad\x01\n\x06Symbol\x12\x45\n\x08property\x18\x01 \x01(\x0b\x32\x33.google.cloud.vision.v1.TextAnnotation.TextProperty\x12:\n\x0c\x62ounding_box\x18\x02 \x01(\x0b\x32$.google.cloud.vision.v1.BoundingPoly\x12\x0c\n\x04text\x18\x03 \x01(\t\x12\x12\n\nconfidence\x18\x04 \x01(\x02\x42t\n\x1a\x63om.google.cloud.vision.v1B\x13TextAnnotationProtoP\x01Z>> >>> client = vision_v1p1beta1.ImageAnnotatorClient() >>> + >>> # TODO: Initialize ``requests``: >>> requests = [] >>> >>> response = client.batch_annotate_images(requests) @@ -141,6 +158,8 @@ def batch_annotate_images(self, timeout (Optional[float]): The amount of time, in seconds, to wait for the request to complete. Note that if ``retry`` is specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. Returns: A :class:`~google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesResponse` instance. @@ -152,7 +171,18 @@ def batch_annotate_images(self, to a retryable error and retry attempts failed. ValueError: If the parameters are invalid. """ + if 'batch_annotate_images' not in self._inner_api_calls: + self._inner_api_calls[ + 'batch_annotate_images'] = google.api_core.gapic_v1.method.wrap_method( + self._image_annotator_stub.BatchAnnotateImages, + default_retry=self._method_configs[ + 'BatchAnnotateImages'].retry, + default_timeout=self._method_configs['BatchAnnotateImages'] + .timeout, + client_info=self._client_info, + ) + request = image_annotator_pb2.BatchAnnotateImagesRequest( - requests=requests) - return self._batch_annotate_images( - request, retry=retry, timeout=timeout) + requests=requests, ) + return self._inner_api_calls['batch_annotate_images']( + request, retry=retry, timeout=timeout, metadata=metadata) diff --git a/vision/google/cloud/vision_v1p1beta1/proto/geometry_pb2.py b/vision/google/cloud/vision_v1p1beta1/proto/geometry_pb2.py index 1178129c5636..114ea8bef05a 100644 --- a/vision/google/cloud/vision_v1p1beta1/proto/geometry_pb2.py +++ b/vision/google/cloud/vision_v1p1beta1/proto/geometry_pb2.py @@ -21,7 +21,6 @@ syntax='proto3', serialized_pb=_b('\n2google/cloud/vision_v1p1beta1/proto/geometry.proto\x12\x1dgoogle.cloud.vision.v1p1beta1\"\x1e\n\x06Vertex\x12\t\n\x01x\x18\x01 \x01(\x05\x12\t\n\x01y\x18\x02 \x01(\x05\"G\n\x0c\x42oundingPoly\x12\x37\n\x08vertices\x18\x01 \x03(\x0b\x32%.google.cloud.vision.v1p1beta1.Vertex\"+\n\x08Position\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\x42|\n!com.google.cloud.vision.v1p1beta1B\rGeometryProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision\xf8\x01\x01\x62\x06proto3') ) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -39,14 +38,14 @@ has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='y', full_name='google.cloud.vision.v1p1beta1.Vertex.y', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -77,7 +76,7 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -108,21 +107,21 @@ has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='y', full_name='google.cloud.vision.v1p1beta1.Position.y', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='z', full_name='google.cloud.vision.v1p1beta1.Position.z', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -143,6 +142,7 @@ DESCRIPTOR.message_types_by_name['Vertex'] = _VERTEX DESCRIPTOR.message_types_by_name['BoundingPoly'] = _BOUNDINGPOLY DESCRIPTOR.message_types_by_name['Position'] = _POSITION +_sym_db.RegisterFileDescriptor(DESCRIPTOR) Vertex = _reflection.GeneratedProtocolMessageType('Vertex', (_message.Message,), dict( DESCRIPTOR = _VERTEX, @@ -198,14 +198,4 @@ DESCRIPTOR.has_options = True DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n!com.google.cloud.vision.v1p1beta1B\rGeometryProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision\370\001\001')) -try: - # THESE ELEMENTS WILL BE DEPRECATED. - # Please use the generated *_pb2_grpc.py files instead. - import grpc - from grpc.beta import implementations as beta_implementations - from grpc.beta import interfaces as beta_interfaces - from grpc.framework.common import cardinality - from grpc.framework.interfaces.face import utilities as face_utilities -except ImportError: - pass # @@protoc_insertion_point(module_scope) diff --git a/vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py b/vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py index 7903b7a6bfd5..b799d19a6929 100644 --- a/vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py +++ b/vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py @@ -30,7 +30,6 @@ serialized_pb=_b('\n9google/cloud/vision_v1p1beta1/proto/image_annotator.proto\x12\x1dgoogle.cloud.vision.v1p1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x32google/cloud/vision_v1p1beta1/proto/geometry.proto\x1a\x39google/cloud/vision_v1p1beta1/proto/text_annotation.proto\x1a\x37google/cloud/vision_v1p1beta1/proto/web_detection.proto\x1a\x17google/rpc/status.proto\x1a\x17google/type/color.proto\x1a\x18google/type/latlng.proto\"\xe1\x02\n\x07\x46\x65\x61ture\x12\x39\n\x04type\x18\x01 \x01(\x0e\x32+.google.cloud.vision.v1p1beta1.Feature.Type\x12\x13\n\x0bmax_results\x18\x02 \x01(\x05\x12\r\n\x05model\x18\x03 \x01(\t\"\xf6\x01\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46\x41\x43\x45_DETECTION\x10\x01\x12\x16\n\x12LANDMARK_DETECTION\x10\x02\x12\x12\n\x0eLOGO_DETECTION\x10\x03\x12\x13\n\x0fLABEL_DETECTION\x10\x04\x12\x12\n\x0eTEXT_DETECTION\x10\x05\x12\x1b\n\x17\x44OCUMENT_TEXT_DETECTION\x10\x0b\x12\x19\n\x15SAFE_SEARCH_DETECTION\x10\x06\x12\x14\n\x10IMAGE_PROPERTIES\x10\x07\x12\x0e\n\nCROP_HINTS\x10\t\x12\x11\n\rWEB_DETECTION\x10\n\"7\n\x0bImageSource\x12\x15\n\rgcs_image_uri\x18\x01 \x01(\t\x12\x11\n\timage_uri\x18\x02 \x01(\t\"T\n\x05Image\x12\x0f\n\x07\x63ontent\x18\x01 \x01(\x0c\x12:\n\x06source\x18\x02 \x01(\x0b\x32*.google.cloud.vision.v1p1beta1.ImageSource\"\x9b\x0e\n\x0e\x46\x61\x63\x65\x41nnotation\x12\x42\n\rbounding_poly\x18\x01 \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.BoundingPoly\x12\x45\n\x10\x66\x64_bounding_poly\x18\x02 \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.BoundingPoly\x12I\n\tlandmarks\x18\x03 \x03(\x0b\x32\x36.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark\x12\x12\n\nroll_angle\x18\x04 \x01(\x02\x12\x11\n\tpan_angle\x18\x05 \x01(\x02\x12\x12\n\ntilt_angle\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tection_confidence\x18\x07 \x01(\x02\x12\x1e\n\x16landmarking_confidence\x18\x08 \x01(\x02\x12\x41\n\x0ejoy_likelihood\x18\t \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12\x44\n\x11sorrow_likelihood\x18\n \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12\x43\n\x10\x61nger_likelihood\x18\x0b \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12\x46\n\x13surprise_likelihood\x18\x0c \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12K\n\x18under_exposed_likelihood\x18\r \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12\x45\n\x12\x62lurred_likelihood\x18\x0e \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12\x46\n\x13headwear_likelihood\x18\x0f \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x1a\xc7\x07\n\x08Landmark\x12I\n\x04type\x18\x03 \x01(\x0e\x32;.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type\x12\x39\n\x08position\x18\x04 \x01(\x0b\x32\'.google.cloud.vision.v1p1beta1.Position\"\xb4\x06\n\x04Type\x12\x14\n\x10UNKNOWN_LANDMARK\x10\x00\x12\x0c\n\x08LEFT_EYE\x10\x01\x12\r\n\tRIGHT_EYE\x10\x02\x12\x18\n\x14LEFT_OF_LEFT_EYEBROW\x10\x03\x12\x19\n\x15RIGHT_OF_LEFT_EYEBROW\x10\x04\x12\x19\n\x15LEFT_OF_RIGHT_EYEBROW\x10\x05\x12\x1a\n\x16RIGHT_OF_RIGHT_EYEBROW\x10\x06\x12\x19\n\x15MIDPOINT_BETWEEN_EYES\x10\x07\x12\x0c\n\x08NOSE_TIP\x10\x08\x12\r\n\tUPPER_LIP\x10\t\x12\r\n\tLOWER_LIP\x10\n\x12\x0e\n\nMOUTH_LEFT\x10\x0b\x12\x0f\n\x0bMOUTH_RIGHT\x10\x0c\x12\x10\n\x0cMOUTH_CENTER\x10\r\x12\x15\n\x11NOSE_BOTTOM_RIGHT\x10\x0e\x12\x14\n\x10NOSE_BOTTOM_LEFT\x10\x0f\x12\x16\n\x12NOSE_BOTTOM_CENTER\x10\x10\x12\x19\n\x15LEFT_EYE_TOP_BOUNDARY\x10\x11\x12\x19\n\x15LEFT_EYE_RIGHT_CORNER\x10\x12\x12\x1c\n\x18LEFT_EYE_BOTTOM_BOUNDARY\x10\x13\x12\x18\n\x14LEFT_EYE_LEFT_CORNER\x10\x14\x12\x1a\n\x16RIGHT_EYE_TOP_BOUNDARY\x10\x15\x12\x1a\n\x16RIGHT_EYE_RIGHT_CORNER\x10\x16\x12\x1d\n\x19RIGHT_EYE_BOTTOM_BOUNDARY\x10\x17\x12\x19\n\x15RIGHT_EYE_LEFT_CORNER\x10\x18\x12\x1f\n\x1bLEFT_EYEBROW_UPPER_MIDPOINT\x10\x19\x12 \n\x1cRIGHT_EYEBROW_UPPER_MIDPOINT\x10\x1a\x12\x14\n\x10LEFT_EAR_TRAGION\x10\x1b\x12\x15\n\x11RIGHT_EAR_TRAGION\x10\x1c\x12\x12\n\x0eLEFT_EYE_PUPIL\x10\x1d\x12\x13\n\x0fRIGHT_EYE_PUPIL\x10\x1e\x12\x15\n\x11\x46OREHEAD_GLABELLA\x10\x1f\x12\x11\n\rCHIN_GNATHION\x10 \x12\x14\n\x10\x43HIN_LEFT_GONION\x10!\x12\x15\n\x11\x43HIN_RIGHT_GONION\x10\"\"4\n\x0cLocationInfo\x12$\n\x07lat_lng\x18\x01 \x01(\x0b\x32\x13.google.type.LatLng\"=\n\x08Property\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\x12\x14\n\x0cuint64_value\x18\x03 \x01(\x04\"\xbc\x02\n\x10\x45ntityAnnotation\x12\x0b\n\x03mid\x18\x01 \x01(\t\x12\x0e\n\x06locale\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\r\n\x05score\x18\x04 \x01(\x02\x12\x12\n\nconfidence\x18\x05 \x01(\x02\x12\x12\n\ntopicality\x18\x06 \x01(\x02\x12\x42\n\rbounding_poly\x18\x07 \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.BoundingPoly\x12>\n\tlocations\x18\x08 \x03(\x0b\x32+.google.cloud.vision.v1p1beta1.LocationInfo\x12;\n\nproperties\x18\t \x03(\x0b\x32\'.google.cloud.vision.v1p1beta1.Property\"\xbc\x02\n\x14SafeSearchAnnotation\x12\x38\n\x05\x61\x64ult\x18\x01 \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12\x38\n\x05spoof\x18\x02 \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12:\n\x07medical\x18\x03 \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12;\n\x08violence\x18\x04 \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\x12\x37\n\x04racy\x18\t \x01(\x0e\x32).google.cloud.vision.v1p1beta1.Likelihood\"a\n\x0bLatLongRect\x12(\n\x0bmin_lat_lng\x18\x01 \x01(\x0b\x32\x13.google.type.LatLng\x12(\n\x0bmax_lat_lng\x18\x02 \x01(\x0b\x32\x13.google.type.LatLng\"U\n\tColorInfo\x12!\n\x05\x63olor\x18\x01 \x01(\x0b\x32\x12.google.type.Color\x12\r\n\x05score\x18\x02 \x01(\x02\x12\x16\n\x0epixel_fraction\x18\x03 \x01(\x02\"T\n\x18\x44ominantColorsAnnotation\x12\x38\n\x06\x63olors\x18\x01 \x03(\x0b\x32(.google.cloud.vision.v1p1beta1.ColorInfo\"c\n\x0fImageProperties\x12P\n\x0f\x64ominant_colors\x18\x01 \x01(\x0b\x32\x37.google.cloud.vision.v1p1beta1.DominantColorsAnnotation\"\x7f\n\x08\x43ropHint\x12\x42\n\rbounding_poly\x18\x01 \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.BoundingPoly\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x1b\n\x13importance_fraction\x18\x03 \x01(\x02\"R\n\x13\x43ropHintsAnnotation\x12;\n\ncrop_hints\x18\x01 \x03(\x0b\x32\'.google.cloud.vision.v1p1beta1.CropHint\"(\n\x0f\x43ropHintsParams\x12\x15\n\raspect_ratios\x18\x01 \x03(\x02\"1\n\x12WebDetectionParams\x12\x1b\n\x13include_geo_results\x18\x02 \x01(\x08\"\x85\x02\n\x0cImageContext\x12\x41\n\rlat_long_rect\x18\x01 \x01(\x0b\x32*.google.cloud.vision.v1p1beta1.LatLongRect\x12\x16\n\x0elanguage_hints\x18\x02 \x03(\t\x12I\n\x11\x63rop_hints_params\x18\x04 \x01(\x0b\x32..google.cloud.vision.v1p1beta1.CropHintsParams\x12O\n\x14web_detection_params\x18\x06 \x01(\x0b\x32\x31.google.cloud.vision.v1p1beta1.WebDetectionParams\"\xc9\x01\n\x14\x41nnotateImageRequest\x12\x33\n\x05image\x18\x01 \x01(\x0b\x32$.google.cloud.vision.v1p1beta1.Image\x12\x38\n\x08\x66\x65\x61tures\x18\x02 \x03(\x0b\x32&.google.cloud.vision.v1p1beta1.Feature\x12\x42\n\rimage_context\x18\x03 \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.ImageContext\"\xc2\x06\n\x15\x41nnotateImageResponse\x12G\n\x10\x66\x61\x63\x65_annotations\x18\x01 \x03(\x0b\x32-.google.cloud.vision.v1p1beta1.FaceAnnotation\x12M\n\x14landmark_annotations\x18\x02 \x03(\x0b\x32/.google.cloud.vision.v1p1beta1.EntityAnnotation\x12I\n\x10logo_annotations\x18\x03 \x03(\x0b\x32/.google.cloud.vision.v1p1beta1.EntityAnnotation\x12J\n\x11label_annotations\x18\x04 \x03(\x0b\x32/.google.cloud.vision.v1p1beta1.EntityAnnotation\x12I\n\x10text_annotations\x18\x05 \x03(\x0b\x32/.google.cloud.vision.v1p1beta1.EntityAnnotation\x12K\n\x14\x66ull_text_annotation\x18\x0c \x01(\x0b\x32-.google.cloud.vision.v1p1beta1.TextAnnotation\x12S\n\x16safe_search_annotation\x18\x06 \x01(\x0b\x32\x33.google.cloud.vision.v1p1beta1.SafeSearchAnnotation\x12S\n\x1bimage_properties_annotation\x18\x08 \x01(\x0b\x32..google.cloud.vision.v1p1beta1.ImageProperties\x12Q\n\x15\x63rop_hints_annotation\x18\x0b \x01(\x0b\x32\x32.google.cloud.vision.v1p1beta1.CropHintsAnnotation\x12\x42\n\rweb_detection\x18\r \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.WebDetection\x12!\n\x05\x65rror\x18\t \x01(\x0b\x32\x12.google.rpc.Status\"c\n\x1a\x42\x61tchAnnotateImagesRequest\x12\x45\n\x08requests\x18\x01 \x03(\x0b\x32\x33.google.cloud.vision.v1p1beta1.AnnotateImageRequest\"f\n\x1b\x42\x61tchAnnotateImagesResponse\x12G\n\tresponses\x18\x01 \x03(\x0b\x32\x34.google.cloud.vision.v1p1beta1.AnnotateImageResponse*e\n\nLikelihood\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x11\n\rVERY_UNLIKELY\x10\x01\x12\x0c\n\x08UNLIKELY\x10\x02\x12\x0c\n\x08POSSIBLE\x10\x03\x12\n\n\x06LIKELY\x10\x04\x12\x0f\n\x0bVERY_LIKELY\x10\x05\x32\xc6\x01\n\x0eImageAnnotator\x12\xb3\x01\n\x13\x42\x61tchAnnotateImages\x12\x39.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest\x1a:.google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse\"%\x82\xd3\xe4\x93\x02\x1f\"\x1a/v1p1beta1/images:annotate:\x01*B\x82\x01\n!com.google.cloud.vision.v1p1beta1B\x13ImageAnnotatorProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision\xf8\x01\x01\x62\x06proto3') , dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,google_dot_cloud_dot_vision__v1p1beta1_dot_proto_dot_geometry__pb2.DESCRIPTOR,google_dot_cloud_dot_vision__v1p1beta1_dot_proto_dot_text__annotation__pb2.DESCRIPTOR,google_dot_cloud_dot_vision__v1p1beta1_dot_proto_dot_web__detection__pb2.DESCRIPTOR,google_dot_rpc_dot_status__pb2.DESCRIPTOR,google_dot_type_dot_color__pb2.DESCRIPTOR,google_dot_type_dot_latlng__pb2.DESCRIPTOR,]) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) _LIKELIHOOD = _descriptor.EnumDescriptor( name='Likelihood', @@ -305,21 +304,21 @@ has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='max_results', full_name='google.cloud.vision.v1p1beta1.Feature.max_results', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='model', full_name='google.cloud.vision.v1p1beta1.Feature.model', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -351,14 +350,14 @@ has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='image_uri', full_name='google.cloud.vision.v1p1beta1.ImageSource.image_uri', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -389,14 +388,14 @@ has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='source', full_name='google.cloud.vision.v1p1beta1.Image.source', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -427,14 +426,14 @@ has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='position', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.position', index=1, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -465,105 +464,105 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='fd_bounding_poly', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.fd_bounding_poly', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='landmarks', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.landmarks', index=2, number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='roll_angle', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.roll_angle', index=3, number=4, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='pan_angle', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.pan_angle', index=4, number=5, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='tilt_angle', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.tilt_angle', index=5, number=6, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='detection_confidence', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.detection_confidence', index=6, number=7, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='landmarking_confidence', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.landmarking_confidence', index=7, number=8, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='joy_likelihood', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.joy_likelihood', index=8, number=9, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='sorrow_likelihood', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.sorrow_likelihood', index=9, number=10, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='anger_likelihood', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.anger_likelihood', index=10, number=11, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='surprise_likelihood', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.surprise_likelihood', index=11, number=12, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='under_exposed_likelihood', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.under_exposed_likelihood', index=12, number=13, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='blurred_likelihood', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.blurred_likelihood', index=13, number=14, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='headwear_likelihood', full_name='google.cloud.vision.v1p1beta1.FaceAnnotation.headwear_likelihood', index=14, number=15, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -594,7 +593,7 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -625,21 +624,21 @@ has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='value', full_name='google.cloud.vision.v1p1beta1.Property.value', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='uint64_value', full_name='google.cloud.vision.v1p1beta1.Property.uint64_value', index=2, number=3, type=4, cpp_type=4, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -670,63 +669,63 @@ has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='locale', full_name='google.cloud.vision.v1p1beta1.EntityAnnotation.locale', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='description', full_name='google.cloud.vision.v1p1beta1.EntityAnnotation.description', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='score', full_name='google.cloud.vision.v1p1beta1.EntityAnnotation.score', index=3, number=4, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='confidence', full_name='google.cloud.vision.v1p1beta1.EntityAnnotation.confidence', index=4, number=5, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='topicality', full_name='google.cloud.vision.v1p1beta1.EntityAnnotation.topicality', index=5, number=6, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='bounding_poly', full_name='google.cloud.vision.v1p1beta1.EntityAnnotation.bounding_poly', index=6, number=7, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='locations', full_name='google.cloud.vision.v1p1beta1.EntityAnnotation.locations', index=7, number=8, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='properties', full_name='google.cloud.vision.v1p1beta1.EntityAnnotation.properties', index=8, number=9, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -757,35 +756,35 @@ has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='spoof', full_name='google.cloud.vision.v1p1beta1.SafeSearchAnnotation.spoof', index=1, number=2, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='medical', full_name='google.cloud.vision.v1p1beta1.SafeSearchAnnotation.medical', index=2, number=3, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='violence', full_name='google.cloud.vision.v1p1beta1.SafeSearchAnnotation.violence', index=3, number=4, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='racy', full_name='google.cloud.vision.v1p1beta1.SafeSearchAnnotation.racy', index=4, number=9, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -816,14 +815,14 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='max_lat_lng', full_name='google.cloud.vision.v1p1beta1.LatLongRect.max_lat_lng', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -854,21 +853,21 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='score', full_name='google.cloud.vision.v1p1beta1.ColorInfo.score', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='pixel_fraction', full_name='google.cloud.vision.v1p1beta1.ColorInfo.pixel_fraction', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -899,7 +898,7 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -930,7 +929,7 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -961,21 +960,21 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='confidence', full_name='google.cloud.vision.v1p1beta1.CropHint.confidence', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='importance_fraction', full_name='google.cloud.vision.v1p1beta1.CropHint.importance_fraction', index=2, number=3, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -1006,7 +1005,7 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -1037,7 +1036,7 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -1068,7 +1067,7 @@ has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -1099,28 +1098,28 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='language_hints', full_name='google.cloud.vision.v1p1beta1.ImageContext.language_hints', index=1, number=2, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='crop_hints_params', full_name='google.cloud.vision.v1p1beta1.ImageContext.crop_hints_params', index=2, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='web_detection_params', full_name='google.cloud.vision.v1p1beta1.ImageContext.web_detection_params', index=3, number=6, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -1151,21 +1150,21 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='features', full_name='google.cloud.vision.v1p1beta1.AnnotateImageRequest.features', index=1, number=2, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='image_context', full_name='google.cloud.vision.v1p1beta1.AnnotateImageRequest.image_context', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -1196,77 +1195,77 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='landmark_annotations', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.landmark_annotations', index=1, number=2, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='logo_annotations', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.logo_annotations', index=2, number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='label_annotations', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.label_annotations', index=3, number=4, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='text_annotations', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.text_annotations', index=4, number=5, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='full_text_annotation', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.full_text_annotation', index=5, number=12, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='safe_search_annotation', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.safe_search_annotation', index=6, number=6, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='image_properties_annotation', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.image_properties_annotation', index=7, number=8, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='crop_hints_annotation', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.crop_hints_annotation', index=8, number=11, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='web_detection', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.web_detection', index=9, number=13, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='error', full_name='google.cloud.vision.v1p1beta1.AnnotateImageResponse.error', index=10, number=9, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -1297,7 +1296,7 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -1328,7 +1327,7 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -1419,6 +1418,7 @@ DESCRIPTOR.message_types_by_name['BatchAnnotateImagesRequest'] = _BATCHANNOTATEIMAGESREQUEST DESCRIPTOR.message_types_by_name['BatchAnnotateImagesResponse'] = _BATCHANNOTATEIMAGESRESPONSE DESCRIPTOR.enum_types_by_name['Likelihood'] = _LIKELIHOOD +_sym_db.RegisterFileDescriptor(DESCRIPTOR) Feature = _reflection.GeneratedProtocolMessageType('Feature', (_message.Message,), dict( DESCRIPTOR = _FEATURE, @@ -1959,131 +1959,28 @@ DESCRIPTOR.has_options = True DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n!com.google.cloud.vision.v1p1beta1B\023ImageAnnotatorProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision\370\001\001')) -try: - # THESE ELEMENTS WILL BE DEPRECATED. - # Please use the generated *_pb2_grpc.py files instead. - import grpc - from grpc.beta import implementations as beta_implementations - from grpc.beta import interfaces as beta_interfaces - from grpc.framework.common import cardinality - from grpc.framework.interfaces.face import utilities as face_utilities - - - class ImageAnnotatorStub(object): - """Service that performs Google Cloud Vision API detection tasks over client - images, such as face, landmark, logo, label, and text detection. The - ImageAnnotator service returns detected entities from the images. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.BatchAnnotateImages = channel.unary_unary( - '/google.cloud.vision.v1p1beta1.ImageAnnotator/BatchAnnotateImages', - request_serializer=BatchAnnotateImagesRequest.SerializeToString, - response_deserializer=BatchAnnotateImagesResponse.FromString, - ) - - - class ImageAnnotatorServicer(object): - """Service that performs Google Cloud Vision API detection tasks over client - images, such as face, landmark, logo, label, and text detection. The - ImageAnnotator service returns detected entities from the images. - """ - - def BatchAnnotateImages(self, request, context): - """Run image detection and annotation for a batch of images. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - - def add_ImageAnnotatorServicer_to_server(servicer, server): - rpc_method_handlers = { - 'BatchAnnotateImages': grpc.unary_unary_rpc_method_handler( - servicer.BatchAnnotateImages, - request_deserializer=BatchAnnotateImagesRequest.FromString, - response_serializer=BatchAnnotateImagesResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'google.cloud.vision.v1p1beta1.ImageAnnotator', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - class BetaImageAnnotatorServicer(object): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This class was generated - only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" - """Service that performs Google Cloud Vision API detection tasks over client - images, such as face, landmark, logo, label, and text detection. The - ImageAnnotator service returns detected entities from the images. - """ - def BatchAnnotateImages(self, request, context): - """Run image detection and annotation for a batch of images. - """ - context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) - - - class BetaImageAnnotatorStub(object): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This class was generated - only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" - """Service that performs Google Cloud Vision API detection tasks over client - images, such as face, landmark, logo, label, and text detection. The - ImageAnnotator service returns detected entities from the images. - """ - def BatchAnnotateImages(self, request, timeout, metadata=None, with_call=False, protocol_options=None): - """Run image detection and annotation for a batch of images. - """ - raise NotImplementedError() - BatchAnnotateImages.future = None - - - def beta_create_ImageAnnotator_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This function was - generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" - request_deserializers = { - ('google.cloud.vision.v1p1beta1.ImageAnnotator', 'BatchAnnotateImages'): BatchAnnotateImagesRequest.FromString, - } - response_serializers = { - ('google.cloud.vision.v1p1beta1.ImageAnnotator', 'BatchAnnotateImages'): BatchAnnotateImagesResponse.SerializeToString, - } - method_implementations = { - ('google.cloud.vision.v1p1beta1.ImageAnnotator', 'BatchAnnotateImages'): face_utilities.unary_unary_inline(servicer.BatchAnnotateImages), - } - server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) - return beta_implementations.server(method_implementations, options=server_options) - - - def beta_create_ImageAnnotator_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This function was - generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" - request_serializers = { - ('google.cloud.vision.v1p1beta1.ImageAnnotator', 'BatchAnnotateImages'): BatchAnnotateImagesRequest.SerializeToString, - } - response_deserializers = { - ('google.cloud.vision.v1p1beta1.ImageAnnotator', 'BatchAnnotateImages'): BatchAnnotateImagesResponse.FromString, - } - cardinalities = { - 'BatchAnnotateImages': cardinality.Cardinality.UNARY_UNARY, - } - stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) - return beta_implementations.dynamic_stub(channel, 'google.cloud.vision.v1p1beta1.ImageAnnotator', cardinalities, options=stub_options) -except ImportError: - pass + +_IMAGEANNOTATOR = _descriptor.ServiceDescriptor( + name='ImageAnnotator', + full_name='google.cloud.vision.v1p1beta1.ImageAnnotator', + file=DESCRIPTOR, + index=0, + options=None, + serialized_start=5735, + serialized_end=5933, + methods=[ + _descriptor.MethodDescriptor( + name='BatchAnnotateImages', + full_name='google.cloud.vision.v1p1beta1.ImageAnnotator.BatchAnnotateImages', + index=0, + containing_service=None, + input_type=_BATCHANNOTATEIMAGESREQUEST, + output_type=_BATCHANNOTATEIMAGESRESPONSE, + options=_descriptor._ParseOptions(descriptor_pb2.MethodOptions(), _b('\202\323\344\223\002\037\"\032/v1p1beta1/images:annotate:\001*')), + ), +]) +_sym_db.RegisterServiceDescriptor(_IMAGEANNOTATOR) + +DESCRIPTOR.services_by_name['ImageAnnotator'] = _IMAGEANNOTATOR + # @@protoc_insertion_point(module_scope) diff --git a/vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2_grpc.py b/vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2_grpc.py index f49680afb896..277708bd6e3b 100644 --- a/vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2_grpc.py +++ b/vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2_grpc.py @@ -1,7 +1,7 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc -import google.cloud.vision_v1p1beta1.proto.image_annotator_pb2 as google_dot_cloud_dot_vision__v1p1beta1_dot_proto_dot_image__annotator__pb2 +from google.cloud.vision_v1p1beta1.proto import image_annotator_pb2 as google_dot_cloud_dot_vision__v1p1beta1_dot_proto_dot_image__annotator__pb2 class ImageAnnotatorStub(object): diff --git a/vision/google/cloud/vision_v1p1beta1/proto/text_annotation_pb2.py b/vision/google/cloud/vision_v1p1beta1/proto/text_annotation_pb2.py index 7325e8bcf75b..acde121b9925 100644 --- a/vision/google/cloud/vision_v1p1beta1/proto/text_annotation_pb2.py +++ b/vision/google/cloud/vision_v1p1beta1/proto/text_annotation_pb2.py @@ -24,7 +24,6 @@ serialized_pb=_b('\n9google/cloud/vision_v1p1beta1/proto/text_annotation.proto\x12\x1dgoogle.cloud.vision.v1p1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x32google/cloud/vision_v1p1beta1/proto/geometry.proto\"\xb2\x04\n\x0eTextAnnotation\x12\x32\n\x05pages\x18\x01 \x03(\x0b\x32#.google.cloud.vision.v1p1beta1.Page\x12\x0c\n\x04text\x18\x02 \x01(\t\x1a=\n\x10\x44\x65tectedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x1a\xdc\x01\n\rDetectedBreak\x12S\n\x04type\x18\x01 \x01(\x0e\x32\x45.google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.BreakType\x12\x11\n\tis_prefix\x18\x02 \x01(\x08\"c\n\tBreakType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\t\n\x05SPACE\x10\x01\x12\x0e\n\nSURE_SPACE\x10\x02\x12\x12\n\x0e\x45OL_SURE_SPACE\x10\x03\x12\n\n\x06HYPHEN\x10\x04\x12\x0e\n\nLINE_BREAK\x10\x05\x1a\xbf\x01\n\x0cTextProperty\x12Z\n\x12\x64\x65tected_languages\x18\x01 \x03(\x0b\x32>.google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage\x12S\n\x0e\x64\x65tected_break\x18\x02 \x01(\x0b\x32;.google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak\"\xbd\x01\n\x04Page\x12L\n\x08property\x18\x01 \x01(\x0b\x32:.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty\x12\r\n\x05width\x18\x02 \x01(\x05\x12\x0e\n\x06height\x18\x03 \x01(\x05\x12\x34\n\x06\x62locks\x18\x04 \x03(\x0b\x32$.google.cloud.vision.v1p1beta1.Block\x12\x12\n\nconfidence\x18\x05 \x01(\x02\"\x82\x03\n\x05\x42lock\x12L\n\x08property\x18\x01 \x01(\x0b\x32:.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty\x12\x41\n\x0c\x62ounding_box\x18\x02 \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.BoundingPoly\x12<\n\nparagraphs\x18\x03 \x03(\x0b\x32(.google.cloud.vision.v1p1beta1.Paragraph\x12\x42\n\nblock_type\x18\x04 \x01(\x0e\x32..google.cloud.vision.v1p1beta1.Block.BlockType\x12\x12\n\nconfidence\x18\x05 \x01(\x02\"R\n\tBlockType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x08\n\x04TEXT\x10\x01\x12\t\n\x05TABLE\x10\x02\x12\x0b\n\x07PICTURE\x10\x03\x12\t\n\x05RULER\x10\x04\x12\x0b\n\x07\x42\x41RCODE\x10\x05\"\xe4\x01\n\tParagraph\x12L\n\x08property\x18\x01 \x01(\x0b\x32:.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty\x12\x41\n\x0c\x62ounding_box\x18\x02 \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.BoundingPoly\x12\x32\n\x05words\x18\x03 \x03(\x0b\x32#.google.cloud.vision.v1p1beta1.Word\x12\x12\n\nconfidence\x18\x04 \x01(\x02\"\xe3\x01\n\x04Word\x12L\n\x08property\x18\x01 \x01(\x0b\x32:.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty\x12\x41\n\x0c\x62ounding_box\x18\x02 \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.BoundingPoly\x12\x36\n\x07symbols\x18\x03 \x03(\x0b\x32%.google.cloud.vision.v1p1beta1.Symbol\x12\x12\n\nconfidence\x18\x04 \x01(\x02\"\xbb\x01\n\x06Symbol\x12L\n\x08property\x18\x01 \x01(\x0b\x32:.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty\x12\x41\n\x0c\x62ounding_box\x18\x02 \x01(\x0b\x32+.google.cloud.vision.v1p1beta1.BoundingPoly\x12\x0c\n\x04text\x18\x03 \x01(\t\x12\x12\n\nconfidence\x18\x04 \x01(\x02\x42\x82\x01\n!com.google.cloud.vision.v1p1beta1B\x13TextAnnotationProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision\xf8\x01\x01\x62\x06proto3') , dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,google_dot_cloud_dot_vision__v1p1beta1_dot_proto_dot_geometry__pb2.DESCRIPTOR,]) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -118,14 +117,14 @@ has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='confidence', full_name='google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage.confidence', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -155,14 +154,14 @@ has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='is_prefix', full_name='google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.is_prefix', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -193,14 +192,14 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='detected_break', full_name='google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.detected_break', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -230,14 +229,14 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='text', full_name='google.cloud.vision.v1p1beta1.TextAnnotation.text', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -268,35 +267,35 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='width', full_name='google.cloud.vision.v1p1beta1.Page.width', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='height', full_name='google.cloud.vision.v1p1beta1.Page.height', index=2, number=3, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='blocks', full_name='google.cloud.vision.v1p1beta1.Page.blocks', index=3, number=4, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='confidence', full_name='google.cloud.vision.v1p1beta1.Page.confidence', index=4, number=5, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -327,35 +326,35 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='bounding_box', full_name='google.cloud.vision.v1p1beta1.Block.bounding_box', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='paragraphs', full_name='google.cloud.vision.v1p1beta1.Block.paragraphs', index=2, number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='block_type', full_name='google.cloud.vision.v1p1beta1.Block.block_type', index=3, number=4, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='confidence', full_name='google.cloud.vision.v1p1beta1.Block.confidence', index=4, number=5, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -387,28 +386,28 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='bounding_box', full_name='google.cloud.vision.v1p1beta1.Paragraph.bounding_box', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='words', full_name='google.cloud.vision.v1p1beta1.Paragraph.words', index=2, number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='confidence', full_name='google.cloud.vision.v1p1beta1.Paragraph.confidence', index=3, number=4, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -439,28 +438,28 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='bounding_box', full_name='google.cloud.vision.v1p1beta1.Word.bounding_box', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='symbols', full_name='google.cloud.vision.v1p1beta1.Word.symbols', index=2, number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='confidence', full_name='google.cloud.vision.v1p1beta1.Word.confidence', index=3, number=4, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -491,28 +490,28 @@ has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='bounding_box', full_name='google.cloud.vision.v1p1beta1.Symbol.bounding_box', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='text', full_name='google.cloud.vision.v1p1beta1.Symbol.text', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='confidence', full_name='google.cloud.vision.v1p1beta1.Symbol.confidence', index=3, number=4, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -558,6 +557,7 @@ DESCRIPTOR.message_types_by_name['Paragraph'] = _PARAGRAPH DESCRIPTOR.message_types_by_name['Word'] = _WORD DESCRIPTOR.message_types_by_name['Symbol'] = _SYMBOL +_sym_db.RegisterFileDescriptor(DESCRIPTOR) TextAnnotation = _reflection.GeneratedProtocolMessageType('TextAnnotation', (_message.Message,), dict( @@ -785,14 +785,4 @@ DESCRIPTOR.has_options = True DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n!com.google.cloud.vision.v1p1beta1B\023TextAnnotationProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision\370\001\001')) -try: - # THESE ELEMENTS WILL BE DEPRECATED. - # Please use the generated *_pb2_grpc.py files instead. - import grpc - from grpc.beta import implementations as beta_implementations - from grpc.beta import interfaces as beta_interfaces - from grpc.framework.common import cardinality - from grpc.framework.interfaces.face import utilities as face_utilities -except ImportError: - pass # @@protoc_insertion_point(module_scope) diff --git a/vision/google/cloud/vision_v1p1beta1/proto/web_detection_pb2.py b/vision/google/cloud/vision_v1p1beta1/proto/web_detection_pb2.py index 7464a202d5b6..9dae06bb61fd 100644 --- a/vision/google/cloud/vision_v1p1beta1/proto/web_detection_pb2.py +++ b/vision/google/cloud/vision_v1p1beta1/proto/web_detection_pb2.py @@ -23,7 +23,6 @@ serialized_pb=_b('\n7google/cloud/vision_v1p1beta1/proto/web_detection.proto\x12\x1dgoogle.cloud.vision.v1p1beta1\x1a\x1cgoogle/api/annotations.proto\"\x8c\x07\n\x0cWebDetection\x12K\n\x0cweb_entities\x18\x01 \x03(\x0b\x32\x35.google.cloud.vision.v1p1beta1.WebDetection.WebEntity\x12R\n\x14\x66ull_matching_images\x18\x02 \x03(\x0b\x32\x34.google.cloud.vision.v1p1beta1.WebDetection.WebImage\x12U\n\x17partial_matching_images\x18\x03 \x03(\x0b\x32\x34.google.cloud.vision.v1p1beta1.WebDetection.WebImage\x12W\n\x1apages_with_matching_images\x18\x04 \x03(\x0b\x32\x33.google.cloud.vision.v1p1beta1.WebDetection.WebPage\x12U\n\x17visually_similar_images\x18\x06 \x03(\x0b\x32\x34.google.cloud.vision.v1p1beta1.WebDetection.WebImage\x12O\n\x11\x62\x65st_guess_labels\x18\x08 \x03(\x0b\x32\x34.google.cloud.vision.v1p1beta1.WebDetection.WebLabel\x1a\x42\n\tWebEntity\x12\x11\n\tentity_id\x18\x01 \x01(\t\x12\r\n\x05score\x18\x02 \x01(\x02\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x1a&\n\x08WebImage\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\r\n\x05score\x18\x02 \x01(\x02\x1a\xe4\x01\n\x07WebPage\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\r\n\x05score\x18\x02 \x01(\x02\x12\x12\n\npage_title\x18\x03 \x01(\t\x12R\n\x14\x66ull_matching_images\x18\x04 \x03(\x0b\x32\x34.google.cloud.vision.v1p1beta1.WebDetection.WebImage\x12U\n\x17partial_matching_images\x18\x05 \x03(\x0b\x32\x34.google.cloud.vision.v1p1beta1.WebDetection.WebImage\x1a\x30\n\x08WebLabel\x12\r\n\x05label\x18\x01 \x01(\t\x12\x15\n\rlanguage_code\x18\x02 \x01(\tB\x80\x01\n!com.google.cloud.vision.v1p1beta1B\x11WebDetectionProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision\xf8\x01\x01\x62\x06proto3') , dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,]) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -41,21 +40,21 @@ has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='score', full_name='google.cloud.vision.v1p1beta1.WebDetection.WebEntity.score', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='description', full_name='google.cloud.vision.v1p1beta1.WebDetection.WebEntity.description', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -85,14 +84,14 @@ has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='score', full_name='google.cloud.vision.v1p1beta1.WebDetection.WebImage.score', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -122,35 +121,35 @@ has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='score', full_name='google.cloud.vision.v1p1beta1.WebDetection.WebPage.score', index=1, number=2, type=2, cpp_type=6, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='page_title', full_name='google.cloud.vision.v1p1beta1.WebDetection.WebPage.page_title', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='full_matching_images', full_name='google.cloud.vision.v1p1beta1.WebDetection.WebPage.full_matching_images', index=3, number=4, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='partial_matching_images', full_name='google.cloud.vision.v1p1beta1.WebDetection.WebPage.partial_matching_images', index=4, number=5, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -180,14 +179,14 @@ has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='language_code', full_name='google.cloud.vision.v1p1beta1.WebDetection.WebLabel.language_code', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -217,42 +216,42 @@ has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='full_matching_images', full_name='google.cloud.vision.v1p1beta1.WebDetection.full_matching_images', index=1, number=2, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='partial_matching_images', full_name='google.cloud.vision.v1p1beta1.WebDetection.partial_matching_images', index=2, number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='pages_with_matching_images', full_name='google.cloud.vision.v1p1beta1.WebDetection.pages_with_matching_images', index=3, number=4, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='visually_similar_images', full_name='google.cloud.vision.v1p1beta1.WebDetection.visually_similar_images', index=4, number=6, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='best_guess_labels', full_name='google.cloud.vision.v1p1beta1.WebDetection.best_guess_labels', index=5, number=8, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - options=None), + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -282,6 +281,7 @@ _WEBDETECTION.fields_by_name['visually_similar_images'].message_type = _WEBDETECTION_WEBIMAGE _WEBDETECTION.fields_by_name['best_guess_labels'].message_type = _WEBDETECTION_WEBLABEL DESCRIPTOR.message_types_by_name['WebDetection'] = _WEBDETECTION +_sym_db.RegisterFileDescriptor(DESCRIPTOR) WebDetection = _reflection.GeneratedProtocolMessageType('WebDetection', (_message.Message,), dict( @@ -402,14 +402,4 @@ DESCRIPTOR.has_options = True DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n!com.google.cloud.vision.v1p1beta1B\021WebDetectionProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision\370\001\001')) -try: - # THESE ELEMENTS WILL BE DEPRECATED. - # Please use the generated *_pb2_grpc.py files instead. - import grpc - from grpc.beta import implementations as beta_implementations - from grpc.beta import interfaces as beta_interfaces - from grpc.framework.common import cardinality - from grpc.framework.interfaces.face import utilities as face_utilities -except ImportError: - pass # @@protoc_insertion_point(module_scope) diff --git a/vision/google/cloud/vision_v1p1beta1/types.py b/vision/google/cloud/vision_v1p1beta1/types.py index f31430e48f47..53d005ceb34b 100644 --- a/vision/google/cloud/vision_v1p1beta1/types.py +++ b/vision/google/cloud/vision_v1p1beta1/types.py @@ -1,10 +1,10 @@ -# Copyright 2017, Google LLC All rights reserved. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -15,7 +15,13 @@ from __future__ import absolute_import import sys +from google.api_core.protobuf_helpers import get_messages + from google.api import http_pb2 +from google.cloud.vision_v1p1beta1.proto import geometry_pb2 +from google.cloud.vision_v1p1beta1.proto import image_annotator_pb2 +from google.cloud.vision_v1p1beta1.proto import text_annotation_pb2 +from google.cloud.vision_v1p1beta1.proto import web_detection_pb2 from google.protobuf import any_pb2 from google.protobuf import descriptor_pb2 from google.protobuf import wrappers_pb2 @@ -23,38 +29,20 @@ from google.type import color_pb2 from google.type import latlng_pb2 -from google.api_core.protobuf_helpers import get_messages -from google.cloud.vision_v1p1beta1.proto import geometry_pb2 -from google.cloud.vision_v1p1beta1.proto import image_annotator_pb2 -from google.cloud.vision_v1p1beta1.proto import text_annotation_pb2 -from google.cloud.vision_v1p1beta1.proto import web_detection_pb2 - - -_shared_modules = [ - http_pb2, - any_pb2, - descriptor_pb2, - wrappers_pb2, - status_pb2, - color_pb2, - latlng_pb2, -] - -_local_modules = [ - geometry_pb2, - image_annotator_pb2, - text_annotation_pb2, - web_detection_pb2, -] - names = [] - -for module in _shared_modules: - for name, message in get_messages(module).items(): - setattr(sys.modules[__name__], name, message) - names.append(name) - -for module in _local_modules: +for module in ( + http_pb2, + geometry_pb2, + image_annotator_pb2, + text_annotation_pb2, + web_detection_pb2, + any_pb2, + descriptor_pb2, + wrappers_pb2, + status_pb2, + color_pb2, + latlng_pb2, +): for name, message in get_messages(module).items(): message.__module__ = 'google.cloud.vision_v1p1beta1.types' setattr(sys.modules[__name__], name, message) diff --git a/vision/google/cloud/vision_v1p2beta1/gapic/enums.py b/vision/google/cloud/vision_v1p2beta1/gapic/enums.py index 3cefc9e613ea..6b6cf6f28acb 100644 --- a/vision/google/cloud/vision_v1p2beta1/gapic/enums.py +++ b/vision/google/cloud/vision_v1p2beta1/gapic/enums.py @@ -13,8 +13,10 @@ # limitations under the License. """Wrappers for protocol buffer enum types.""" +import enum -class Likelihood(object): + +class Likelihood(enum.IntEnum): """ A bucketized representation of likelihood, which is intended to give clients highly stable results across model upgrades. @@ -37,7 +39,7 @@ class Likelihood(object): class TextAnnotation(object): class DetectedBreak(object): - class BreakType(object): + class BreakType(enum.IntEnum): """ Enum to denote the type of break found. New line, space etc. @@ -59,7 +61,7 @@ class BreakType(object): class Block(object): - class BlockType(object): + class BlockType(enum.IntEnum): """ Type of a block (text, image etc) as identified by OCR. @@ -80,7 +82,7 @@ class BlockType(object): class Feature(object): - class Type(object): + class Type(enum.IntEnum): """ Type of Google Cloud Vision API feature to be extracted. @@ -117,7 +119,7 @@ class Type(object): class FaceAnnotation(object): class Landmark(object): - class Type(object): + class Type(enum.IntEnum): """ Face landmark (feature) type. Left and right are defined from the vantage of the viewer of the image @@ -199,7 +201,7 @@ class Type(object): class OperationMetadata(object): - class State(object): + class State(enum.IntEnum): """ Batch operation states. diff --git a/vision/google/cloud/vision_v1p2beta1/gapic/image_annotator_client.py b/vision/google/cloud/vision_v1p2beta1/gapic/image_annotator_client.py index d9b0b8214776..df38910774c6 100644 --- a/vision/google/cloud/vision_v1p2beta1/gapic/image_annotator_client.py +++ b/vision/google/cloud/vision_v1p2beta1/gapic/image_annotator_client.py @@ -21,6 +21,7 @@ import google.api_core.grpc_helpers import google.api_core.operation import google.api_core.operations_v1 +import grpc from google.cloud.vision_v1p2beta1.gapic import enums from google.cloud.vision_v1p2beta1.gapic import image_annotator_client_config @@ -85,50 +86,60 @@ def __init__(self, 'exclusive.'.format(self.__class__.__name__), ) # Create the channel. - if channel is None: - channel = google.api_core.grpc_helpers.create_channel( + self.channel = channel + if self.channel is None: + self.channel = google.api_core.grpc_helpers.create_channel( self.SERVICE_ADDRESS, credentials=credentials, scopes=self._DEFAULT_SCOPES, ) # Create the gRPC stubs. - self.image_annotator_stub = ( - image_annotator_pb2_grpc.ImageAnnotatorStub(channel)) + self._image_annotator_stub = ( + image_annotator_pb2_grpc.ImageAnnotatorStub(self.channel)) # Operations client for methods that return long-running operations # futures. - self.operations_client = ( - google.api_core.operations_v1.OperationsClient(channel)) + self._operations_client = ( + google.api_core.operations_v1.OperationsClient(self.channel)) if client_info is None: client_info = ( google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO) client_info.gapic_version = _GAPIC_LIBRARY_VERSION + self._client_info = client_info # Parse out the default settings for retry and timeout for each RPC # from the client configuration. # (Ordinarily, these are the defaults specified in the `*_config.py` # file next to this one.) - method_configs = google.api_core.gapic_v1.config.parse_method_configs( + self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( client_config['interfaces'][self._INTERFACE_NAME], ) - # Write the "inner API call" methods to the class. - # These are wrapped versions of the gRPC stub methods, with retry and - # timeout configuration applied, called by the public methods on - # this class. - self._batch_annotate_images = google.api_core.gapic_v1.method.wrap_method( - self.image_annotator_stub.BatchAnnotateImages, - default_retry=method_configs['BatchAnnotateImages'].retry, - default_timeout=method_configs['BatchAnnotateImages'].timeout, - client_info=client_info, - ) - self._async_batch_annotate_files = google.api_core.gapic_v1.method.wrap_method( - self.image_annotator_stub.AsyncBatchAnnotateFiles, - default_retry=method_configs['AsyncBatchAnnotateFiles'].retry, - default_timeout=method_configs['AsyncBatchAnnotateFiles'].timeout, - client_info=client_info, - ) + self._inner_api_calls = {} + + def _intercept_channel(self, *interceptors): + """ Experimental. Bind gRPC interceptors to the gRPC channel. + + Args: + interceptors (*Union[grpc.UnaryUnaryClientInterceptor, grpc.UnaryStreamingClientInterceptor, grpc.StreamingUnaryClientInterceptor, grpc.StreamingStreamingClientInterceptor]): + Zero or more gRPC interceptors. Interceptors are given control in the order + they are listed. + Raises: + TypeError: If interceptor does not derive from any of + UnaryUnaryClientInterceptor, + UnaryStreamClientInterceptor, + StreamUnaryClientInterceptor, or + StreamStreamClientInterceptor. + """ + self.channel = grpc.intercept_channel(self.channel, *interceptors) + self._image_annotator_stub = ( + image_annotator_pb2_grpc.ImageAnnotatorStub(self.channel)) + # Operations client for methods that return long-running operations + # futures. + self._operations_client = ( + google.api_core.operations_v1.OperationsClient(self.channel)) + self._inner_api_calls.clear() # Service calls def batch_annotate_images(self, @@ -172,12 +183,20 @@ def batch_annotate_images(self, to a retryable error and retry attempts failed. ValueError: If the parameters are invalid. """ - if metadata is None: - metadata = [] - metadata = list(metadata) + if 'batch_annotate_images' not in self._inner_api_calls: + self._inner_api_calls[ + 'batch_annotate_images'] = google.api_core.gapic_v1.method.wrap_method( + self._image_annotator_stub.BatchAnnotateImages, + default_retry=self._method_configs[ + 'BatchAnnotateImages'].retry, + default_timeout=self._method_configs['BatchAnnotateImages'] + .timeout, + client_info=self._client_info, + ) + request = image_annotator_pb2.BatchAnnotateImagesRequest( requests=requests, ) - return self._batch_annotate_images( + return self._inner_api_calls['batch_annotate_images']( request, retry=retry, timeout=timeout, metadata=metadata) def async_batch_annotate_files( @@ -236,16 +255,24 @@ def async_batch_annotate_files( to a retryable error and retry attempts failed. ValueError: If the parameters are invalid. """ - if metadata is None: - metadata = [] - metadata = list(metadata) + if 'async_batch_annotate_files' not in self._inner_api_calls: + self._inner_api_calls[ + 'async_batch_annotate_files'] = google.api_core.gapic_v1.method.wrap_method( + self._image_annotator_stub.AsyncBatchAnnotateFiles, + default_retry=self._method_configs[ + 'AsyncBatchAnnotateFiles'].retry, + default_timeout=self._method_configs[ + 'AsyncBatchAnnotateFiles'].timeout, + client_info=self._client_info, + ) + request = image_annotator_pb2.AsyncBatchAnnotateFilesRequest( requests=requests, ) - operation = self._async_batch_annotate_files( + operation = self._inner_api_calls['async_batch_annotate_files']( request, retry=retry, timeout=timeout, metadata=metadata) return google.api_core.operation.from_gapic( operation, - self.operations_client, + self._operations_client, image_annotator_pb2.AsyncBatchAnnotateFilesResponse, metadata_type=image_annotator_pb2.OperationMetadata, ) diff --git a/vision/google/cloud/vision_v1p2beta1/types.py b/vision/google/cloud/vision_v1p2beta1/types.py index 4c10ca08cc7e..ee4a83eb5179 100644 --- a/vision/google/cloud/vision_v1p2beta1/types.py +++ b/vision/google/cloud/vision_v1p2beta1/types.py @@ -15,7 +15,13 @@ from __future__ import absolute_import import sys +from google.api_core.protobuf_helpers import get_messages + from google.api import http_pb2 +from google.cloud.vision_v1p2beta1.proto import geometry_pb2 +from google.cloud.vision_v1p2beta1.proto import image_annotator_pb2 +from google.cloud.vision_v1p2beta1.proto import text_annotation_pb2 +from google.cloud.vision_v1p2beta1.proto import web_detection_pb2 from google.longrunning import operations_pb2 from google.protobuf import any_pb2 from google.protobuf import descriptor_pb2 @@ -26,41 +32,23 @@ from google.type import color_pb2 from google.type import latlng_pb2 -from google.api_core.protobuf_helpers import get_messages -from google.cloud.vision_v1p2beta1.proto import geometry_pb2 -from google.cloud.vision_v1p2beta1.proto import image_annotator_pb2 -from google.cloud.vision_v1p2beta1.proto import text_annotation_pb2 -from google.cloud.vision_v1p2beta1.proto import web_detection_pb2 - - -_shared_modules = [ - http_pb2, - operations_pb2, - any_pb2, - descriptor_pb2, - empty_pb2, - timestamp_pb2, - wrappers_pb2, - status_pb2, - color_pb2, - latlng_pb2, -] - -_local_modules = [ - geometry_pb2, - image_annotator_pb2, - text_annotation_pb2, - web_detection_pb2, -] - names = [] - -for module in _shared_modules: - for name, message in get_messages(module).items(): - setattr(sys.modules[__name__], name, message) - names.append(name) - -for module in _local_modules: +for module in ( + http_pb2, + geometry_pb2, + image_annotator_pb2, + text_annotation_pb2, + web_detection_pb2, + operations_pb2, + any_pb2, + descriptor_pb2, + empty_pb2, + timestamp_pb2, + wrappers_pb2, + status_pb2, + color_pb2, + latlng_pb2, +): for name, message in get_messages(module).items(): message.__module__ = 'google.cloud.vision_v1p2beta1.types' setattr(sys.modules[__name__], name, message) diff --git a/vision/synth.py b/vision/synth.py new file mode 100644 index 000000000000..c61df1d4213a --- /dev/null +++ b/vision/synth.py @@ -0,0 +1,33 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +from synthtool import gcp + +gapic = gcp.GAPICGenerator() + +versions = ['v1', 'v1p1beta1', 'v1p2beta1'] + + +for version in versions: + library = gapic.py_library('vision', version) + + s.move(library / f'google/cloud/vision_{version}/gapic') + # Don't move over __init__.py, as we modify it to make ImageAnnotatorClient + # use vision_helpers. + s.move(library / f'google/cloud/vision_{version}/types.py') + s.move(library / f'google/cloud/vision_{version}/proto') + s.move(library / f'tests/unit/gapic/{version}') diff --git a/vision/tests/unit/gapic/v1/test_image_annotator_client_v1.py b/vision/tests/unit/gapic/v1/test_image_annotator_client_v1.py index d4edc5786bbb..434bba70d4bf 100644 --- a/vision/tests/unit/gapic/v1/test_image_annotator_client_v1.py +++ b/vision/tests/unit/gapic/v1/test_image_annotator_client_v1.py @@ -15,8 +15,11 @@ import pytest +from google.rpc import status_pb2 + from google.cloud import vision_v1 from google.cloud.vision_v1.proto import image_annotator_pb2 +from google.longrunning import operations_pb2 class MultiCallableStub(object): @@ -91,3 +94,48 @@ def test_batch_annotate_images_exception(self): with pytest.raises(CustomException): client.batch_annotate_images(requests) + + def test_async_batch_annotate_files(self): + # Setup Expected Response + expected_response = {} + expected_response = image_annotator_pb2.AsyncBatchAnnotateFilesResponse( + **expected_response) + operation = operations_pb2.Operation( + name='operations/test_async_batch_annotate_files', done=True) + operation.response.Pack(expected_response) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + client = vision_v1.ImageAnnotatorClient(channel=channel) + + # Setup Request + requests = [] + + response = client.async_batch_annotate_files(requests) + result = response.result() + assert expected_response == result + + assert len(channel.requests) == 1 + expected_request = image_annotator_pb2.AsyncBatchAnnotateFilesRequest( + requests=requests) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_async_batch_annotate_files_exception(self): + # Setup Response + error = status_pb2.Status() + operation = operations_pb2.Operation( + name='operations/test_async_batch_annotate_files_exception', + done=True) + operation.error.CopyFrom(error) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + client = vision_v1.ImageAnnotatorClient(channel=channel) + + # Setup Request + requests = [] + + response = client.async_batch_annotate_files(requests) + exception = response.exception() + assert exception.errors[0] == error diff --git a/vision/tests/unit/gapic/v1p1beta1/test_image_annotator_client_v1p1beta1.py b/vision/tests/unit/gapic/v1p1beta1/test_image_annotator_client_v1p1beta1.py index 0677fbdc02f2..25d586a8901d 100644 --- a/vision/tests/unit/gapic/v1p1beta1/test_image_annotator_client_v1p1beta1.py +++ b/vision/tests/unit/gapic/v1p1beta1/test_image_annotator_client_v1p1beta1.py @@ -1,10 +1,10 @@ -# Copyright 2017, Google LLC All rights reserved. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,