From 1e50f1fff76b49c179f85cacb4872a5c7ac9ce3a Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Sat, 25 Feb 2017 15:22:41 -0800 Subject: [PATCH 1/2] Amend missed find/replace for WEB_DETECTION rename. --- vision/google/cloud/vision/annotations.py | 6 +++--- vision/google/cloud/vision/feature.py | 2 +- vision/google/cloud/vision/image.py | 2 +- vision/unit_tests/_fixtures.py | 2 +- vision/unit_tests/test_client.py | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/vision/google/cloud/vision/annotations.py b/vision/google/cloud/vision/annotations.py index eed9ebdc5d61..402ea01172a7 100644 --- a/vision/google/cloud/vision/annotations.py +++ b/vision/google/cloud/vision/annotations.py @@ -31,7 +31,7 @@ _FULL_TEXT_ANNOTATION = 'fullTextAnnotation' _IMAGE_PROPERTIES_ANNOTATION = 'imagePropertiesAnnotation' _SAFE_SEARCH_ANNOTATION = 'safeSearchAnnotation' -_WEB_ANNOTATION = 'webDetection' +_WEB_DETECTION = 'webDetection' _KEY_MAP = { _CROP_HINTS_ANNOTATION: 'crop_hints', @@ -43,7 +43,7 @@ 'logoAnnotations': 'logos', _SAFE_SEARCH_ANNOTATION: 'safe_searches', 'textAnnotations': 'texts', - _WEB_ANNOTATION: 'web', + _WEB_DETECTION: 'web', } @@ -275,7 +275,7 @@ def _entity_from_response_type(feature_type, results): return ImagePropertiesAnnotation.from_api_repr(results) elif feature_type == _SAFE_SEARCH_ANNOTATION: return SafeSearchAnnotation.from_api_repr(results) - elif feature_type == _WEB_ANNOTATION: + elif feature_type == _WEB_DETECTION: return WebDetection.from_api_repr(results) elif feature_type == _CROP_HINTS_ANNOTATION: crop_hints = results.get('cropHints', []) diff --git a/vision/google/cloud/vision/feature.py b/vision/google/cloud/vision/feature.py index df7d5f5a1e7d..60bf87954add 100644 --- a/vision/google/cloud/vision/feature.py +++ b/vision/google/cloud/vision/feature.py @@ -31,7 +31,7 @@ class FeatureTypes(object): TEXT_DETECTION = 'TEXT_DETECTION' SAFE_SEARCH_DETECTION = 'SAFE_SEARCH_DETECTION' IMAGE_PROPERTIES = 'IMAGE_PROPERTIES' - WEB_ANNOTATION = 'WEB_ANNOTATION' + WEB_DETECTION = 'WEB_DETECTION' class Feature(object): diff --git a/vision/google/cloud/vision/image.py b/vision/google/cloud/vision/image.py index 7ff6ad87c2bb..e0e0858301ec 100644 --- a/vision/google/cloud/vision/image.py +++ b/vision/google/cloud/vision/image.py @@ -288,6 +288,6 @@ def detect_web(self, limit=10): :returns: List of :class:`~google.cloud.vision.entity.EntityAnnotation`. """ - features = [Feature(FeatureTypes.WEB_ANNOTATION, limit)] + features = [Feature(FeatureTypes.WEB_DETECTION, limit)] annotations = self.detect(features) return annotations[0].web diff --git a/vision/unit_tests/_fixtures.py b/vision/unit_tests/_fixtures.py index 111e0d82ed08..6075fb2eea31 100644 --- a/vision/unit_tests/_fixtures.py +++ b/vision/unit_tests/_fixtures.py @@ -1961,7 +1961,7 @@ } -WEB_ANNOTATION_RESPONSE = { +WEB_DETECTION_RESPONSE = { 'responses': [ { 'webDetection': { diff --git a/vision/unit_tests/test_client.py b/vision/unit_tests/test_client.py index 5fc69ec65ab1..115758329b7a 100644 --- a/vision/unit_tests/test_client.py +++ b/vision/unit_tests/test_client.py @@ -576,9 +576,9 @@ def test_detect_web_detection(self): from google.cloud.vision.web import WebEntity from google.cloud.vision.web import WebImage from google.cloud.vision.web import WebPage - from unit_tests._fixtures import WEB_ANNOTATION_RESPONSE + from unit_tests._fixtures import WEB_DETECTION_RESPONSE - returned = WEB_ANNOTATION_RESPONSE + returned = WEB_DETECTION_RESPONSE credentials = _make_credentials() client = self._make_one(project=PROJECT, credentials=credentials, use_gax=False) @@ -604,7 +604,7 @@ def test_detect_web_detection(self): IMAGE_SOURCE) self.assertEqual(image_request['features'][0]['maxResults'], 2) self.assertEqual(image_request['features'][0]['type'], - 'WEB_ANNOTATION') + 'WEB_DETECTION') class _Connection(object): From b64a2332a4ce6534f42501bfa596de1bd28fb80b Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Sat, 25 Feb 2017 15:23:39 -0800 Subject: [PATCH 2/2] Version bump to 0.23.2 --- vision/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vision/setup.py b/vision/setup.py index 352cad044a10..179ae6ba160b 100644 --- a/vision/setup.py +++ b/vision/setup.py @@ -57,7 +57,7 @@ setup( name='google-cloud-vision', - version='0.23.1', + version='0.23.2', description='Python Client for Google Cloud Vision', long_description=README, namespace_packages=[