A storm sub-query aware command line splitter.
        ( not for storm commands, but for commands which may take storm )
359726
def stormcmd(self):
        '''
        
        '''
        argv = []
        while self.more():
            self.ignore(whitespace)
            if self.nextstr('{'):
                self.offs += 1
                start = self.offs
                self.query()
                argv.append('{' + self.text[start:self.offs] + '}')
                self.nextmust('}')
                continue

            argv.append(self.cmdvalu(until=whitespace))
        return argv
400946
function (args, callback) {
        var query =
          {
            type: "lint",  //$NON-NLS-1$
            file: args.meta.location,
            config: args.config
          };
        ternserver.request(
          {
            query: query,
            files: args.files
          },
          function (error, problems) {
            if (error) {
              callback({request: 'lint', error: error.message, message: Messages['failedToComputeProblems']}); //$NON-NLS-1$
            } else if (problems && Array.isArray(problems)) {
              callback({request: 'lint', problems: problems}); //$NON-NLS-1$
            } else {
              callback({request: 'lint', problems: []}); //$NON-NLS-1$
            }
          });
      }
422417
function command(cmd, args, info) {
  var map = info.commands || Constants.MAP
    , def = map[cmd]
    , sub;

  // support command exec handlers that
  // encapsulate the definition
  if(def && def.definition !== undefined) {
    def = def.definition;
  }

  // top-level command
  if(def === undefined) {
    throw new UnknownCommand(cmd);
  }

  // made it this far, check subcommands
  // for commands that require a subcommand
  if(Constants.SUBCOMMAND[cmd] && args.length > 0) {
    sub = Constants.SUBCOMMAND[cmd][args[0]];
    if(!sub) {
      if(cmd === Constants.MAP.client.name) {
        throw ClientSyntax;
      }
      throw UnknownSubcommand;
    }
    // mutate the sub response to include
    // the subcommand as a primary command
    // and the remaining arguments, callers
    // can use this to locate a subcommand
    // execution method
    sub = {def: sub, cmd: args[0], args: args.slice(1)};
  }

  return {cmd: cmd, args: args, def: def, sub: sub};
}
1318369
def runQuery(statDict, query):
  """"""
  parts = [x.strip() for x in OPERATOR.split(query)]
  assert len(parts) in (1, 3)
  queryKey = parts[0]

  result = {}
  for key, value in six.iteritems(statDict):
    if key == queryKey:
      if len(parts) == 3:
        op = OPERATORS[parts[1]]
        try:
          queryValue = type(value)(parts[2]) if value else parts[2]
        except (TypeError, ValueError):
          continue
        if not op(value, queryValue):
          continue
      result[key] = value
    elif isinstance(value, scales.StatContainer) or isinstance(value, dict):
      child = runQuery(value, query)
      if child:
        result[key] = child
  return result
330624
def split_input(cls, mapper_spec):
    
    batch_size = int(_get_params(mapper_spec).get(
        cls.BATCH_SIZE_PARAM, cls._BATCH_SIZE))
    shard_count = mapper_spec.shard_count
    namespace_ranges = namespace_range.NamespaceRange.split(shard_count,
                                                            contiguous=True)
    return [NamespaceInputReader(ns_range, batch_size)
            for ns_range in namespace_ranges]
1072688
def splitquery(url):
    """"""
    global _queryprog
    if _queryprog is None:
        import re
        _queryprog = re.compile('^(.*)\?([^?]*)$')

    match = _queryprog.match(url)
    if match: return match.group(1, 2)
    return url, None
932176
def command_lines():
        
        return ZeroOrMore(Group(
            Group(ZeroOrMore(Group(Grammar.comment))) + Grammar._non_comment_line
        ))
1254348
function normalize(def) {
  if (~noMergeCmds.indexOf(command))
    return stiks.argv.splitArgs(def);
  return stiks.argv.mergeArgs(def, input);
}
1332799
def _get_split_tasks(args, split_fn, file_key, outfile_i=-1):
    
    split_args = []
    combine_map = {}
    finished_map = collections.OrderedDict()
    extras = []
    for data in args:
        out_final, out_parts = split_fn(data)
        for parts in out_parts:
            split_args.append([utils.deepish_copy(data)] + list(parts))
        for part_file in [x[outfile_i] for x in out_parts]:
            combine_map[part_file] = out_final
        if len(out_parts) == 0:
            if out_final is not None:
                if out_final not in finished_map:
                    data[file_key] = out_final
                    finished_map[out_final] = [data]
                else:
                    extras.append([data])
            else:
                extras.append([data])
    return split_args, combine_map, list(finished_map.values()), extras
509451
def as_bulk_queries(queries, bulk_size):
    
    stmt_dict = defaultdict(list)
    for stmt, args in queries:
        bulk_args = stmt_dict[stmt]
        bulk_args.append(args)
        if len(bulk_args) == bulk_size:
            yield stmt, bulk_args
            del stmt_dict[stmt]
    for stmt, bulk_args in stmt_dict.items():
        yield stmt, bulk_args
1173593
def query(options, collection_name, num_to_skip, num_to_return,
          query, field_selector, opts, check_keys=False, ctx=None):
    """"""
    if ctx:
        return _query_compressed(options, collection_name, num_to_skip,
                                 num_to_return, query, field_selector,
                                 opts, check_keys, ctx)
    return _query_uncompressed(options, collection_name, num_to_skip,
                               num_to_return, query, field_selector, opts,
                               check_keys)
504675
def cli(ctx, ids, query, filters, details, interval):
    """"""
    if details:
        display = 'details'
    else:
        display = 'compact'
    from_date = None

    auto_refresh = True
    while auto_refresh:
        try:
            auto_refresh, from_date = ctx.invoke(query_cmd, ids=ids, query=query,
                                                 filters=filters, display=display, from_date=from_date)
            time.sleep(interval)
        except (KeyboardInterrupt, SystemExit) as e:
            sys.exit(e)
1344167
def split_commandline(s, comments=False, posix=True):
    
    # shlex seems to remove unescaped quotes and backslashes
    s = s.replace('\\', '\\\\')
    s = s.replace('\'', '\\\'')
    s = s.replace('\"', '\\\"')
    lex = shlex.shlex(s, posix=posix)
    lex.whitespace_split = True
    lex.whitespace = ';'
    if not comments:
        lex.commenters = ''
    return list(lex)
372243
def getStormQuery(self, text):
        '''
        
        '''
        query = s_syntax.Parser(text).query()
        query.init(self)
        return query
912686
def split_commands(cmd_line)
      return [""] if cmd_line.empty?

      cmd_line.split(/;/).each_with_object([]) do |v, m|
        if m.empty? || m.last[-1] != '\\'
          m << v.strip
          next
        end

        m.last[-1, 1] = ""
        m.last << ";" << v
      end
    end
560128
def split_cmdline(cmdline):
    """"""
    path, cmd = os.path.split(cmdline[0])
    arguments = ' '.join(cmdline[1:])
    return path, cmd, arguments
749224
def split_input(cls, mapper_spec):
    
    params = _get_params(mapper_spec)
    shard_count = mapper_spec.shard_count

    # Pick out the overall start and end times and time step per shard.
    start_time = params[cls.START_TIME_PARAM]
    end_time = params[cls.END_TIME_PARAM]
    seconds_per_shard = (end_time - start_time) / shard_count

    # Create a LogInputReader for each shard, modulating the params as we go.
    shards = []
    for _ in xrange(shard_count - 1):
      params[cls.END_TIME_PARAM] = (params[cls.START_TIME_PARAM] +
                                    seconds_per_shard)
      shards.append(LogInputReader(**params))
      params[cls.START_TIME_PARAM] = params[cls.END_TIME_PARAM]

    # Create a final shard to complete the time range.
    params[cls.END_TIME_PARAM] = end_time
    return shards + [LogInputReader(**params)]