Skip to content

Commit

Permalink
Remove features marked as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Jan 26, 2018
1 parent d30dd94 commit 8958b95
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 58 deletions.
21 changes: 0 additions & 21 deletions chatterbot/chatterbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 0 additions & 11 deletions chatterbot/logic/multi_adapter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from __future__ import unicode_literals
import warnings
from collections import Counter
from chatterbot import utils
from .logic_adapter import LogicAdapter
Expand Down Expand Up @@ -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(
Expand Down
26 changes: 0 additions & 26 deletions tests/test_chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])

0 comments on commit 8958b95

Please sign in to comment.