def check(self, code, filename):
        """Run pep8 on code and return the output."""
        options = {
            'reporter': self.get_report()
        }

        type_map = {
            'select': [],
            'ignore': [],
            'max-line-length': 0,
            'max-complexity': 0
        }

        self.build_options(options, type_map, transform=lambda s: s.replace('-', '_'))

        final_options = options.copy()

        # Try to read options from pep8 default configuration files (.pep8, tox.ini).
        # If present, they will override the ones defined by Sublime Linter's config.
        try:
            # `onError` will be called by `process_options` when no pep8 configuration file is found.
            # Override needed to supress OptionParser.error() output in the default parser.
            def onError(msg):
                pass

            from pep8 import process_options, get_parser
            parser = get_parser()
            parser.error = onError
            pep8_options, _ = process_options([os.curdir], True, True, parser=parser)

            # Merge options only if the pep8 config file actually exists;
            # pep8 always returns a config filename, even when it doesn't exist!
            if os.path.isfile(pep8_options.config):
                pep8_options = vars(pep8_options)
                pep8_options.pop('reporter', None)
                for opt_n, opt_v in pep8_options.items():
                    if isinstance(final_options.get(opt_n, None), list):
                        final_options[opt_n] += opt_v
                    else:
                        final_options[opt_n] = opt_v
        except __HOLE__:
            # Catch and ignore parser.error() when no config files are found.
            pass

        if persist.debug_mode():
            persist.printf('{} ST options: {}'.format(self.name, options))
            persist.printf('{} options: {}'.format(self.name, final_options))

        checker = self.module.StyleGuide(**final_options)

        return checker.input_file(
            filename=os.path.basename(filename),
            lines=code.splitlines(keepends=True)
        )
dataset/ETHPy150Open SublimeLinter/SublimeLinter-pep8/linter.py/PEP8.check