diff options
author | Brett Cannon <brett@python.org> | 2014-08-29 12:26:21 -0400 |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2014-08-29 12:26:21 -0400 |
commit | 4db529a056fc67153e4053dbc96b7e4e2d9efcc9 (patch) | |
tree | 82ed354e2145179066cb0b3ac9ff783a272992af | |
parent | f29cce922245e616467f26ad3abfe84cf1057b15 (diff) | |
download | pylint-4db529a056fc67153e4053dbc96b7e4e2d9efcc9.tar.gz |
Don't call unicode() directly
-rw-r--r-- | checkers/misc.py | 3 | ||||
-rw-r--r-- | reporters/text.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/checkers/misc.py b/checkers/misc.py index 1511e60..d4adfd7 100644 --- a/checkers/misc.py +++ b/checkers/misc.py @@ -21,6 +21,7 @@ import re from pylint.interfaces import IRawChecker from pylint.checkers import BaseChecker +import six MSGS = { @@ -72,7 +73,7 @@ class EncodingChecker(BaseChecker): def _check_encoding(self, lineno, line, file_encoding): try: - return unicode(line, file_encoding) + return six.text_type(line, file_encoding) except UnicodeDecodeError as ex: self.add_message('invalid-encoded-data', line=lineno, args=(file_encoding, ex.args[2])) diff --git a/reporters/text.py b/reporters/text.py index b7bbebb..acb22b5 100644 --- a/reporters/text.py +++ b/reporters/text.py @@ -25,6 +25,7 @@ from logilab.common.textutils import colorize_ansi from pylint.interfaces import IReporter from pylint.reporters import BaseReporter +import six TITLE_UNDERLINES = ['', '=', '-', '.'] @@ -43,7 +44,7 @@ class TextReporter(BaseReporter): self._template = None def on_set_current_module(self, module, filepath): - self._template = unicode(self.linter.config.msg_template or self.line_format) + self._template = six.text_type(self.linter.config.msg_template or self.line_format) def write_message(self, msg): """Convenience method to write a formated message with class default template""" |