Use check_output to run pylint.
    Because pylint changes the exit code based on the code score,
    we have to wrap it in a try/except block.

    :param options:
    :return:
180836
def pylint_raw(options):
    
    command = ['pylint']
    command.extend(options)

    proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    outs, __ = proc.communicate()

    return outs.decode()
632726
def exit(code=0, text=''):
    
    if not isinstance(text, basestring_type):
        text = unicode_type(text)
    if code > 0:
        if text:
            if not isinstance(text, basestring_type):
                text = unicode_type(text)
            sys.stderr.write(text)
        sys.exit(code)
    else:
        if text:
            print(text)
        sys.exit(0)
998229
def execute_return_success(cmd):
    '''
    
    '''

    ret = _run_all(cmd)

    if ret['retcode'] != 0 or 'not supported' in ret['stdout'].lower():
        msg = 'Command Failed: {0}\n'.format(cmd)
        msg += 'Return Code: {0}\n'.format(ret['retcode'])
        msg += 'Output: {0}\n'.format(ret['stdout'])
        msg += 'Error: {0}\n'.format(ret['stderr'])
        raise CommandExecutionError(msg)

    return True
1054790
def check_output(args):
    
    proc = Popen(args, stdout=PIPE)
    out = proc.communicate()[0]
    if proc.returncode:
        raise CalledProcessError(proc.returncode, args, output=out)
    return out
153035
def run_pylint(filename):
    
    ARGS = [
        '-r',
        'n'
    ]
    pylint_output = WritableObject()
    Run([filename]+ARGS, reporter=TextReporter(pylint_output), exit=False)

    lines = []
    for line in pylint_output.read():
        if not line.startswith('*') and line != '\n':
            lines.append(line)

    return lines
754468
def _execute_pep8(pep8_options, source):
    """"""
    class QuietReport(pycodestyle.BaseReport):

        """Version of checker that does not print."""

        def __init__(self, options):
            super(QuietReport, self).__init__(options)
            self.__full_error_results = []

        def error(self, line_number, offset, text, check):
            """Collect errors."""
            code = super(QuietReport, self).error(line_number,
                                                  offset,
                                                  text,
                                                  check)
            if code:
                self.__full_error_results.append(
                    {'id': code,
                     'line': line_number,
                     'column': offset + 1,
                     'info': text})

        def full_error_results(self):
            """Return error results in detail.

            Results are in the form of a list of dictionaries. Each
            dictionary contains 'id', 'line', 'column', and 'info'.

            """
            return self.__full_error_results

    checker = pycodestyle.Checker('', lines=source, reporter=QuietReport,
                                  **pep8_options)
    checker.check_all()
    return checker.report.full_error_results()
139183
def run(files, temp_folder, arg=None):
    ""
    try:
        import pylint
    except ImportError:
        return NO_PYLINT_MSG

    # set default level of threshold
    arg = arg or SCORE

    py_files = filter_python_files(files)
    if not py_files:
        return False

    str_py_files = " ".join(py_files)
    cmd = "{0} {1}".format(PYLINT_CMD, str_py_files)
    output = bash(cmd).value()

    if 'rated' not in output:
        return False
    score = float(re.search("(\d.\d\d)/10", output).group(1))
    if score >= float(arg):
        return False
    return ("Pylint appreciated your {0} as {1},"
        "required threshold is {2}".format(PYLINT_TARGET, score, arg)
        )
207954
def main(reraise_exceptions=False, **kwargs):
    """"""
    exit_status = 0

    try:
        cli.main(**kwargs)
    except SoftLayer.SoftLayerAPIError as ex:
        if 'invalid api token' in ex.faultString.lower():
            print("Authentication Failed: To update your credentials, use 'slcli config setup'")
            exit_status = 1
        else:
            print(str(ex))
            exit_status = 1
    except SoftLayer.SoftLayerError as ex:
        print(str(ex))
        exit_status = 1
    except exceptions.CLIAbort as ex:
        print(str(ex.message))
        exit_status = ex.code
    except Exception:
        if reraise_exceptions:
            raise

        import traceback
        print("An unexpected error has occured:")
        print(str(traceback.format_exc()))
        print("Feel free to report this error as it is likely a bug:")
        print("    https://github.com/softlayer/softlayer-python/issues")
        print("The following snippet should be able to reproduce the error")
        exit_status = 1

    sys.exit(exit_status)
633670
def exit(self, code=None, message=None, perfdata=None, extdata=None):
        
        code = UNKNOWN if code is None else int(code)
        message = "" if message is None else str(message)
        perfdata = "" if perfdata is None else str(perfdata)
        extdata = "" if extdata is None else str(extdata)
        print("{0} {1} - {2} | {3}".format(self.name.upper(),
                                           _CODES_STR[code],
                                           message, perfdata))
        if extdata:
            print(extdata)
        sys.exit(code)
1020375
def check(self):
        
        if not self.enabled():
            return
        try:
            self.fetch()
        except (xmlrpclib.Fault, did.base.ConfigError) as error:
            log.error(error)
            self._error = True
            # Raise the exception if debugging
            if not self.options or self.options.debug:
                raise
        # Show the results stats (unless merging)
        if self.options and not self.options.merge:
            self.show()
286234
def check_call_out(command):
  
  # start external command process
  p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

  # get outputs
  out, _ = p.communicate()

  # throw exception if process failed
  if p.returncode != 0:
    raise GitInvocationError, 'failed to run "%s"' % " ".join(command)

  return out.strip()
1220889
def check_output(*args, **kwargs):
    ''''''
    if hasattr(subprocess, 'check_output'):
        return subprocess.check_output(stderr=subprocess.STDOUT, universal_newlines=True,
                                       *args, **kwargs)
    else:
        process = subprocess.Popen(*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                                   universal_newlines=True, **kwargs)
        output, _ = process.communicate()
        retcode = process.poll()
        if retcode:
            error = subprocess.CalledProcessError(retcode, args[0])
            error.output = output
            raise error
        return output
295479
def execute!
      files_to_check = parse_options.leftovers

      YamlLint.logger.level = Logger::DEBUG if opts.debug

      no_yamls_to_check_msg = "Error: need at least one YAML file to check.\n"\
                              'Try --help for help.'
      abort(no_yamls_to_check_msg) if files_to_check.empty?
      lint(files_to_check)
    end
1290920
def run(self, error_on_warning=False, verbose=False):
        
        warnings, criticals = self.check_limits(verbose=verbose)
        # output
        if len(warnings) > 0:
            print("\nWARNING:\n")
            for w in warnings:
                print(w)
        if len(criticals) > 0:
            print("\nCRITICAL:\n")
            for c in criticals:
                print(c)

        # summary
        if len(warnings) > 0 or len(criticals) > 0:
            print("\n{c} limit(s) above CRITICAL threshold; {w} limit(s) above "
                  "WARNING threshold".format(c=len(criticals), w=len(warnings)))
        else:
            print("All limits are within thresholds.")
        if (len(warnings) > 0 and error_on_warning) or len(criticals) > 0:
            raise SystemExit(1)
1195593
function checkOpts(next) {
        /* failsafe */
        if (options === undefined) {
          _log('error', 'no options given to .compile()');
          process.exit();
        }

        /**
         * Have we been given a custom flag for python executable?
         **/
        if (
          options.python !== 'python' &&
          options.python !== '' &&
          options.python !== undefined
        ) {
          if (isWin) {
            isPy = options.python.replace(/\//gm, '\\'); // use windows file paths, batch is sensitive.
          } else {
            isPy = options.python;
          }

          _log('set python as ' + isPy);
        } else {
          isPy = 'python';
        }

        // remove dots
        options.framework = options.framework.replace(/\./g, '');

        // set outter-scope framework variable.
        framework = options.framework;
        _log('framework => ' + framework);

        version = options.nodeVersion; // better framework vc

        // check iojs version
        if (framework === 'iojs' && version === 'latest') {
          _log('fetching iojs versions');
          mkdirp(options.nodeTempDir); // make temp dir, probably repetive.

          // create write stream so we have control over events
          var output = fs.createWriteStream(
            path.join(options.nodeTempDir, 'iojs-versions.json'),
          );

          request.get('https://iojs.org/dist/index.json').pipe(output);

          output.on('close', function() {
            _log('done');
            var f = fs.readFileSync(
              path.join(options.nodeTempDir, 'iojs-versions.json'),
            );
            f = JSON.parse(f);
            version = f[0].version.replace('v', '');

            _log('iojs latest => ' + version);

            // continue down along the async road
            next();
          });
        } else {
          next();
        }
      }
1118275
def run(targets, config_dir='.', check_licenses=False):
    # type: (List[str], str, bool) -> None
    
    pylint_return_state = False
    flake8_return_state = False

    if check_licenses:
        run_license_checker(config_path=get_license_checker_config_path(config_dir))

    pylint_options = get_pylint_options(config_dir=config_dir)
    flake8_options = get_flake8_options(config_dir=config_dir)

    if targets:
        pylint_return_state = _run_command(command='pylint', targets=targets,
                                           options=pylint_options)
        flake8_return_state = _run_command(command='flake8', targets=targets,
                                           options=flake8_options)

    if not flake8_return_state and not pylint_return_state:
        sys.exit(0)
    else:
        sys.exit(1)
1091134
def check(args, source_code, filename=None, options=None):
    """"""
    if args is None:
        return []
    if options is not None:
        args += options
    if any(['pyflakes' in arg for arg in args]):
        #  Pyflakes requires an ending new line (pycodestyle don't! -- see Issue 1123)
        #  Note: this code is not used right now as it is faster to invoke 
        #  pyflakes in current Python interpreter (see `check_with_pyflakes` 
        #  function above) than calling it through a subprocess
        source_code += '\n'
    if filename is None:
        # Creating a temporary file because file does not exist yet 
        # or is not up-to-date
        tempfd = tempfile.NamedTemporaryFile(suffix=".py", delete=False)
        tempfd.write(source_code)
        tempfd.close()
        args.append(tempfd.name)
    else:
        args.append(filename)
    cmd = args[0]
    cmdargs = args[1:]
    proc = programs.run_program(cmd, cmdargs)
    output = proc.communicate()[0].strip().decode().splitlines()
    if filename is None:
        os.unlink(tempfd.name)
    results = []
    coding = encoding.get_coding(source_code)
    lines = source_code.splitlines()
    for line in output:
        lineno = int(re.search(r'(\:[\d]+\:)', line).group()[1:-1])
        try:
            text = to_text_string(lines[lineno-1], coding)
        except TypeError:
            text = to_text_string(lines[lineno-1])
        except UnicodeDecodeError:
            # Needed to handle UnicodeDecodeError and force the use
            # of chardet to detect enconding. See issue 6970
            coding = encoding.get_coding(source_code, force_chardet=True)
            text = to_text_string(lines[lineno-1], coding)
        if 'analysis:ignore' not in text:
            message = line[line.find(': ')+2:]
            results.append((message, lineno))
    return results