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

Unified Diff: third_party/pylint/checkers/misc.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/checkers/exceptions.py ('k') | third_party/pylint/checkers/python3.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pylint/checkers/misc.py
diff --git a/third_party/pylint/checkers/misc.py b/third_party/pylint/checkers/misc.py
index d4adfd78e7fc190b5961e983fc821f7ed2494e12..7fbe70bf3c39809ea489d19dcc3776cea07af67d 100644
--- a/third_party/pylint/checkers/misc.py
+++ b/third_party/pylint/checkers/misc.py
@@ -82,8 +82,6 @@ class EncodingChecker(BaseChecker):
"""inspect the source file to find encoding problem or fixmes like
notes
"""
- stream = module.file_stream
- stream.seek(0) # XXX may be removed with astroid > 0.23
if self.config.notes:
notes = re.compile(
r'.*?#\s*(%s)(:*\s*.+)' % "|".join(self.config.notes))
@@ -94,10 +92,11 @@ class EncodingChecker(BaseChecker):
else:
encoding = 'ascii'
- for lineno, line in enumerate(stream):
- line = self._check_encoding(lineno + 1, line, encoding)
- if line is not None and notes:
- self._check_note(notes, lineno + 1, line)
+ with module.stream() as stream:
+ for lineno, line in enumerate(stream):
+ line = self._check_encoding(lineno + 1, line, encoding)
+ if line is not None and notes:
+ self._check_note(notes, lineno + 1, line)
def register(linter):
« no previous file with comments | « third_party/pylint/checkers/exceptions.py ('k') | third_party/pylint/checkers/python3.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698