diff --git a/chatterbot/chatterbot.py b/chatterbot/chatterbot.py index 46922f9aa..c12bc7563 100644 --- a/chatterbot/chatterbot.py +++ b/chatterbot/chatterbot.py @@ -168,24 +168,3 @@ def train(self): Proxy method to the chat bot's trainer class. """ return self.trainer.train - - @classmethod - def from_config(cls, config_file_path): - """ - Create a new ChatBot instance from a JSON config file. - """ - import json - import warnings - - warnings.warn( - 'The from_config method is deprecated and ' - 'will be removed in ChatterBot version 0.8.', - DeprecationWarning - ) - - with open(config_file_path, 'r') as config_file: - data = json.load(config_file) - - name = data.pop('name') - - return ChatBot(name, **data) diff --git a/chatterbot/logic/multi_adapter.py b/chatterbot/logic/multi_adapter.py index 2c5b9be7b..17e91f4d1 100644 --- a/chatterbot/logic/multi_adapter.py +++ b/chatterbot/logic/multi_adapter.py @@ -1,5 +1,4 @@ from __future__ import unicode_literals -import warnings from collections import Counter from chatterbot import utils from .logic_adapter import LogicAdapter @@ -50,16 +49,6 @@ def process(self, statement): if adapter.can_process(statement): output = adapter.process(statement) - - if type(output) == tuple: - warnings.warn( - '{} returned two values when just a Statement object was expected. ' - 'You should update your logic adapter to return just the Statement object. ' - 'Make sure that statement.confidence is being set.'.format(adapter.class_name), - DeprecationWarning - ) - output = output[1] - results.append((output.confidence, output, )) self.logger.info( diff --git a/tests/test_chatbot.py b/tests/test_chatbot.py index 69bece366..d7c5bec46 100644 --- a/tests/test_chatbot.py +++ b/tests/test_chatbot.py @@ -165,29 +165,3 @@ def test_update_does_not_add_new_statement(self): self.assertEqual(response, self.test_statement.text) self.assertIsNone(statement_found) - - -class ChatBotConfigFileTestCase(ChatBotTestCase): - - def setUp(self): - super(ChatBotConfigFileTestCase, self).setUp() - import json - self.config_file_path = './test-config.json' - self.data = self.get_kwargs() - self.data['name'] = 'Config Test' - - with open(self.config_file_path, 'w+') as config_file: - json.dump(self.data, config_file) - - def tearDown(self): - super(ChatBotConfigFileTestCase, self).tearDown() - import os - - if os.path.exists(self.config_file_path): - os.remove(self.config_file_path) - - def test_read_from_config_file(self): - from chatterbot import ChatBot - self.chatbot = ChatBot.from_config(self.config_file_path) - - self.assertEqual(self.chatbot.name, self.data['name'])