On Wed, Nov 18, 2009 at 12:41 PM, Reinout van Rees <
rei...@vanrees.org> wrote:
> On Wed, Nov 18, 2009 at 12:04 PM, Sym <
simo...@gmail.com> wrote:
> You could try calling process_options(arglist=None) to set up the
> options with their defaults first.I haven't tried it, but looking at
> the code, this should at least fix the optparse problem.
>
> The code atm isn't really set up for use as a library, though it would
> not be hard to fix that.
Thanks for the reply.
Since I posted I found the following worked:
arglist =['-qq', filepath]
pep8.process_options(arglist)
pep8.input_file(filepath)
error_stats = pep8.get_error_statistics()
warning_stats = pep8.get_warning_statistics()
Although it's not the most intuitive API, it's fine for my needs, and
as you say it's not really designed for use as a library.
I'm writing this for a slightly odd online code writing project I'm
working on, but I'm also creating a commit hook for mercurial that
will run pep8 against the changed code. If there is any interest in
this, I'll gladly shove it up somewhere.
Thanks again,
Sym
--
E:
sym...@talusdesign.co.uk
M: 07742079314