How to use the pep8.process_options 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 moinwiki / moin / MoinMoin / _tests / test_sourcecode.py View on Github external
def pep8_error_count(path):
    # process_options initializes some data structures and MUST be called before each Checker().check_all()
    pep8.process_options(['pep8', '--ignore=%s' % ','.join(PEP8IGNORE), '--show-source', 'dummy_path'])
    error_count = pep8.Checker(path).check_all()
    return error_count
github moinwiki / moin-1.9 / MoinMoin / _tests / test_sourcecode.py View on Github external
def pep8_error_count(path):
    # process_options initializes some data structures and MUST be called before each Checker().check_all()
    pep8.process_options(['pep8', '--ignore=E202,E221,E222,E241,E301,E302,E401,E501,E701,W391,W601,W602', '--show-source', 'dummy_path'])
    error_count = pep8.Checker(path).check_all()
    return error_count
github mkouhei / backup2swift / src / backup2swift_tests / test_pep8.py View on Github external
print(message)
            assert report.total_errors == 0, message
        else:
            # under pep8 1.3
            arglist = [
                '--statistics',
                '--filename=*.py',
                '--show-source',
                '--benchmark',
                '--repeat',
                '--show-pep8',
                # '--qq',
                # '-v',
                BASE_DIR, ]

            options, args = pep8.process_options(arglist)
            runner = pep8.input_file

            for path in args:
                if os.path.isdir(path):
                    pep8.input_dir(path, runner=runner)
                elif not pep8.excluded(path):
                    options.counters['files'] += 1
                    runner(path)

            pep8.print_statistics()
            errors = pep8.get_count('E')
            warnings = pep8.get_count('W')
            message = 'pep8: %d errors / %d warnings' % (errors, warnings)
            print(message)
            assert errors + warnings == 0, message
github KDE / kate / kate / plugins / pate / src / plugins / python_utils / python_checkers / pep8_checker.py View on Github external
checkAll.f(currentDocument, ['checkPep8'],
                   exclude_all=not currentDocument)
    move_cursor = not currentDocument
    currentDocument = currentDocument or kate.activeDocument()

    if currentDocument.isModified():
        saveFirst()
        return
    path = currentDocument.url().path()
    if not path:
        saveFirst()
        return
    mark_key = '%s-pep8' % currentDocument.url().path()
    # Check the file for errors with PEP8
    sys.argv = [path]
    pep8.process_options([path])
    python_utils_conf = kate.configuration.root.get('python_utils', {})
    ignore_pep8_errors = python_utils_conf.get(_IGNORE_PEP8_ERRORS, DEFAULT_IGNORE_PEP8_ERRORS)
    if ignore_pep8_errors:
        ignore_pep8_errors = ignore_pep8_errors.split(",")
    else:
        ignore_pep8_errors = []
    if pep8.__version__ in OLD_PEP8_VERSIONS:
        checker = StoreErrorsChecker(path)
        pep8.options.ignore = ignore_pep8_errors
        checker.check_all()
        errors = checker.get_errors()
    else:
        checker = pep8.Checker(path, reporter=KateReport, ignore=ignore_pep8_errors)
        checker.check_all()
        errors = checker.report.get_errors()
    if len(errors) == 0:
github KDE / kate / addons / kate / pate / src / plugins / python_utils / python_checkers / pep8_checker.py View on Github external
checkAll.f(currentDocument, ['checkPep8'],
                   exclude_all=not currentDocument)
    move_cursor = not currentDocument
    currentDocument = currentDocument or kate.activeDocument()

    if currentDocument.isModified():
        saveFirst()
        return
    path = currentDocument.url().path()
    if not path:
        saveFirst()
        return
    mark_key = '%s-pep8' % currentDocument.url().path()
    # Check the file for errors with PEP8
    sys.argv = [path]
    pep8.process_options([path])
    python_utils_conf = kate.configuration.root.get('python_utils', {})
    ignore_pep8_errors = python_utils_conf.get(_IGNORE_PEP8_ERRORS, DEFAULT_IGNORE_PEP8_ERRORS)
    if ignore_pep8_errors:
        ignore_pep8_errors = ignore_pep8_errors.split(",")
    else:
        ignore_pep8_errors = []
    if pep8.__version__ in OLD_PEP8_VERSIONS:
        checker = StoreErrorsChecker(path)
        pep8.options.ignore = ignore_pep8_errors
        checker.check_all()
        errors = checker.get_errors()
    else:
        checker = pep8.Checker(path, reporter=KateReport, ignore=ignore_pep8_errors)
        checker.check_all()
        errors = checker.report.get_errors()
    if len(errors) == 0:
github WoLpH / tissue / tissue.py View on Github external
if options.tissue_select:
            arglist.append('--select')
            arglist.append(options.tissue_select)

        if options.tissue_ignore:
            arglist.append('--ignore')
            arglist.append(options.tissue_ignore)

        if options.tissue_show_source:
            arglist.append('--show-source')

        if options.tissue_show_pep8:
            arglist.append('--show-pep8')

        options, paths = pep8.process_options(arglist)
        self.pep8 = pep8.StyleGuide(**options.__dict__)
        self.pep8.init_report(TissueReport)