Skip to content

Commit a4311fb

Browse files
committed
refactor: keep cout as required param
1 parent 9df9968 commit a4311fb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

ibm_watson/visual_recognition_v4.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,10 @@ def analyze(self,
137137
params = {'version': self.version}
138138

139139
form_data = []
140-
for item in collection_ids:
141-
form_data.append(
142-
('collection_ids', (None, item, 'application/json')))
143-
for item in features:
144-
form_data.append(('features', (None, item, 'application/json')))
140+
collection_ids = self._convert_list(collection_ids)
141+
form_data.append(('collection_ids', (None, collection_ids, 'text/plain')))
142+
features = self._convert_list(features)
143+
form_data.append(('features', (None, features, 'text/plain')))
145144
if images_file:
146145
for item in images_file:
147146
form_data.append(('images_file', (item.filename, item.data,
@@ -3144,18 +3143,18 @@ class UpdateObjectMetadata():
31443143
:attr str object: The updated name of the object. The name can contain
31453144
alphanumeric, underscore, hyphen, space, and dot characters. It cannot begin
31463145
with the reserved prefix `sys-`.
3147-
:attr int count: (optional) Number of bounding boxes in the collection with the
3146+
:attr int count: Number of bounding boxes in the collection with the
31483147
updated object name.
31493148
"""
31503149

3151-
def __init__(self, object: str, *, count: int = None) -> None:
3150+
def __init__(self, object: str, count: int) -> None:
31523151
"""
31533152
Initialize a UpdateObjectMetadata object.
31543153
31553154
:param str object: The updated name of the object. The name can contain
31563155
alphanumeric, underscore, hyphen, space, and dot characters. It cannot
31573156
begin with the reserved prefix `sys-`.
3158-
:param int count: (optional) Number of bounding boxes in the collection
3157+
:param int count: Number of bounding boxes in the collection
31593158
with the updated object name.
31603159
"""
31613160
self.object = object
@@ -3179,6 +3178,10 @@ def from_dict(cls, _dict: Dict) -> 'UpdateObjectMetadata':
31793178
)
31803179
if 'count' in _dict:
31813180
args['count'] = _dict.get('count')
3181+
else:
3182+
raise ValueError(
3183+
'Required property \'count\' not present in UpdateObjectMetadata JSON'
3184+
)
31823185
return cls(**args)
31833186

31843187
@classmethod

0 commit comments

Comments
 (0)