Skip to content

Commit d358373

Browse files
committed
pylint fixes
1 parent 904713f commit d358373

4 files changed

Lines changed: 15 additions & 17 deletions

File tree

watson_developer_cloud/alchemy_language_v1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def keywords(self, html=None, text=None, url=None,
5151
if not max_items:
5252
max_items = max_keywords
5353
params = {
54-
'keywordExtractMode': 'strict' if strict_extract_mode else
55-
'normal',
54+
'keywordExtractMode':
55+
'strict' if strict_extract_mode else 'normal',
5656
'sentiment': sentiment,
5757
'emotion': emotion,
5858
'showSourceText': show_source_text,

watson_developer_cloud/retrieve_and_rank_v1.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ def get_config(self, solr_cluster_id, config_name):
8181
def list_collections(self, solr_cluster_id):
8282
params = {'action': 'LIST', 'wt': 'json'}
8383
return self.request(method='GET',
84-
url='/v1/solr_clusters/{'
85-
'0}/solr/admin/collections'.format(
86-
solr_cluster_id),
84+
url='/v1/solr_clusters/{0}/solr/admin/collections'
85+
.format(solr_cluster_id),
8786
params=params, accept_json=True)
8887

8988
def create_collection(self, solr_cluster_id, collection_name, config_name):

watson_developer_cloud/visual_recognition_v3.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def _image_call(self, url, images_file=None, images_url=None, params=None):
124124
accept_json=True)
125125
else:
126126
filename = images_file.name
127-
mime_type = mimetypes.guess_type(filename)[
128-
0] or 'application/octet-stream'
127+
mime_type = mimetypes.guess_type(
128+
filename)[0] or 'application/octet-stream'
129129
return self.request(method='POST', url=url,
130130
files={'images_file': (
131131
filename, images_file, mime_type)},
@@ -241,15 +241,15 @@ def add_image(self, collection_id, image_file, metadata=None):
241241
"""
242242
metadata = metadata or {}
243243
filename = image_file.name
244-
mime_type = mimetypes.guess_type(filename)[
245-
0] or 'application/octet-stream'
244+
mime_type = mimetypes.guess_type(
245+
filename)[0] or 'application/octet-stream'
246246
return self.request(method='POST',
247247
url='/v3/collections/{0}/images'.format(
248248
collection_id),
249249
params={'version': self.version},
250250
files={
251251
'image_file': (
252-
filename, image_file, mime_type),
252+
filename, image_file, mime_type),
253253
'metadata': (
254254
'metadata.json', json.dumps(metadata),
255255
'application/json')},
@@ -360,8 +360,8 @@ def find_similar(self, collection_id, image_file, limit=10):
360360
"images_processed": 1
361361
}
362362
"""
363-
mime_type = mimetypes.guess_type(image_file.name)[
364-
0] or 'application/octet-stream'
363+
mime_type = mimetypes.guess_type(
364+
image_file.name)[0] or 'application/octet-stream'
365365
return self.request(method='POST',
366366
url='/v3/collections/{0}/find_similar'.format(
367367
collection_id),

watson_developer_cloud/watson_developer_cloud_service.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ def __init__(self, vcap_services_name, url, username=None, password=None,
125125
if 'api_key' in self.vcap_service_credentials:
126126
self.api_key = self.vcap_service_credentials['api_key']
127127

128-
if (
129-
self.username is None or self.password is None) and \
130-
self.api_key is None:
128+
if (self.username is None or self.password is None)\
129+
and self.api_key is None:
131130
raise WatsonException(
132131
'You must specify your username and password service '
133132
'credentials ' +
@@ -301,8 +300,8 @@ def request(self, method, url, accept_json=False, headers=None,
301300
if 200 <= response.status_code <= 299:
302301
if accept_json:
303302
response_json = response.json()
304-
if 'status' in response_json and response_json[
305-
'status'] == 'ERROR':
303+
if 'status' in response_json and response_json['status'] \
304+
== 'ERROR':
306305
response.status_code = 400
307306
error_message = 'Unknown error'
308307
if 'statusInfo' in response_json:

0 commit comments

Comments
 (0)