From 0aa52204463f296b0fd8a5e771879578ca512a0b Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Mon, 23 Jan 2017 13:36:39 -0500 Subject: [PATCH] Rename safe module to safe_search. --- docs/vision-safe-search.rst | 2 +- system_tests/vision.py | 2 +- vision/google/cloud/vision/annotations.py | 8 ++++---- vision/google/cloud/vision/{safe.py => safe_search.py} | 4 ++-- vision/unit_tests/test_annotations.py | 2 +- vision/unit_tests/test_client.py | 2 +- vision/unit_tests/{test_safe.py => test_safe_search.py} | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) rename vision/google/cloud/vision/{safe.py => safe_search.py} (96%) rename vision/unit_tests/{test_safe.py => test_safe_search.py} (97%) diff --git a/docs/vision-safe-search.rst b/docs/vision-safe-search.rst index f86f675c21ba8..8f84bc5a9d192 100644 --- a/docs/vision-safe-search.rst +++ b/docs/vision-safe-search.rst @@ -4,7 +4,7 @@ Vision Safe Search Safe Search Annotation ~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: google.cloud.vision.safe +.. automodule:: google.cloud.vision.safe_search :members: :undoc-members: :show-inheritance: diff --git a/system_tests/vision.py b/system_tests/vision.py index d19a6d399353e..43bf288759215 100644 --- a/system_tests/vision.py +++ b/system_tests/vision.py @@ -355,7 +355,7 @@ def tearDown(self): value.delete() def _assert_safe_search(self, safe_search): - from google.cloud.vision.safe import SafeSearchAnnotation + from google.cloud.vision.safe_search import SafeSearchAnnotation self.assertIsInstance(safe_search, SafeSearchAnnotation) self._assert_likelihood(safe_search.adult) diff --git a/vision/google/cloud/vision/annotations.py b/vision/google/cloud/vision/annotations.py index 0cc3dcff69921..a19527a96c113 100644 --- a/vision/google/cloud/vision/annotations.py +++ b/vision/google/cloud/vision/annotations.py @@ -19,7 +19,7 @@ from google.cloud.vision.color import ImagePropertiesAnnotation from google.cloud.vision.entity import EntityAnnotation from google.cloud.vision.face import Face -from google.cloud.vision.safe import SafeSearchAnnotation +from google.cloud.vision.safe_search import SafeSearchAnnotation _FACE_ANNOTATIONS = 'faceAnnotations' @@ -61,7 +61,7 @@ class Annotations(object): :type safe_searches: list :param safe_searches: - List of :class:`~google.cloud.vision.safe.SafeSearchAnnotation` + List of :class:`~google.cloud.vision.safe_search.SafeSearchAnnotation` :type texts: list :param texts: List of @@ -179,7 +179,7 @@ def _make_safe_search_from_pb(safe_search): image_annotator_pb2.SafeSearchAnnotation` :param safe_search: Protobuf instance of ``SafeSearchAnnotation``. - :rtype: :class: `~google.cloud.vision.safe.SafeSearchAnnotation` + :rtype: :class: `~google.cloud.vision.safe_search.SafeSearchAnnotation` :returns: Instance of ``SafeSearchAnnotation``. """ return SafeSearchAnnotation.from_pb(safe_search) @@ -195,7 +195,7 @@ def _entity_from_response_type(feature_type, results): or one of - :class:`~google.cloud.vision.safe.SafeSearchAnnotation`, + :class:`~google.cloud.vision.safe_search.SafeSearchAnnotation`, :class:`~google.cloud.vision.color.ImagePropertiesAnnotation`. """ detected_objects = [] diff --git a/vision/google/cloud/vision/safe.py b/vision/google/cloud/vision/safe_search.py similarity index 96% rename from vision/google/cloud/vision/safe.py rename to vision/google/cloud/vision/safe_search.py index 0d8da8f4e338c..121985e5234a8 100644 --- a/vision/google/cloud/vision/safe.py +++ b/vision/google/cloud/vision/safe_search.py @@ -51,7 +51,7 @@ def from_api_repr(cls, response): :param response: Dictionary response from Vision API with safe search data. - :rtype: :class:`~google.cloud.vision.safe.SafeSearchAnnotation` + :rtype: :class:`~google.cloud.vision.safe_search.SafeSearchAnnotation` :returns: Instance of ``SafeSearchAnnotation``. """ adult_likelihood = Likelihood[response['adult']] @@ -70,7 +70,7 @@ def from_pb(cls, image): SafeSearchAnnotation` :param image: Protobuf response from Vision API with safe search data. - :rtype: :class:`~google.cloud.vision.safe.SafeSearchAnnotation` + :rtype: :class:`~google.cloud.vision.safe_search.SafeSearchAnnotation` :returns: Instance of ``SafeSearchAnnotation``. """ values = [image.adult, image.spoof, image.medical, image.violence] diff --git a/vision/unit_tests/test_annotations.py b/vision/unit_tests/test_annotations.py index 1da8d3ddd55bd..68a270e3122df 100644 --- a/vision/unit_tests/test_annotations.py +++ b/vision/unit_tests/test_annotations.py @@ -68,7 +68,7 @@ def test_ctor(self): def test_from_pb(self): from google.cloud.vision.likelihood import Likelihood - from google.cloud.vision.safe import SafeSearchAnnotation + from google.cloud.vision.safe_search import SafeSearchAnnotation from google.cloud.grpc.vision.v1 import image_annotator_pb2 image_response = image_annotator_pb2.AnnotateImageResponse() diff --git a/vision/unit_tests/test_client.py b/vision/unit_tests/test_client.py index 309d40a212ce2..f3f972c1f6cc2 100644 --- a/vision/unit_tests/test_client.py +++ b/vision/unit_tests/test_client.py @@ -410,7 +410,7 @@ def test_text_detection_from_source(self): def test_safe_search_detection_from_source(self): from google.cloud.vision.likelihood import Likelihood - from google.cloud.vision.safe import SafeSearchAnnotation + from google.cloud.vision.safe_search import SafeSearchAnnotation from unit_tests._fixtures import SAFE_SEARCH_DETECTION_RESPONSE RETURNED = SAFE_SEARCH_DETECTION_RESPONSE diff --git a/vision/unit_tests/test_safe.py b/vision/unit_tests/test_safe_search.py similarity index 97% rename from vision/unit_tests/test_safe.py rename to vision/unit_tests/test_safe_search.py index 7292662c82311..5bc06ac47c52c 100644 --- a/vision/unit_tests/test_safe.py +++ b/vision/unit_tests/test_safe_search.py @@ -18,7 +18,7 @@ class TestSafeSearchAnnotation(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.vision.safe import SafeSearchAnnotation + from google.cloud.vision.safe_search import SafeSearchAnnotation return SafeSearchAnnotation def test_safe_search_annotation(self):