diff options
Diffstat (limited to 'checkers/logging.py')
-rw-r--r-- | checkers/logging.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/checkers/logging.py b/checkers/logging.py index d82d74b..39c4d9c 100644 --- a/checkers/logging.py +++ b/checkers/logging.py @@ -20,6 +20,9 @@ from pylint import interfaces from pylint.checkers import utils from pylint.checkers.utils import check_messages +import six + + MSGS = { 'W1201': ('Specify string format arguments as logging function parameters', 'logging-not-lazy', @@ -166,7 +169,7 @@ class LoggingChecker(checkers.BaseChecker): # don't check any further. return format_string = node.args[format_arg].value - if not isinstance(format_string, basestring): + if not isinstance(format_string, six.string_types): # If the log format is constant non-string (e.g. logging.debug(5)), # ensure there are no arguments. required_num_args = 0 @@ -178,7 +181,7 @@ class LoggingChecker(checkers.BaseChecker): # Keyword checking on logging strings is complicated by # special keywords - out of scope. return - except utils.UnsupportedFormatCharacter, ex: + except utils.UnsupportedFormatCharacter as ex: char = format_string[ex.index] self.add_message('logging-unsupported-format', node=node, args=(char, ord(char), ex.index)) |