How to use the pep8._main function in pep8

To help you get started, we’ve selected a few pep8 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cidadania / e-cidadania / tests / pep.py View on Github external
Usage: bin/python tests/pep.py [options] path_to_module_or_package
    
    If you want to see full set of command line options offered by
    pep, pass --help.
    
    """
    
    args = [
        '--show-source',
        '--show-pep8',
        '--ignore=W291'
    ]
    
    sys.argv.extend(args)
    pep8._main()
github mozilla / version-control-tools / pylib / pep8 / testsuite / test_shell.py View on Github external
def pep8(self, *args):
        del sys.stdout[:], sys.stderr[:]
        sys.argv[1:] = args
        try:
            pep8._main()
            errorcode = None
        except SystemExit:
            errorcode = sys.exc_info()[1].code
        return sys.stdout.getvalue(), sys.stderr.getvalue(), errorcode
github riptideio / pymodbus / setup_commands.py View on Github external
def _run_pep8(self):
        try:
            from pep8 import _main as main
            sys.argv = """pep8 --repeat --count --statistics
            """.split() + self.directories
            main()
            return True
        except Exception:
            return False
github openstack / tempest / tools / hacking.py View on Github external
return error

if __name__ == "__main__":
    #include tempest path
    sys.path.append(os.getcwd())
    #Run once tests (not per line)
    once_error = once_git_check_commit_title()
    #TEMPEST error codes start with a T
    pep8.ERRORCODE_REGEX = re.compile(r'[EWT]\d{3}')
    add_tempest()
    pep8.current_file = current_file
    pep8.readlines = readlines
    pep8.StyleGuide.excluded = excluded
    pep8.StyleGuide.input_dir = input_dir
    try:
        pep8._main()
        sys.exit(once_error)
    finally:
        if len(_missingImport) > 0:
            print >> sys.stderr, ("%i imports missing in this test environment"
                                  % len(_missingImport))
github openstack / heat / tools / hacking.py View on Github external
#Run once tests (not per line)
    once_error = once_git_check_commit_title()
    #NOVA error codes start with an N
    pep8.SELFTEST_REGEX = re.compile(r'(Okay|[EWN]\d{3}):\s(.*)')
    pep8.ERRORCODE_REGEX = re.compile(r'[EWN]\d{3}')
    add_nova()
    pep8.current_file = current_file
    pep8.readlines = readlines
    pep8.StyleGuide.excluded = excluded
    pep8.StyleGuide.input_dir = input_dir
    # we need to kill this doctring otherwise the self tests fail
    pep8.imports_on_separate_lines.__doc__ = \
        imports_on_separate_lines_N301_compliant

    try:
        pep8._main()
        sys.exit(once_error)
    finally:
        if len(_missingImport) > 0:
            print >> sys.stderr, ("%i imports missing in this test environment"
                    % len(_missingImport))
github canonical / cloud-init / tools / hacking.py View on Github external
"""
    for name, function in globals().items():
        if not inspect.isfunction(function):
            continue
        if name.startswith("cloud_"):
            exec("pep8.%s = %s" % (name, name))


if __name__ == "__main__":
    # NOVA based 'hacking.py' error codes start with an N
    pep8.ERRORCODE_REGEX = re.compile(r'[EWN]\d{3}')
    add_cloud()
    pep8.current_file = current_file
    pep8.readlines = readlines
    try:
        pep8._main()
    finally:
        if len(_missingImport) > 0:
            sys.stderr.write(
                "%i imports missing in this test environment\n" %
                len(_missingImport))
github openstack / cinder / tools / hacking.py View on Github external
if not inspect.isfunction(function):
            continue
        args = inspect.getargspec(function)[0]
        if args and name.startswith("cinder"):
            exec("pep8.%s = %s" % (name, name))

if __name__ == "__main__":
    #include cinder path
    sys.path.append(os.getcwd())
    #CINDER error codes start with an N
    pep8.ERRORCODE_REGEX = re.compile(r'[EWN]\d{3}')
    add_cinder()
    pep8.current_file = current_file
    pep8.readlines = readlines
    try:
        pep8._main()
    finally:
        if len(_missingImport) > 0:
            print >> sys.stderr, ("%i imports missing in this test environment"
                                  % len(_missingImport))