File tree Expand file tree Collapse file tree
vision/google/cloud/vision Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -220,15 +220,17 @@ def _entity_from_response_type(feature_type, results):
220220
221221 detected_objects = []
222222 feature_key = _REVERSE_TYPES [feature_type ]
223- annotations = results .get (feature_key , [])
223+ annotations = results .get (feature_key , ())
224+ if not annotations :
225+ return []
224226
225227 if feature_type == _FACE_DETECTION :
226228 detected_objects .extend (
227229 Face .from_api_repr (face ) for face in annotations )
228- elif feature_type == _IMAGE_PROPERTIES and annotations :
230+ elif feature_type == _IMAGE_PROPERTIES :
229231 detected_objects .append (
230232 ImagePropertiesAnnotation .from_api_repr (annotations ))
231- elif feature_type == _SAFE_SEARCH_DETECTION and annotations :
233+ elif feature_type == _SAFE_SEARCH_DETECTION :
232234 detected_objects .append (
233235 SafeSearchAnnotation .from_api_repr (annotations ))
234236 else :
You can’t perform that action at this time.
0 commit comments