Skip to content

Commit

Permalink
Web detection constant (googleapis#3073)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukesneeringer authored Feb 26, 2017
1 parent e9ca7f9 commit 467859a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions vision/google/cloud/vision/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -43,7 +43,7 @@
'logoAnnotations': 'logos',
_SAFE_SEARCH_ANNOTATION: 'safe_searches',
'textAnnotations': 'texts',
_WEB_ANNOTATION: 'web',
_WEB_DETECTION: 'web',
}


Expand Down Expand Up @@ -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', [])
Expand Down
2 changes: 1 addition & 1 deletion vision/google/cloud/vision/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion vision/google/cloud/vision/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion vision/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[
Expand Down
2 changes: 1 addition & 1 deletion vision/unit_tests/_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@
}


WEB_ANNOTATION_RESPONSE = {
WEB_DETECTION_RESPONSE = {
'responses': [
{
'webDetection': {
Expand Down
6 changes: 3 additions & 3 deletions vision/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 467859a

Please sign in to comment.