summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2013-02-22 00:07:10 +0100
committerFlorent Xicluna <florent.xicluna@gmail.com>2013-02-22 00:07:10 +0100
commitbc13b9285cf5a94603cd42205cb22997dbd371a8 (patch)
tree82e859e97a3d324d895e58b70d1fc5b6f4651d98
parenta663c2a2df35a09e9ec41460b5e5905ec16f576f (diff)
downloadpep8-bc13b9285cf5a94603cd42205cb22997dbd371a8.tar.gz
Allow to change the 'checker_class' for the StyleGuide.
-rw-r--r--CHANGES.txt2
-rwxr-xr-xpep8.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index ef70009..bc487dd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -13,6 +13,8 @@ Changelog
* Initiate a graceful shutdown on ``Control+C``.
+* Allow to change the ``checker_class`` for the ``StyleGuide``.
+
1.4.2 (2013-02-10)
------------------
diff --git a/pep8.py b/pep8.py
index 039c714..e6729e2 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1561,6 +1561,7 @@ class StyleGuide(object):
def __init__(self, *args, **kwargs):
# build options from the command line
+ self.checker_class = kwargs.pop('checker_class', Checker)
parse_argv = kwargs.pop('parse_argv', False)
config_file = kwargs.pop('config_file', None)
parser = kwargs.pop('parser', None)
@@ -1618,7 +1619,8 @@ class StyleGuide(object):
"""Run all checks on a Python source file."""
if self.options.verbose:
print('checking %s' % filename)
- fchecker = Checker(filename, lines=lines, options=self.options)
+ fchecker = self.checker_class(
+ filename, lines=lines, options=self.options)
return fchecker.check_all(expected=expected, line_offset=line_offset)
def input_dir(self, dirname):