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 | ec33eaf8fbd27986d9610abef32534aba2608fe5 (patch) | |
tree | 994fc3f7722ab05d9440248c84ca3d9197772c14 /examples | |
parent | a068a892c623a0697240bfe163f2aa5735ae7777 (diff) | |
download | pylint-ec33eaf8fbd27986d9610abef32534aba2608fe5.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')
-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 701f6e9..811c785 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)) - + |