request the arguments for running
343794
def get_args():
    
    ap = argparse.ArgumentParser(description="Create frames for a movie that can be compiled using ffmpeg")
    ap.add_argument("start", help="date string as start time")
    ap.add_argument("end", help="date string as end time")
    ap.add_argument("step", type=float, help="fraction of a day to step by")
    ap.add_argument("--config", help="path to a config file", default="config.json")
    return ap.parse_args()
714319
def run(app, argv=sys.argv, extra_args=None):
    
    if app not in argv[:2]:
        # app is automatically added if not present
        argv.insert(1, app)
    if len(argv) < 3 and 'test' not in argv[:2]:
        # test argument is given if not argument is passed
        argv.insert(2, 'test')
    if extra_args:
        argv.extend(extra_args)
    return runner(argv)
104727
def _run(*args, **kwargs):
    
    verbose = kwargs.pop("verbose", False)
    if verbose:
        click.secho(" ".join([repr(i) for i in args]), bg='blue', fg='white')

    executable = args[0]
    if not os.path.isfile(executable):
        raise RuntimeError("First argument %r is not a existing file!" % executable)
    if not os.access(executable, os.X_OK):
        raise RuntimeError("First argument %r exist, but is not executeable!" % executable)

    return subprocess.Popen(args, **kwargs)
1347419
function run(keywordsToRun, keywordsDefined, passedArguments) {
        var vars = helpers.createLocalEnv(passedArguments);
        keywordsToRun = helpers.createKeywords(keywordsToRun);

        return {
            then: function(callback) {
                runKeywords(keywordsToRun, keywordsDefined, vars, callback);
            }
        };
    }
1337380
function run(argv, done) {
  if (!argv) {
    argv = parser.argv;
  }

  if (argv.h) {
    parser.showHelp();
    return done(null);
  }

  if (!argv._.length) {
    return done(new Error('Requires an input argument'));
  } else if (argv._.length > 2) {
    return done(new Error('Too many arguments given!'));
  }

  var input = argv._[0];
  if (input.indexOf('http://') === 0 || input.indexOf('https://') === 0) {
    request(input, function (err, res, body) {
      if (err) {
        return done(err);
      }
      convert(body, done);
    });
  } else {
    if (!fs.existsSync(input)) {
      return done(new Error('`' + input + '` does not exist!'));
    }

    fs.readFile(input, 'utf-8', function (err, content) {
      if (err) {
        return done(err);
      }

      convert(content, done);
    });
  }
}
971774
def run(self, arguments=None):
        
        # set up argument parsing in run, so that subsequent calls
        # to run can call different sub-commands
        self.argparser = argparse.ArgumentParser()
        self.argparser.add_argument('--version', action='version',
                                    version="mtools version {0} || Python {1}".
                                    format(__version__, sys.version))
        self.argparser.add_argument('--no-progressbar', action='store_true',
                                    default=False,
                                    help='disables progress bar')

        self.argparser.description = ('script to launch MongoDB stand-alone '
                                      'servers, replica sets and shards.')

        # make sure init is default command even when specifying
        # arguments directly
        if arguments and arguments.startswith('-'):
            arguments = 'init ' + arguments

        # default sub-command is `init` if none provided
        elif (len(sys.argv) > 1 and sys.argv[1].startswith('-') and
                sys.argv[1] not in ['-h', '--help', '--version']):
            sys.argv = sys.argv[0:1] + ['init'] + sys.argv[1:]

        # create command sub-parsers
        subparsers = self.argparser.add_subparsers(dest='command')
        self.argparser._action_groups[0].title = 'commands'
        self.argparser._action_groups[0].description = \
            ('init is the default command and can be omitted. To get help on '
             'individual commands, run mlaunch <command> --help. Command line '
             'arguments which are not handled by mlaunch will be passed '
             'through to mongod/mongos if those options are listed in the '
             '--help output for the current binary. For example: '
             '--storageEngine, --logappend, or --config.')

        # init command
        helptext = ('initialize a new MongoDB environment and start '
                    'stand-alone instances, replica sets, or sharded '
                    'clusters.')
        desc = ('Initialize a new MongoDB environment and start stand-alone '
                'instances, replica sets, or sharded clusters. Command line '
                'arguments which are not handled by mlaunch will be passed '
                'through to mongod/mongos if those options are listed in the '
                '--help output for the current binary. For example: '
                '--storageEngine, --logappend, or --config.')
        init_parser = subparsers.add_parser('init', help=helptext,
                                            description=desc)

        # either single or replica set
        me_group = init_parser.add_mutually_exclusive_group(required=True)
        me_group.add_argument('--single', action='store_true',
                              help=('creates a single stand-alone mongod '
                                    'instance'))
        me_group.add_argument('--replicaset', action='store_true',
                              help=('creates replica set with several mongod '
                                    'instances'))

        # replica set arguments
        init_parser.add_argument('--nodes', action='store', metavar='NUM',
                                 type=int, default=3,
                                 help=('adds NUM data nodes to replica set '
                                       '(requires --replicaset, default=3)'))
        init_parser.add_argument('--arbiter', action='store_true',
                                 default=False,
                                 help=('adds arbiter to replica set '
                                       '(requires --replicaset)'))
        init_parser.add_argument('--name', action='store', metavar='NAME',
                                 default='replset',
                                 help='name for replica set (default=replset)')
        init_parser.add_argument('--priority', action='store_true',
                                 default=False,
                                 help='make lowest-port member primary')

        # sharded clusters
        init_parser.add_argument('--sharded', '--shards', action='store',
                                 nargs='+', metavar='N',
                                 help=('creates a sharded setup consisting of '
                                       'several singles or replica sets. '
                                       'Provide either list of shard names or '
                                       'number of shards.'))
        init_parser.add_argument('--config', action='store', default=-1,
                                 type=int, metavar='NUM',
                                 help=('adds NUM config servers to sharded '
                                       'setup (requires --sharded, default=1, '
                                       'with --csrs default=3)'))
        init_parser.add_argument('--csrs', default=False, action='store_true',
                                 help=('deploy config servers as a replica '
                                       'set (requires MongoDB >= 3.2.0)'))
        init_parser.add_argument('--mongos', action='store', default=1,
                                 type=int, metavar='NUM',
                                 help=('starts NUM mongos processes (requires '
                                       '--sharded, default=1)'))

        # verbose, port, binary path
        init_parser.add_argument('--verbose', action='store_true',
                                 default=False,
                                 help='outputs more verbose information.')
        init_parser.add_argument('--port', action='store', type=int,
                                 default=27017,
                                 help=('port for mongod, start of port range '
                                       'in case of replica set or shards '
                                       '(default=27017)'))
        init_parser.add_argument('--binarypath', action='store', default=None,
                                 metavar='PATH',
                                 help=('search for mongod/s binaries in the '
                                       'specified PATH.'))
        init_parser.add_argument('--dir', action='store', default='./data',
                                 help=('base directory to create db and log '
                                       'paths (default=./data/)'))
        init_parser.add_argument('--hostname', action='store',
                                 default='localhost',
                                 help=('override hostname for replica set '
                                       'configuration'))

        # authentication, users, roles
        self._default_auth_roles = ['dbAdminAnyDatabase',
                                    'readWriteAnyDatabase',
                                    'userAdminAnyDatabase',
                                    'clusterAdmin']
        init_parser.add_argument('--auth', action='store_true', default=False,
                                 help=('enable authentication and create a '
                                       'key file and admin user '
                                       '(default=user/password)'))
        init_parser.add_argument('--username', action='store', type=str,
                                 default='user',
                                 help=('username to add (requires --auth, '
                                       'default=user)'))
        init_parser.add_argument('--password', action='store', type=str,
                                 default='password',
                                 help=('password for given username (requires '
                                       '--auth, default=password)'))
        init_parser.add_argument('--auth-db', action='store', type=str,
                                 default='admin', metavar='DB',
                                 help=('database where user will be added '
                                       '(requires --auth, default=admin)'))
        init_parser.add_argument('--auth-roles', action='store',
                                 default=self._default_auth_roles,
                                 metavar='ROLE', nargs='*',
                                 help=('admin user''s privilege roles; note'
                                       'that the clusterAdmin role is '
                                       'required to run the stop command '
                                       '(requires --auth, default="%s")'
                                       % ' '.join(self._default_auth_roles)))
        init_parser.add_argument('--auth-role-docs', action='store_true',
                                 default=False,
                                 help='auth-roles are json documents')
        init_parser.add_argument('--no-initial-user', action='store_false',
                                 default=True, dest='initial-user',
                                 help=('create an initial user if auth is '
                                       'enabled (default=true)'))

        # ssl
        def is_file(arg):
            if not os.path.exists(os.path.expanduser(arg)):
                init_parser.error("The file [%s] does not exist" % arg)
            return arg

        ssl_args = init_parser.add_argument_group('SSL Options')
        ssl_args.add_argument('--sslCAFile',
                              help='Certificate Authority file for SSL',
                              type=is_file)
        ssl_args.add_argument('--sslCRLFile',
                              help='Certificate Revocation List file for SSL',
                              type=is_file)
        ssl_args.add_argument('--sslAllowInvalidHostnames',
                              action='store_true',
                              help=('allow client and server certificates to '
                                    'provide non-matching hostnames'))
        ssl_args.add_argument('--sslAllowInvalidCertificates',
                              action='store_true',
                              help=('allow client or server connections with '
                                    'invalid certificates'))

        ssl_server_args = init_parser.add_argument_group('Server SSL Options')
        ssl_server_args.add_argument('--sslOnNormalPorts', action='store_true',
                                     help='use ssl on configured ports')
        ssl_server_args.add_argument('--sslMode',
                                     help='set the SSL operation mode',
                                     choices=('disabled allowSSL preferSSL '
                                              'requireSSL'.split()))
        ssl_server_args.add_argument('--sslPEMKeyFile',
                                     help='PEM file for ssl', type=is_file)
        ssl_server_args.add_argument('--sslPEMKeyPassword',
                                     help='PEM file password')
        ssl_server_args.add_argument('--sslClusterFile',
                                     help=('key file for internal SSL '
                                           'authentication'), type=is_file)
        ssl_server_args.add_argument('--sslClusterPassword',
                                     help=('internal authentication key '
                                           'file password'))
        ssl_server_args.add_argument('--sslDisabledProtocols',
                                     help=('comma separated list of TLS '
                                           'protocols to disable '
                                           '[TLS1_0,TLS1_1,TLS1_2]'))
        ssl_server_args.add_argument('--sslWeakCertificateValidation',
                                     action='store_true',
                                     help=('allow client to connect without '
                                           'presenting a certificate'))
        ssl_server_args.add_argument(('--sslAllowConnectionsWithout'
                                      'Certificates'), action='store_true',
                                     help=('allow client to connect without '
                                           'presenting a certificate'))
        ssl_server_args.add_argument('--sslFIPSMode', action='store_true',
                                     help='activate FIPS 140-2 mode')

        ssl_client_args = init_parser.add_argument_group('Client SSL Options')
        ssl_client_args.add_argument('--sslClientCertificate',
                                     help='client certificate file for ssl',
                                     type=is_file)
        ssl_client_args.add_argument('--sslClientPEMKeyFile',
                                     help='client PEM file for ssl',
                                     type=is_file)
        ssl_client_args.add_argument('--sslClientPEMKeyPassword',
                                     help='client PEM file password')

        self.ssl_args = ssl_args
        self.ssl_client_args = ssl_client_args
        self.ssl_server_args = ssl_server_args

        # start command
        start_parser = subparsers.add_parser('start',
                                             help=('starts existing MongoDB '
                                                   'instances. Example: '
                                                   '"mlaunch start config" '
                                                   'will start all config '
                                                   'servers.'),
                                             description=('starts existing '
                                                          'MongoDB instances. '
                                                          'Example: "mlaunch '
                                                          'start config" will '
                                                          'start all config '
                                                          'servers.'))
        start_parser.add_argument('tags', metavar='TAG', action='store',
                                  nargs='*', default=[],
                                  help=('without tags, all non-running nodes '
                                        'will be restarted. Provide '
                                        'additional tags to narrow down the '
                                        'set of nodes to start.'))
        start_parser.add_argument('--verbose', action='store_true',
                                  default=False,
                                  help='outputs more verbose information.')
        start_parser.add_argument('--dir', action='store', default='./data',
                                  help=('base directory to start nodes '
                                        '(default=./data/)'))
        start_parser.add_argument('--binarypath', action='store',
                                  default=None, metavar='PATH',
                                  help=('search for mongod/s binaries in the '
                                        'specified PATH.'))

        # stop command
        helptext = ('stops running MongoDB instances. Example: "mlaunch stop '
                    'shard 2 secondary" will stop all secondary nodes '
                    'of shard 2.')
        desc = ('stops running MongoDB instances with the shutdown command. '
                'Example: "mlaunch stop shard 2 secondary" will stop all '
                'secondary nodes of shard 2.')
        stop_parser = subparsers.add_parser('stop',
                                            help=helptext,
                                            description=desc)
        helptext = ('without tags, all running nodes will be stopped. '
                    'Provide additional tags to narrow down the set of '
                    'nodes to stop.')
        stop_parser.add_argument('tags', metavar='TAG', action='store',
                                 nargs='*', default=[], help=helptext)
        stop_parser.add_argument('--verbose', action='store_true',
                                 default=False,
                                 help='outputs more verbose information.')
        stop_parser.add_argument('--dir', action='store', default='./data',
                                 help=('base directory to stop nodes '
                                       '(default=./data/)'))

        # restart command
        desc = ('stops running MongoDB instances with the shutdown command. '
                'Then restarts the stopped instances.')
        restart_parser = subparsers.add_parser('restart',
                                               help=('stops, then restarts '
                                                     'MongoDB instances.'),
                                               description=desc)
        restart_parser.add_argument('tags', metavar='TAG', action='store',
                                    nargs='*', default=[],
                                    help=('without tags, all non-running '
                                          'nodes will be restarted. Provide '
                                          'additional tags to narrow down the '
                                          'set of nodes to start.'))
        restart_parser.add_argument('--verbose', action='store_true',
                                    default=False,
                                    help='outputs more verbose information.')
        restart_parser.add_argument('--dir', action='store', default='./data',
                                    help=('base directory to restart nodes '
                                          '(default=./data/)'))
        restart_parser.add_argument('--binarypath', action='store',
                                    default=None, metavar='PATH',
                                    help=('search for mongod/s binaries in '
                                          'the specified PATH.'))

        # list command
        list_parser = subparsers.add_parser('list',
                                            help=('list MongoDB instances of '
                                                  'this environment.'),
                                            description=('list MongoDB '
                                                         'instances of this '
                                                         'environment.'))
        list_parser.add_argument('--dir', action='store', default='./data',
                                 help=('base directory to list nodes '
                                       '(default=./data/)'))
        list_parser.add_argument('--tags', action='store_true', default=False,
                                 help=('outputs the tags for each instance. '
                                       'Tags can be used to target instances '
                                       'for start/stop/kill.'))
        list_parser.add_argument('--startup', action='store_true',
                                 default=False,
                                 help=('outputs the startup command lines for '
                                       'each instance.'))
        list_parser.add_argument('--verbose', action='store_true',
                                 default=False, help='alias for --tags.')

        # list command
        helptext = ('kills (or sends another signal to) MongoDB instances '
                    'of this environment.')
        desc = ('kills (or sends another signal to) MongoDB instances '
                'of this environment.')
        kill_parser = subparsers.add_parser('kill', help=helptext,
                                            description=desc)
        kill_parser.add_argument('tags', metavar='TAG', action='store',
                                 nargs='*', default=[],
                                 help=('without tags, all running nodes will '
                                       'be killed. Provide additional tags to '
                                       'narrow down the set of nodes to '
                                       'kill.'))
        kill_parser.add_argument('--dir', action='store', default='./data',
                                 help=('base directory to kill nodes '
                                       '(default=./data/)'))
        kill_parser.add_argument('--signal', action='store', default=15,
                                 help=('signal to send to processes, '
                                       'default=15 (SIGTERM)'))
        kill_parser.add_argument('--verbose', action='store_true',
                                 default=False,
                                 help='outputs more verbose information.')

        # argparser is set up, now call base class run()
        BaseCmdLineTool.run(self, arguments, get_unknowns=True)

        # conditions on argument combinations
        if (self.args['command'] == 'init' and
                'single' in self.args and self.args['single']):
            if self.args['arbiter']:
                self.argparser.error("can't specify --arbiter for "
                                     "single nodes.")

        # replace path with absolute path, but store relative path as well
        self.relative_dir = self.args['dir']
        self.dir = os.path.abspath(self.args['dir'])
        self.args['dir'] = self.dir

        # branch out in sub-commands
        getattr(self, self.args['command'])()
881569
def run(self, *args):
        
        params = self.parser.parse_args(args)

        code = self.initialize(name=params.name, reuse=params.reuse)

        return code
147153
def run(request, callable, *args, **kwargs):
    ''''''
    return callable(request.actor, *args, **kwargs)
183034
def runner(Options, buffering=True):
    
    def run(argv=None):
        if not buffering:
            sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
            sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)

        if argv is None:
            argv = sys.argv
        o = Options()
        try:
            o.parseOptions(argv[1:])
        except usage.UsageError, e:
            if hasattr(o, 'subOptions'):
                print str(o.subOptions)
            else:
                print str(o)
            print str(e)
            return 1

        return 0

    return run
358668
function (runs, span) {
                    if (span.label === true) { config = log.impl.configure ([config].concat (span.items))
                                               return runs }
                                        else { return runs.concat ({ config: config,
                                                                     text: log.impl.stringifyArguments (span.items, config) }) } }
145088
def runner(fun, arg=None, timeout=5):
    '''
    
    '''
    # Form args as list
    if not isinstance(arg, list):
        arg = [salt.utils.args.yamlify_arg(arg)]
    else:
        arg = [salt.utils.args.yamlify_arg(x) for x in arg]
    if len(arg) == 1 and arg[0] is None:
        arg = []

    # Create and run the runner
    runner = salt.runner.RunnerClient(__opts__['__master_opts__'])
    return runner.cmd(fun, arg)
1167716
def run_check(self, check, argument_names):
        """"""
        arguments = []
        for name in argument_names:
            arguments.append(getattr(self, name))
        return check(*arguments)
188247
def run(self, target, payload, instance_id=None, hook_id=None, **kwargs):
        
        requests.post(
            url=target,
            data=json.dumps(payload),
            headers={
                'Content-Type': 'application/json',
                'Authorization': 'Token %s' % settings.HOOK_AUTH_TOKEN
            }
        )
494614
def run(command, show=True, *args, **kwargs):
    
    if show:
        print_command(command)
    with hide("running"):
        return _run(command, *args, **kwargs)
1155499
def get_args(request_args, allowed_int_args=(), allowed_str_args=(), allowed_bool_args=()):
    """"""
    args = {}

    for allowed_int_arg in allowed_int_args:
        int_value = request_args.get(allowed_int_arg, default=None, type=None)

        if int_value:
            args[allowed_int_arg] = int(int_value)

    for allowed_str_arg in allowed_str_args:
        str_value = request_args.get(allowed_str_arg, default=None, type=None)

        if str_value:
            args[allowed_str_arg] = str_value

    for allowed_bool_arg in allowed_bool_args:
        str_value = request_args.get(allowed_bool_arg, default=None, type=None)

        if str_value == 'true':
            args[allowed_bool_arg] = True

        elif str_value == 'false':
            args[allowed_bool_arg] = False

    return args
574635
def run(self, args=(), env={}):
        

        # the following will call self._get_exec_binary
        return self._exec(self.binary, args=args, env=env)
975124
def argument_run(self, sp_r):
		
		arg_run = []

		for line in sp_r:
			logging.debug("argument run: handling: " + str(line))
			if(line[1] == "data"):
				arg_run.append( (line[0], line[1], line[2], line[2].get_words(line[3])))
				continue
			if(line[1] == "command"):
				self.checkargs(line[0], line[2], line[3])
				arg_run.append( (line[0], line[1], line[2], [a for a in self.convert_args(line[2], line[3])]))
		return arg_run