File: pep8utils.py

package info (click to toggle)
turing 0.11-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,340 kB
  • sloc: python: 106,582; xml: 101; makefile: 53; sh: 29
file content (27 lines) | stat: -rw-r--r-- 767 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
"""
This module contains utility classes for interacting with the pep8 module
using strings instread of files. This allow live checking on code without the
need to save.
"""
import pep8


class CustomReport(pep8.StandardReport):
    """
    Custom report used to get the pep8 results as a list of string. This
    is easier to handler then retrieving the stdout and parsing.
    """

    def get_file_results(self):
        self._deferred_print.sort()
        return self._deferred_print


class CustomChecker(pep8.Checker):
    """
    Custom Checker with our Custom report.
    """
    def __init__(self, *args, **kwargs):
        super(CustomChecker, self).__init__(
            *args, report=CustomReport(kwargs.pop("options")), **kwargs)