Fix #21. `init` can also be used elsewhere.

Sane defaults are awesome. Also, I hope mercurial uses similar commit messages
to git. ;)
This commit is contained in:
Ian Cordasco 2012-11-07 12:40:49 -05:00
parent d126c3503e
commit a4ebc1c5c4

View file

@ -54,9 +54,14 @@ def _get_python_files(paths):
yield path yield path
def main(): def init(parse_argv=False, config_file=True, **kwargs):
global pep8style global pep8style
pep8style = pep8.StyleGuide(parse_argv=True, config_file=True) pep8style = pep8.StyleGuide(parse_argv=parse_argv,
config_file=config_file)
def main():
init(True)
options = pep8style.options options = pep8style.options
complexity = options.max_complexity complexity = options.max_complexity
builtins = set(options.builtins) builtins = set(options.builtins)
@ -138,9 +143,7 @@ def run(command):
def git_hook(complexity=-1, strict=False, ignore=None): def git_hook(complexity=-1, strict=False, ignore=None):
global pep8style init()
pep8style = pep8.StyleGuide(config_file=True)
_initpep8() _initpep8()
if ignore: if ignore:
pep8.options.ignore = ignore pep8.options.ignore = ignore
@ -203,8 +206,7 @@ else:
yield "%s.py" % filename yield "%s.py" % filename
def run(self): def run(self):
global pep8style init()
pep8style = pep8.StyleGuide(config_file=True)
_initpep8() _initpep8()