Runs a code block. Uses specially runners for files like Gemfile and package.json. Returns codeBlock.
543105
function runCodeBlock(codeBlock) {
  var dir = path.dirname(codeBlock.filename);
  return new Promise(function(fulfill, reject) {
    var filenameWithoutDir = codeBlock.filename.replace(dir + '/', '');
    var command = runner(codeBlock, filenameWithoutDir);
    if (command === null) {
      fulfill(codeBlock);
      return;
    }
    exec(command, {cwd: dir}, function(error, stdout, stderr) {
      if (error) {
        console.error(error);
        reject(error);
      } else {
        if (stdout) {
          console.log(stdout);
        }
        if (stderr) {
          console.error(stderr);
        }
        fulfill(codeBlock);
      }
    });
  });
}
178058
def run_main(args: argparse.Namespace, do_exit=True) -> None:
    
    if args.init:
        generate()
        return None  # exit after generate instead of starting to lint

    handler = CheckHandler(
        file=args.config_file, out_json=args.json, files=args.files)

    for style in get_stylers():
        handler.run_linter(style())

    for linter in get_linters():
        handler.run_linter(linter())

    for security in get_security():
        handler.run_linter(security())

    for tool in get_tools():
        tool = tool()

        # Only run pypi if everything else passed
        if tool.name == "pypi" and handler.status_code != 0:
            continue

        handler.run_linter(tool)

    if do_exit:
        handler.exit()
    return handler.status_code
89276
def run(path, code=None, params=None, **meta):
        
        tree = compile(code, path, "exec", ast.PyCF_ONLY_AST)

        McCabeChecker.max_complexity = int(params.get('complexity', 10))
        return [
            {'lnum': lineno, 'offset': offset, 'text': text, 'type': McCabeChecker._code}
            for lineno, offset, text, _ in McCabeChecker(tree, path).run()
        ]
1287408
public Object run(URI source, String[] args) throws CompilationFailedException, IOException {
        return run(new GroovyCodeSource(source), args);
    }
55810
async function runFile(src, options) {
    return runCode(await fs.readFile(src, 'utf-8'), {
        __dirname: path.dirname(src),
        __filename: src,
        ...options
    });
}
732428
def run(cli_args):
    
    from .core import Core

    c = Core(
        source_file=cli_args["--data-file"],
        schema_files=cli_args["--schema-file"],
        extensions=cli_args['--extension'],
        strict_rule_validation=cli_args['--strict-rule-validation'],
        fix_ruby_style_regex=cli_args['--fix-ruby-style-regex'],
        allow_assertions=cli_args['--allow-assertions'],
        file_encoding=cli_args['--encoding'],
    )
    c.validate()
    return c
1370624
def run(client, outputs, no_output, success_codes, isolation, command_line):
    """"""
    working_dir = client.repo.working_dir
    mapped_std = _mapped_std_streams(client.candidate_paths)
    factory = CommandLineToolFactory(
        command_line=command_line,
        directory=os.getcwd(),
        working_dir=working_dir,
        successCodes=success_codes,
        **{
            name: os.path.relpath(path, working_dir)
            for name, path in mapped_std.items()
        }
    )

    with client.with_workflow_storage() as wf:
        with factory.watch(
            client, no_output=no_output, outputs=outputs
        ) as tool:
            # Make sure all inputs are pulled from a storage.
            client.pull_paths_from_storage(
                *(
                    path
                    for _, path in tool.iter_input_files(client.workflow_path)
                )
            )

            returncode = call(
                factory.command_line,
                cwd=os.getcwd(),
                **{key: getattr(sys, key)
                   for key in mapped_std.keys()},
            )

            if returncode not in (success_codes or {0}):
                raise errors.InvalidSuccessCode(
                    returncode, success_codes=success_codes
                )

            sys.stdout.flush()
            sys.stderr.flush()

            wf.add_step(run=tool)
1354446
def run(self, *args):
        
        params = self.parser.parse_args(args)

        with params.outfile as outfile:
            if params.identities:
                code = self.export_identities(outfile, params.source)
            elif params.orgs:
                code = self.export_organizations(outfile)
            else:
                # The running proccess never should reach this section
                raise RuntimeError("Unexpected export option")

        return code
1291227
def run(args)
      options = SCSSLint::Options.new.parse(args)
      act_on_options(options)
    rescue StandardError => e
      handle_runtime_exception(e, options)
    end
684926
def run(self):
        
        path = self.path or CONTAINER_BUILD_JSON_PATH
        try:
            with open(path, 'r') as build_cfg_fd:
                build_cfg_json = json.load(build_cfg_fd)
        except ValueError:
            self.log.error("couldn't decode json from file '%s'", path)
            return None
        except IOError:
            self.log.error("couldn't read json from file '%s'", path)
            return None
        else:
            return self.substitute_configuration(build_cfg_json)
420586
def run(self) -> None:
        
        fd = self._fd
        encoding = self._encoding
        line_terminators = self._line_terminators
        queue = self._queue
        buf = ""
        while True:
            try:
                c = fd.read(1).decode(encoding)
            except UnicodeDecodeError as e:
                log.warning("Decoding error from {!r}: {!r}", self._cmdargs, e)
                if self._suppress_decoding_errors:
                    continue
                else:
                    raise
            # log.critical("c={!r}, returncode={!r}", c, p.returncode)
            if not c:
                # Subprocess has finished
                return
            buf += c
            # log.critical("buf={!r}", buf)
            # noinspection PyTypeChecker
            for t in line_terminators:
                try:
                    t_idx = buf.index(t) + len(t)  # include terminator
                    fragment = buf[:t_idx]
                    buf = buf[t_idx:]
                    queue.put(fragment)
                except ValueError:
                    pass
502314
def run(self):
        """"""
        link = self.content[0]
        try:
            r = requests.get(link)
            r.raise_for_status()
            self.content = [r.text]
            return super(RemoteCodeBlock, self).run()
        except Exception:
            document = self.state.document
            err = 'Unable to resolve ' + link
            return [document.reporter.warning(str(err), line=self.lineno)]
237719
def runner(coro):
    """"""

    @wraps(coro)
    def inner(self, *args, **kwargs):
        if self.mode == 'async':
            return coro(self, *args, **kwargs)
        return self._loop.run_until_complete(coro(self, *args, **kwargs))

    return inner
502127
def run(args):
    if args['--debug']:
        print(args)
    # ignoring bamboo sequecing for the moment...
    # check the build server to see if we have built the latest (or the specified commit)
    # if yes just scp those to services
    # if no check the web endpoint to see if latest matches build
    # if yes fetch
    # else build (push to web endpoint)

    ''
    'tom@orpheus:~/files/ontology-packages/graph/'
    #b = Builder(build_host, services_host, build_user, services_user,
                #graph_latest_url, scigraph_latest_url,
                #scp, sscp, git_local, repo_name,
                #services_folder, graph_folder, services_config_folder
               #)

    kwargs = {k.strip('--').strip('<').rstrip('>').replace('-','_'):v for k, v in args.items()}
    b = Builder(args, **kwargs)
    if b.mode is not None:
        code = b.run()
    else:
        if args['--view-defaults']:
            for k, v in combined_defaults.items():
                print(f'{k:<22} {v}')
        return

    if b.debug:
        FILE = '/tmp/test.sh'
        with open(FILE, 'wt') as f:
            f.write('#!/usr/bin/env bash\n' + code)
        os.system(f"emacs -batch {FILE} --eval '(indent-region (point-min) (point-max) nil)' -f save-buffer")
        print()
        with open(FILE, 'rt') as f:
            print(f.read())
        #embed()
    if b.local:
        return
        #if b.check_built:
            #return
    else:
        print(code)
897692
def run_script(pycode):
    """"""
    # Fix up the whitespace in pycode.
    if pycode[0] == "\n":
        pycode = pycode[1:]
    pycode.rstrip()
    pycode = textwrap.dedent(pycode)

    # execute it.
    globs = {}
    six.exec_(pycode, globs, globs)  # pylint: disable=W0122

    return globs
1374322
def runner(self, classpath, main, jvm_options=None, args=None, cwd=None):
    """"""
    return self._runner(*self._scrub_args(classpath, main, jvm_options, args, cwd=cwd))
1263341
def run(self):
        
        n_target_file, n_other_file = 0, 0

        code, comment, docstr, purecode = 0, 0, 0, 0

        fc = FileCollection.from_path_except(self.workspace, self.ignore)

        fc_yes, fc_no = fc.select(self.filter, keepboth=True)
        n_other_file += len(fc_no)

        for abspath in fc_yes:
            try:
                with open(abspath, "rb") as f:
                    code_text = f.read().decode("utf-8")
                    code_, comment_, docstr_, purecode_ = self.analyzer(
                        code_text)
                    code += code_
                    comment += comment_
                    docstr += docstr_
                    purecode += purecode_
                    n_target_file += 1
            except Exception as e:
                n_other_file += 1

        lines = list()
        lines.append("Code statistic result for '%s'" % self.workspace)
        lines.append("  %r %r files, %r other files." %
                     (n_target_file, self.language, n_other_file))
        lines.append("    code line: %s" % code)
        lines.append("    comment line: %s" % comment)
        lines.append("    docstr line: %s" % docstr)
        lines.append("    purecode line: %s" % purecode)
        message = "\n".join(lines)

        print(message)
        return message