diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2009-06-11 15:29:43 +0200 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2009-06-11 15:29:43 +0200 |
commit | 5d0b3b5a46474d85fa57fc8041ab2c1347d80819 (patch) | |
tree | df0ad6ae345de2ee82c432627c82529567bf8d6c | |
parent | 274f2b2c365ee7f5c8c8a5a5bb08554c2baf6598 (diff) | |
download | pylint-5d0b3b5a46474d85fa57fc8041ab2c1347d80819.tar.gz |
d-t-w
-rw-r--r-- | checkers/__init__.py | 22 | ||||
-rw-r--r-- | setup.py | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/checkers/__init__.py b/checkers/__init__.py index 0e58e93..4f21468 100644 --- a/checkers/__init__.py +++ b/checkers/__init__.py @@ -61,7 +61,7 @@ def table_lines_from_stats(stats, old_stats, columns): lines += (m_type.replace('_', ' '), format(new), old, diff_str) return lines - + class BaseChecker(OptionsProviderMixIn, ASTWalker): """base class for checkers""" @@ -70,7 +70,7 @@ class BaseChecker(OptionsProviderMixIn, ASTWalker): enabled = True may_be_disabled = True name = None - + def __init__(self, linter=None): """checker instances should have the linter as argument @@ -80,7 +80,7 @@ class BaseChecker(OptionsProviderMixIn, ASTWalker): self.name = self.name.lower() OptionsProviderMixIn.__init__(self) self.linter = linter - + def add_message(self, msg_id, line=None, node=None, args=None): """add a message of a given type""" self.linter.add_message(msg_id, line, node, args) @@ -98,32 +98,32 @@ class BaseChecker(OptionsProviderMixIn, ASTWalker): raise Exception("can't disable %s checker" % self.name) if enabled or self.may_be_disabled: self.enabled = enabled - + def package_dir(self): """return the base directory for the analysed package""" return dirname(self.linter.base_file) # dummy methods implementing the IChecker interface - + def open(self): """called before visiting project (i.e set of modules)""" - + def close(self): """called after visiting project (i.e set of modules)""" class BaseRawChecker(BaseChecker): """base class for raw checkers""" - + def process_module(self, stream): """process a module - + the module's content is accessible via the stream object - + stream must implement the readline method """ self.process_tokens(tokenize.generate_tokens(stream.readline)) - + def process_tokens(self, tokens): """should be overiden by subclasses""" raise NotImplementedError() @@ -159,5 +159,5 @@ def package_load(linter, directory): if hasattr(module, 'register'): module.register(linter) imported[basename] = 1 - + __all__ = ('CheckerHandler', 'BaseChecker', 'initialize', 'package_load') @@ -21,7 +21,7 @@ try: from setuptools import setup from setuptools.command import install_lib USE_SETUPTOOLS = 1 -except ImportError: +except ImportError: from distutils.core import setup from distutils.command import install_lib USE_SETUPTOOLS = 0 |