From a7bc72493efe536cfb50b79ec1a8889682047ac8 Mon Sep 17 00:00:00 2001 From: Bobloy Date: Thu, 3 May 2018 11:38:24 -0400 Subject: [PATCH] optimize imports --- chatter/chatterbot/comparisons.py | 1 - chatter/chatterbot/conversation.py | 1 - chatter/chatterbot/ext/sqlalchemy_app/models.py | 7 ++++--- chatter/chatterbot/input/variable_input_type_adapter.py | 2 -- chatter/chatterbot/logic/low_confidence.py | 1 - chatter/chatterbot/logic/multi_adapter.py | 1 - chatter/chatterbot/preprocessors.py | 3 --- chatter/chatterbot/utils.py | 2 -- 8 files changed, 4 insertions(+), 14 deletions(-) diff --git a/chatter/chatterbot/comparisons.py b/chatter/chatterbot/comparisons.py index 3abc009..59efa95 100644 --- a/chatter/chatterbot/comparisons.py +++ b/chatter/chatterbot/comparisons.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import sys """ diff --git a/chatter/chatterbot/conversation.py b/chatter/chatterbot/conversation.py index a798e17..c9dfcb4 100644 --- a/chatter/chatterbot/conversation.py +++ b/chatter/chatterbot/conversation.py @@ -25,7 +25,6 @@ class Statement(StatementMixin): """ def __init__(self, text, **kwargs): - import sys # Try not to allow non-string types to be passed to statements try: diff --git a/chatter/chatterbot/ext/sqlalchemy_app/models.py b/chatter/chatterbot/ext/sqlalchemy_app/models.py index 41a05c0..d30bb75 100644 --- a/chatter/chatterbot/ext/sqlalchemy_app/models.py +++ b/chatter/chatterbot/ext/sqlalchemy_app/models.py @@ -1,11 +1,12 @@ -from chatter.chatterbot.constants import TAG_NAME_MAX_LENGTH, STATEMENT_TEXT_MAX_LENGTH -from chatter.chatterbot.conversation import StatementMixin -from chatter.chatterbot.ext.sqlalchemy_app.types import UnicodeString from sqlalchemy import Table, Column, Integer, DateTime, ForeignKey, PickleType from sqlalchemy.ext.declarative import declared_attr, declarative_base from sqlalchemy.orm import relationship from sqlalchemy.sql import func +from chatter.chatterbot.constants import TAG_NAME_MAX_LENGTH, STATEMENT_TEXT_MAX_LENGTH +from chatter.chatterbot.conversation import StatementMixin +from chatter.chatterbot.ext.sqlalchemy_app.types import UnicodeString + class ModelBase(object): """ diff --git a/chatter/chatterbot/input/variable_input_type_adapter.py b/chatter/chatterbot/input/variable_input_type_adapter.py index e08bf53..199d86b 100644 --- a/chatter/chatterbot/input/variable_input_type_adapter.py +++ b/chatter/chatterbot/input/variable_input_type_adapter.py @@ -12,8 +12,6 @@ class VariableInputTypeAdapter(InputAdapter): VALID_FORMATS = (JSON, TEXT, OBJECT, ) def detect_type(self, statement): - import sys - string_types = str diff --git a/chatter/chatterbot/logic/low_confidence.py b/chatter/chatterbot/logic/low_confidence.py index 0e3d5d8..585cf20 100644 --- a/chatter/chatterbot/logic/low_confidence.py +++ b/chatter/chatterbot/logic/low_confidence.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from chatter.chatterbot.conversation import Statement - from .best_match import BestMatch diff --git a/chatter/chatterbot/logic/multi_adapter.py b/chatter/chatterbot/logic/multi_adapter.py index 5e35dfd..e83cc00 100644 --- a/chatter/chatterbot/logic/multi_adapter.py +++ b/chatter/chatterbot/logic/multi_adapter.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals from collections import Counter from chatter.chatterbot import utils - from .logic_adapter import LogicAdapter diff --git a/chatter/chatterbot/preprocessors.py b/chatter/chatterbot/preprocessors.py index 59c6456..2ab0ee0 100644 --- a/chatter/chatterbot/preprocessors.py +++ b/chatter/chatterbot/preprocessors.py @@ -27,7 +27,6 @@ def unescape_html(chatbot, statement): Convert escaped html characters into unescaped html characters. For example: "<b>" becomes "". """ - import sys # Replace HTML escape characters import html @@ -43,8 +42,6 @@ def convert_to_ascii(chatbot, statement): For example: "på fédéral" becomes "pa federal". """ import unicodedata - import sys - text = unicodedata.normalize('NFKD', statement.text) text = text.encode('ascii', 'ignore').decode('utf-8') diff --git a/chatter/chatterbot/utils.py b/chatter/chatterbot/utils.py index 391a06a..c8c670d 100644 --- a/chatter/chatterbot/utils.py +++ b/chatter/chatterbot/utils.py @@ -75,8 +75,6 @@ def input_function(): Normalizes reading input between python 2 and 3. The function 'raw_input' becomes 'input' in Python 3. """ - import sys - user_input = input() # NOQA