diff options
author | Emile Anclin <emile.anclin@logilab.fr> | 2010-11-22 15:36:44 +0100 |
---|---|---|
committer | Emile Anclin <emile.anclin@logilab.fr> | 2010-11-22 15:36:44 +0100 |
commit | 4192e79a8388f92e1227cb87b3109e8e8643628e (patch) | |
tree | fb0650ddfc8b6cd39c394784d596db67edaa7338 /examples/custom_raw.py | |
parent | ed1e2aac329ac808177d512c7e5fbd2d2cecc014 (diff) | |
download | pylint-git-4192e79a8388f92e1227cb87b3109e8e8643628e.tar.gz |
py3k: need to handle guess_encoding in astng
Astng will try to find the right encoding and provide the right "stream"
interface for the Pylint checkers.
Reading a stream with the wrong encoding in py3k will generate a UnicodeError.
The introduced a 'F0010' failure should maybe be replaced by E0501, E0502 and
F0002? However, can we call 'unexpected errors' the ASTNGBuildingExceptions
that we raise in logilab.astng.builder?
Diffstat (limited to 'examples/custom_raw.py')
-rw-r--r-- | examples/custom_raw.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/custom_raw.py b/examples/custom_raw.py index 701f6e902..811c78502 100644 --- a/examples/custom_raw.py +++ b/examples/custom_raw.py @@ -5,7 +5,7 @@ class MyRawChecker(BaseChecker): """check for line continuations with '\' instead of using triple quoted string or parenthesis """ - + __implements__ = IRawChecker name = 'custom_raw' @@ -15,17 +15,19 @@ class MyRawChecker(BaseChecker): } options = () - def process_module(self, stream): + def process_module(self, node): """process a module - - the module's content is accessible via the stream object + + the module's content is accessible via node.file_stream object """ + stream = node.file_stream + stream.seek(0) for (lineno, line) in enumerate(stream): if line.rstrip().endswith('\\'): self.add_message('W9901', line=lineno) - + def register(linter): """required method to auto register this checker""" linter.register_checker(MyRawChecker(linter)) - + |