Skip to content

Commit 5847d7a

Browse files
fix(lint): update code based on pylint
1 parent 180d48e commit 5847d7a

24 files changed

Lines changed: 35 additions & 82 deletions

examples/conversation_tone_analyzer_integration/tone_conversation_integration.v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def invokeToneConversation(payload, maintainToneHistoryInContext):
5858
with application-specific code to process the err or data object
5959
returned by the Conversation Service.
6060
"""
61-
tone = tone_analyzer.tone(tone_input=payload['input']['text'])
61+
tone = tone_analyzer.tone(tone_input=payload['input']['text'], content_type='application/json')
6262
conversation_payload = tone_detection.\
6363
updateUserTone(payload, tone, maintainToneHistoryInContext)
6464
response = conversation.message(workspace_id=workspace_id,

test/integration/__init__.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
# coding: utf-8
2-
3-
# Copyright 2015 IBM All Rights Reserved.
4-
#
5-
# Licensed under the Apache License, Version 2.0 (the "License");
6-
# you may not use this file except in compliance with the License.
7-
# You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing, software
12-
# distributed under the License is distributed on an "AS IS" BASIS,
13-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
# See the License for the specific language governing permissions and
15-
# limitations under the License.
2+
from __future__ import print_function
163
from dotenv import load_dotenv, find_dotenv
174

185
# load the .env file containing your environment variables for the required
19-
load_dotenv(find_dotenv())
6+
try:
7+
load_dotenv(find_dotenv())
8+
except:
9+
print('warning: no .env file loaded')

test/integration/test_examples.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,6 @@
1515
# examples path. /examples
1616
examples_path = join(dirname(__file__), '../', 'examples', '*.py')
1717

18-
# environment variables
19-
try:
20-
from dotenv import load_dotenv # pylint: disable=C0413
21-
except:
22-
print ('warning: dotenv module could not be imported')
23-
24-
try:
25-
dotenv_path = join(dirname(__file__), '../', '.env')
26-
load_dotenv(dotenv_path)
27-
except:
28-
print ('warning: no .env file loaded')
29-
30-
3118
@pytest.mark.skipif(os.getenv('VCAP_SERVICES') is None,
3219
reason='requires VCAP_SERVICES')
3320
def test_examples():

test/integration/test_integration_discovery_v1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# coding: utf-8
2-
32
from unittest import TestCase
43
import os
54
import watson_developer_cloud

test/integration/test_integration_speech_to_text_v1.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
from unittest import TestCase
23
import os
34
import watson_developer_cloud
@@ -52,7 +53,7 @@ def test_recognitions(self):
5253

5354
def test_custom_corpora(self):
5455
output = self.speech_to_text.list_corpora(self.customization_id)
55-
assert len(output['corpora']) == 0
56+
assert output['corpora']
5657

5758
def test_acoustic_model(self):
5859
list_models = self.speech_to_text.list_acoustic_models()

test/integration/test_integration_text_to_speech_v1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
# coding: utf-8
22
import unittest
33
import watson_developer_cloud
44

@@ -47,7 +47,7 @@ def test_customizations(self):
4747
def test_custom_words(self):
4848
customization_id = self.created_customization['customization_id']
4949
words = self.text_to_speech.list_words(customization_id)['words']
50-
assert len(words) == 0
50+
assert words
5151
self.text_to_speech.add_word(
5252
customization_id, word="ACLs", translation="ackles")
5353

test/integration/test_integration_visual_recognition.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
import pytest
23
import watson_developer_cloud
34
import os

test/unit/__init__.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
# Copyright 2015 IBM All Rights Reserved.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
1+
# coding: utf-8
2+
from __future__ import print_function
143
from dotenv import load_dotenv, find_dotenv
154

165
# load the .env file containing your environment variables for the required
17-
load_dotenv(find_dotenv())
6+
try:
7+
load_dotenv(find_dotenv())
8+
except:
9+
print('warning: no .env file loaded')

test/unit/test_conversation_v1.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
1-
# Copyright 2017 IBM All Rights Reserved.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
1+
# coding: utf-8
152
import json
163
import datetime
174
from dateutil.tz import tzutc

test/unit/test_discovery_v1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
import responses
23
import os
34
import json

0 commit comments

Comments
 (0)