Converts command line args into a list of template inputs
359739
def _get_inputs(self, old_inputs):
        
        # Convert inputs to dict to facilitate overriding by channel name
        # Also, drop DataNode ID and keep only contents.
        input_dict = {}
        for input in old_inputs:
            # Strip out DataNode UUID and URL
            input['data'] = {'contents': input['data']['contents']}
            input_dict[input['channel']] = input

        file_inputs = self._get_file_inputs()
        try:
            jsonschema.validate(file_inputs, file_input_schema)
        except jsonschema.ValidationError:
            raise SystemExit("ERROR! User inputs file is not valid")
        for (channel, input_id) in file_inputs.iteritems():
            input_dict[channel] = {
                'channel': channel,
                'data': {'contents': input_id}
            }
        # Override with cli user inputs if specified
        if self.args.inputs:
            for kv_pair in self.args.inputs:
                (channel, input_id) = kv_pair.split('=')
                input_dict[channel] = {
                    'channel': channel,
                    'data': {
                        'contents':
                        self._parse_string_to_nested_lists(input_id)}
                }
        return input_dict.values()
950352
def _string_from_cmd_list(cmd_list):
    """"""
    cl = []
    for arg in map(str, cmd_list):
        if ' ' in arg or '\t' in arg:
            arg = '"' + arg + '"'
        cl.append(arg)
    return ' '.join(cl)
679266
def process_list_arg(arg):
    
    if isinstance(arg, list):
        return arg
    elif isinstance(arg, basestring):
        args = []
        for part in arg.split(","):
            args.append(part.strip())
        return args
762767
def _parse_arg_list(arglist):
    
    args = []
    for arg in arglist.split(','):
        arg = arg.strip()
        if arg: # string is not empty
            args.append(eval(arg))
    return args
388677
def check_arguments(cls, passed):
        """"""
        defaults = list(cls.default_arguments().keys())
        template = ("Pass arg {argument:!r} in {cname:!r}, can be a typo? "
                    "Supported key arguments: {defaults}")
        fails = []
        for arg in passed:
            if arg not in defaults:
                warn(template.format(argument=arg,
                                     cname=cls.__name__,
                                     defaults=defaults))
                fails.append(arg)

        return any(fails)
835984
def select_template_from_string(arg):
    
    if ',' in arg:
        tpl = loader.select_template(
            [tn.strip() for tn in arg.split(',')])
    else:
        tpl = loader.get_template(arg)
    return tpl
1124661
private List<OutputFile> processTemplates(List<TemplateFile> inputs) throws IOException {
    List<OutputFile> outputs = new ArrayList<>();
    for (TemplateFile f : inputs) {
      String fileName = f.getFileName();
      if (!fileName.contains("VType") && fileName.contains("KType")) {
        for (Type ktype : Type.values()) {
          TemplateOptions options = new TemplateOptions(ktype);
          options.templateFile = f.path;
          generate(f, outputs, options);
        }
      }
      if (fileName.contains("KTypeVType")) {
        for (Type ktype : Type.values()) {
          for (Type vtype : Type.values()) {
            TemplateOptions options = new TemplateOptions(ktype, vtype);
            options.templateFile = f.path;
            generate(f, outputs, options);
          }
        }
      }
    }
    return outputs;
  }
1365147
def _get_arg_tokens(cli):
    
    arg = cli.input_processor.arg

    return [
        (Token.Prompt.Arg, '(arg: '),
        (Token.Prompt.Arg.Text, str(arg)),
        (Token.Prompt.Arg, ') '),
    ]
858629
def process_args_from_command_line(self):
        """"""
        # Yes, this is ugly, but we don't want to interfere with setup.py's own
        # option handling
        opts_to_remove = []
        for idx, option in enumerate(sys.argv):
            if not option.startswith("--"):
                continue
            if option == "--static":
                opts_to_remove.append(idx)
                self.static_extension = True
            elif option == "--no-download":
                opts_to_remove.append(idx)
                self.download_igraph_if_needed = False
            elif option == "--no-pkg-config":
                opts_to_remove.append(idx)
                self.use_pkgconfig = False
            elif option == "--no-progress-bar":
                opts_to_remove.append(idx)
                self.show_progress_bar = False
            elif option == "--no-wait":
                opts_to_remove.append(idx)
                self.wait = False                
            elif option.startswith("--c-core-version"):
                opts_to_remove.append(idx)
                if option == "--c-core-version":
                    value = sys.argv[idx+1]
                    opts_to_remove.append(idx+1)
                else:
                    value = option.split("=", 1)[1]
                self.c_core_versions = [value]
            elif option.startswith("--c-core-url"):
                opts_to_remove.append(idx)
                if option == "--c-core-url":
                    value = sys.argv[idx+1]
                    opts_to_remove.append(idx+1)
                else:
                    value = option.split("=", 1)[1]
                self.c_core_url = value

        for idx in reversed(opts_to_remove):
            sys.argv[idx:(idx+1)] = []
303928
def _output_to_list(cmdoutput):
    '''
    
    '''
    return [item for line in cmdoutput.splitlines() if _safe_output(line) for item in line.split()]
134115
def list_input(*args, **kwargs):
    '''
    
    '''
    list_input = wtforms.TextAreaField(*args, **kwargs)
    list_input.input_type = 'list'
    return list_input
669121
def iterate_templates(self):
        
        return [t for dd in self.dirs for t in Template.scan(dd)]
475897
def _parse_args(args, cls):
    
    
    d = _create_djset(args, cls)
    
    key_value_pair = args.get('<key>=<value>')
    key = args.get('<key>')
    func = None
    if args.get('add') and key_value_pair:
        fargs = tuple(args.get('<key>=<value>').split('='))
        if fargs[1]:
            func = d.set
    elif args.get('remove') and key:
        func = d.remove
        fargs = (args.get('<key>'),)
    kwargs = {'glob': args.get('--global')}
    if func:
        return func, fargs, kwargs
    else:
        return None, None, None
670253
def split_args_list(tokens, loc):
    """"""
    req_args, def_args, star_arg, kwd_args, dubstar_arg = [], [], None, [], None
    pos = 0
    for arg in tokens:
        if len(arg) == 1:
            if arg[0] == "*":
                # star sep (pos = 3)
                if pos >= 3:
                    raise CoconutDeferredSyntaxError("star separator at invalid position in function definition", loc)
                pos = 3
            else:
                # pos arg (pos = 0)
                if pos > 0:
                    raise CoconutDeferredSyntaxError("positional arguments must come first in function definition", loc)
                req_args.append(arg[0])
        elif len(arg) == 2:
            if arg[0] == "*":
                # star arg (pos = 2)
                if pos >= 2:
                    raise CoconutDeferredSyntaxError("star argument at invalid position in function definition", loc)
                pos = 2
                star_arg = arg[1]
            elif arg[0] == "**":
                # dub star arg (pos = 4)
                if pos == 4:
                    raise CoconutDeferredSyntaxError("double star argument at invalid position in function definition", loc)
                pos = 4
                dubstar_arg = arg[1]
            else:
                # def arg (pos = 1)
                if pos <= 1:
                    pos = 1
                    def_args.append((arg[0], arg[1]))
                # kwd arg (pos = 3)
                elif pos <= 3:
                    pos = 3
                    kwd_args.append((arg[0], arg[1]))
                else:
                    raise CoconutDeferredSyntaxError("invalid default argument in function definition", loc)
        else:
            raise CoconutInternalException("invalid function definition argument", arg)
    return req_args, def_args, star_arg, kwd_args, dubstar_arg
1103787
def generate_listall_output(lines, resources, aws_config, template, arguments, nodup = False):
    
    for line in lines:
        output = []
        for resource in resources:
            current_path = resource.split('.')
            outline = line[1]
            for key in line[2]:
                outline = outline.replace('_KEY_('+key+')', get_value_at(aws_config['services'], current_path, key, True))
            output.append(outline)
        output = '\n'.join(line for line in sorted(set(output)))
        template = template.replace(line[0], output)
    for (i, argument) in enumerate(arguments):
        template = template.replace('_ARG_%d_' % i, argument)
    return template
358179
def _AsList(arg):
    """"""
    if (isinstance(arg, string_types) or
        not isinstance(arg, collections.Iterable)):
      return [arg]
    else:
      return list(arg)
1056140
def parse_arg(arg):
    
    # handle string input
    if type(arg) == str:
        arg = arg.strip()
        # parse csv as tickers and create children
        if ',' in arg:
            arg = arg.split(',')
            arg = [x.strip() for x in arg]
        # assume single string - create single item list
        else:
            arg = [arg]

    return arg