How to use the pep8.DEFAULT_IGNORE.split 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 douglas / sublimetext2_configs / sublimelint / modules / python.py View on Github external
messages = []

    _lines = code.split('\n')
    if _lines:
        def report_error(self, line_number, offset, text, check):
            code = text[:4]
            msg = text[5:]
            if pep8.ignore_code(code):
                return
            if code.startswith('E'):
                messages.append(Pep8Error(filename, Dict2Obj(lineno=line_number, col_offset=offset), code, msg))
            else:
                messages.append(Pep8Warning(filename, Dict2Obj(lineno=line_number, col_offset=offset), code, msg))
        pep8.Checker.report_error = report_error

        _ignore = ignore + pep8.DEFAULT_IGNORE.split(',')
        class FakeOptions:
            verbose = 0
            select = []
            ignore = _ignore
        pep8.options = FakeOptions()
        pep8.options.physical_checks = pep8.find_checks('physical_line')
        pep8.options.logical_checks = pep8.find_checks('logical_line')
        pep8.options.counters = dict.fromkeys(pep8.BENCHMARK_KEYS, 0)
        good_lines = [l + '\n' for l in _lines]
        good_lines[-1] = good_lines[-1].rstrip('\n')
        if not good_lines[-1]:
            good_lines = good_lines[:-1]
        try:
            pep8.Checker(filename, good_lines).check_all()
        except:
            pass
github alademann / SublimeText3-Packages / Anaconda / anaconda_lib / linting / linter.py View on Github external
return

                    self.file_errors += 1
                    self.total_errors += 1

                    pep8_error = code.startswith('E')
                    klass = Pep8Error if pep8_error else Pep8Warning
                    messages.append(klass(
                        filename, col, offset, code, message
                    ))

                    return code

            params = {'reporter': SublimeLinterReport}
            if not rcfile:
                _ignore = ignore + pep8.DEFAULT_IGNORE.split(',')
                params['ignore'] = _ignore
            else:
                params['config_file'] = os.path.expanduser(rcfile)

            options = pep8.StyleGuide(**params).options
            if not rcfile:
                options.max_line_length = max_line_length

            good_lines = [l + '\n' for l in _lines]
            good_lines[-1] = good_lines[-1].rstrip('\n')

            if not good_lines[-1]:
                good_lines = good_lines[:-1]

            pep8.Checker(filename, good_lines, options=options).check_all()