diff options
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)) - + |