diff --git a/chatter/chatterbot/__main__.py b/chatter/chatterbot/__main__.py index a27f483..0322854 100644 --- a/chatter/chatterbot/__main__.py +++ b/chatter/chatterbot/__main__.py @@ -1,6 +1,5 @@ import sys - if __name__ == '__main__': import importlib diff --git a/chatter/chatterbot/corpus.py b/chatter/chatterbot/corpus.py index 65da8eb..4bf0e4b 100644 --- a/chatter/chatterbot/corpus.py +++ b/chatter/chatterbot/corpus.py @@ -5,7 +5,6 @@ View the corpus on GitHub at https://github.com/gunthercox/chatterbot-corpus from chatterbot_corpus import Corpus - __all__ = ( 'Corpus', ) diff --git a/chatter/chatterbot/ext/sqlalchemy_app/models.py b/chatter/chatterbot/ext/sqlalchemy_app/models.py index d30bb75..6a7dc00 100644 --- a/chatter/chatterbot/ext/sqlalchemy_app/models.py +++ b/chatter/chatterbot/ext/sqlalchemy_app/models.py @@ -29,7 +29,6 @@ class ModelBase(object): Base = declarative_base(cls=ModelBase) - tag_association_table = Table( 'tag_association', Base.metadata, diff --git a/chatter/chatterbot/input/microsoft.py b/chatter/chatterbot/input/microsoft.py index 054a9c7..3a255bf 100644 --- a/chatter/chatterbot/input/microsoft.py +++ b/chatter/chatterbot/input/microsoft.py @@ -23,10 +23,10 @@ class Microsoft(InputAdapter): # NOTE: Direct Line client credentials are different from your bot's # credentials - self.direct_line_token_or_secret = kwargs.\ + self.direct_line_token_or_secret = kwargs. \ get('direct_line_token_or_secret') - authorization_header = 'BotConnector {}'.\ + authorization_header = 'BotConnector {}'. \ format(self.direct_line_token_or_secret) self.headers = { @@ -64,7 +64,7 @@ class Microsoft(InputAdapter): def get_most_recent_message(self): import requests - endpoint = '{host}/api/conversations/{id}/messages'\ + endpoint = '{host}/api/conversations/{id}/messages' \ .format(host=self.directline_host, id=self.conversation_id) diff --git a/chatter/chatterbot/input/variable_input_type_adapter.py b/chatter/chatterbot/input/variable_input_type_adapter.py index 199d86b..d2d598c 100644 --- a/chatter/chatterbot/input/variable_input_type_adapter.py +++ b/chatter/chatterbot/input/variable_input_type_adapter.py @@ -5,11 +5,10 @@ from chatter.chatterbot.input import InputAdapter class VariableInputTypeAdapter(InputAdapter): - JSON = 'json' TEXT = 'text' OBJECT = 'object' - VALID_FORMATS = (JSON, TEXT, OBJECT, ) + VALID_FORMATS = (JSON, TEXT, OBJECT,) def detect_type(self, statement): diff --git a/chatter/chatterbot/logic/multi_adapter.py b/chatter/chatterbot/logic/multi_adapter.py index e83cc00..6cfe30f 100644 --- a/chatter/chatterbot/logic/multi_adapter.py +++ b/chatter/chatterbot/logic/multi_adapter.py @@ -51,7 +51,7 @@ class MultiLogicAdapter(LogicAdapter): if adapter.can_process(statement): output = adapter.process(statement) - results.append((output.confidence, output, )) + results.append((output.confidence, output,)) self.logger.info( '{} selected "{}" as a response with a confidence of {}'.format( diff --git a/chatter/chatterbot/logic/time_adapter.py b/chatter/chatterbot/logic/time_adapter.py index b177a67..72902e2 100644 --- a/chatter/chatterbot/logic/time_adapter.py +++ b/chatter/chatterbot/logic/time_adapter.py @@ -42,8 +42,8 @@ class TimeLogicAdapter(LogicAdapter): ]) labeled_data = ( - [(name, 0) for name in self.negative] + - [(name, 1) for name in self.positive] + [(name, 0) for name in self.negative] + + [(name, 1) for name in self.positive] ) train_set = [ diff --git a/chatter/chatterbot/storage/storage_adapter.py b/chatter/chatterbot/storage/storage_adapter.py index 50beac7..046ae63 100644 --- a/chatter/chatterbot/storage/storage_adapter.py +++ b/chatter/chatterbot/storage/storage_adapter.py @@ -24,12 +24,12 @@ class StorageAdapter(object): # The string must be lowercase model_name = model_name.lower() - kwarg_model_key = '%s_model' % (model_name, ) + kwarg_model_key = '%s_model' % (model_name,) if kwarg_model_key in self.kwargs: return self.kwargs.get(kwarg_model_key) - get_model_method = getattr(self, 'get_%s_model' % (model_name, )) + get_model_method = getattr(self, 'get_%s_model' % (model_name,)) return get_model_method() @@ -157,7 +157,8 @@ class StorageAdapter(object): class EmptyDatabaseException(Exception): - def __init__(self, value='The database currently contains no entries. At least one entry is expected. You may need to train your chat bot to populate your database.'): + def __init__(self, + value='The database currently contains no entries. At least one entry is expected. You may need to train your chat bot to populate your database.'): self.value = value def __str__(self): diff --git a/chatter/chatterbot/trainers.py b/chatter/chatterbot/trainers.py index 2d1aa59..456176c 100644 --- a/chatter/chatterbot/trainers.py +++ b/chatter/chatterbot/trainers.py @@ -61,8 +61,8 @@ class Trainer(object): def __init__(self, value=None): default = ( - 'A training class must be specified before calling train(). ' + - 'See http://chatterbot.readthedocs.io/en/stable/training.html' + 'A training class must be specified before calling train(). ' + + 'See http://chatterbot.readthedocs.io/en/stable/training.html' ) self.value = value or default @@ -393,7 +393,6 @@ class UbuntuCorpusTrainer(Trainer): file_kwargs = {} - # Specify the encoding in Python versions 3 and up file_kwargs['encoding'] = 'utf-8' # WARNING: This might fail to read a unicode corpus file in Python 2.x diff --git a/chatter/chatterbot/utils.py b/chatter/chatterbot/utils.py index c8c670d..e18549e 100644 --- a/chatter/chatterbot/utils.py +++ b/chatter/chatterbot/utils.py @@ -76,7 +76,7 @@ def input_function(): The function 'raw_input' becomes 'input' in Python 3. """ - user_input = input() # NOQA + user_input = input() # NOQA return user_input diff --git a/chatter/info.json b/chatter/info.json index bd4870a..d2ebffd 100644 --- a/chatter/info.json +++ b/chatter/info.json @@ -1,10 +1,30 @@ { - "author" : ["Bobloy"], - "bot_version" : [3,0,0], - "description" : "Create an offline chatbot that talks like your average member using Machine Learning", - "hidden" : false, - "install_msg" : "Thank you for installing Chatter!", - "requirements" : ["sqlalchemy<1.3,>=1.2", "python-twitter<4.0,>=3.0", "python-dateutil<2.7,>=2.6", "pymongo<4.0,>=3.3", "nltk<4.0,>=3.2", "mathparse<0.2,>=0.1", "chatterbot-corpus<1.2,>=1.1"], - "short" : "Local Chatbot run on machine learning", - "tags" : ["chat", "chatbot", "cleverbot", "clever","bobloy"] + "author": [ + "Bobloy" + ], + "bot_version": [ + 3, + 0, + 0 + ], + "description": "Create an offline chatbot that talks like your average member using Machine Learning", + "hidden": false, + "install_msg": "Thank you for installing Chatter!", + "requirements": [ + "sqlalchemy<1.3,>=1.2", + "python-twitter<4.0,>=3.0", + "python-dateutil<2.7,>=2.6", + "pymongo<4.0,>=3.3", + "nltk<4.0,>=3.2", + "mathparse<0.2,>=0.1", + "chatterbot-corpus<1.2,>=1.1" + ], + "short": "Local Chatbot run on machine learning", + "tags": [ + "chat", + "chatbot", + "cleverbot", + "clever", + "bobloy" + ] } \ No newline at end of file