pycodestyle API¶
The library provides classes which are usable by third party tools.
Checker Classes¶
The StyleGuide
class is used to configure a style guide checker
instance to check multiple files.
The Checker
class can be used to check a single file.
- class pycodestyle.StyleGuide(parse_argv=False, config_file=None, parser=None, paths=None, report=None, **kwargs)[source]¶
Initialize a PEP-8 instance with few options.
- input_file(filename, lines=None, expected=None, line_offset=0)[source]¶
Run all checks on a Python source file.
- excluded(filename, parent=None)[source]¶
Check if the file should be excluded.
Check if ‘options.exclude’ contains a pattern matching filename.
Report Classes¶
- class pycodestyle.BaseReport(options)[source]¶
Collect the results of the checks.
Utilities¶
- pycodestyle.expand_indent(line)[source]¶
Return the amount of indentation.
Tabs are expanded to the next multiple of 8.
- pycodestyle.read_config(options, args, arglist, parser)[source]¶
Read and parse configurations.
If a config file is specified on the command line with the “–config” option, then only it is used for configuration.
Otherwise, the user configuration (~/.config/pycodestyle) and any local configurations in the current directory or above will be merged together (in that order) using the read method of ConfigParser.