Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: third_party/pylint/utils.py

Issue 876793002: pylint: upgrade to 1.4.1 (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pylint/reporters/text.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pylint/utils.py
diff --git a/third_party/pylint/utils.py b/third_party/pylint/utils.py
index fcc790403dc99032413a272044c2f6c0379ed10d..6685c4a25d267b592f085198016482f2700b4741 100644
--- a/third_party/pylint/utils.py
+++ b/third_party/pylint/utils.py
@@ -128,16 +128,19 @@ def category_id(cid):
return MSG_TYPES_LONG.get(cid)
+def _decoding_readline(stream, module):
+ return lambda: stream.readline().decode(module.file_encoding,
+ 'replace')
+
+
def tokenize_module(module):
- stream = module.file_stream
- stream.seek(0)
- readline = stream.readline
- if sys.version_info < (3, 0):
- if module.file_encoding is not None:
- readline = lambda: stream.readline().decode(module.file_encoding,
- 'replace')
- return list(tokenize.generate_tokens(readline))
- return list(tokenize.tokenize(readline))
+ with module.stream() as stream:
+ readline = stream.readline
+ if sys.version_info < (3, 0):
+ if module.file_encoding is not None:
+ readline = _decoding_readline(stream, module)
+ return list(tokenize.generate_tokens(readline))
+ return list(tokenize.tokenize(readline))
def build_message_def(checker, msgid, msg_tuple):
if implements(checker, (IRawChecker, ITokenChecker)):
@@ -267,8 +270,8 @@ class MessagesHandlerMixIn(object):
msgs = self._msgs_state
msgs[msg.msgid] = False
# sync configuration object
- self.config.disable_msg = [mid for mid, val in six.iteritems(msgs)
- if not val]
+ self.config.disable = [mid for mid, val in six.iteritems(msgs)
+ if not val]
def enable(self, msgid, scope='package', line=None, ignore_unknown=False):
"""reenable message of the given id"""
« no previous file with comments | « third_party/pylint/reporters/text.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698