Prepares an object map of argument values given a list of argument
    definitions and list of argument AST nodes.
488714
def get_argument_values(
    arg_defs,  # type: Union[Dict[str, GraphQLArgument], Dict]
    arg_asts,  # type: Optional[List[Argument]]
    variables=None,  # type: Optional[Dict[str, Union[List, Dict, int, float, bool, str, None]]]
):
    # type: (...) -> Dict[str, Any]
    """"""
    if not arg_defs:
        return {}

    if arg_asts:
        arg_ast_map = {
            arg.name.value: arg for arg in arg_asts
        }  # type: Dict[str, Argument]
    else:
        arg_ast_map = {}

    result = {}
    for name, arg_def in arg_defs.items():
        arg_type = arg_def.type
        arg_ast = arg_ast_map.get(name)
        if name not in arg_ast_map:
            if arg_def.default_value is not None:
                result[arg_def.out_name or name] = arg_def.default_value
                continue
            elif isinstance(arg_type, GraphQLNonNull):
                raise GraphQLError(
                    'Argument "{name}" of required type {arg_type}" was not provided.'.format(
                        name=name, arg_type=arg_type
                    ),
                    arg_asts,
                )
        elif isinstance(arg_ast.value, ast.Variable):  # type: ignore
            variable_name = arg_ast.value.name.value  # type: ignore
            if variables and variable_name in variables:
                result[arg_def.out_name or name] = variables[variable_name]
            elif arg_def.default_value is not None:
                result[arg_def.out_name or name] = arg_def.default_value
            elif isinstance(arg_type, GraphQLNonNull):
                raise GraphQLError(
                    'Argument "{name}" of required type {arg_type}" provided the variable "${variable_name}" which was not provided'.format(
                        name=name, arg_type=arg_type, variable_name=variable_name
                    ),
                    arg_asts,
                )
            continue

        else:
            value = value_from_ast(arg_ast.value, arg_type, variables)  # type: ignore
            if value is None:
                if arg_def.default_value is not None:
                    value = arg_def.default_value
                    result[arg_def.out_name or name] = value
            else:
                # We use out_name as the output name for the
                # dict if exists
                result[arg_def.out_name or name] = value

    return result
294726
def prepare(args):
    
    from jcvi.formats.base import write_file

    p = OptionParser(prepare.__doc__ + FastqNamings)
    p.add_option("-K", default=45, type="int",
                 help="K-mer size [default: %default]")
    p.add_option("--assemble_1st_rank_only", default=False, action="store_true",
                 help="Assemble the first rank only, other libs asm_flags=2 [default: %default]")
    p.add_option("--scaffold",
                 help="Only perform scaffolding [default: %default]")
    p.add_option("--gapclose",
                 help="Only perform gap closure [default: %default]")
    p.set_cpus()
    opts, args = p.parse_args(args)

    if len(args) < 1:
        sys.exit(not p.print_help())

    fnames = args
    K = opts.K
    for x in fnames:
        assert op.exists(x), "File `{0}` not found.".format(x)

    a1st = opts.assemble_1st_rank_only

    cfgfile = "soap.config"
    gc_cfgfile = "soap.gc.config"
    fw = open(cfgfile, "w")
    fw_gc = open(gc_cfgfile, "w")

    libs = get_libs(fnames)
    rank = 0
    singletons = []
    max_rd_len = max(readlen([f]) for f in fnames)

    block = "max_rd_len={0}\n".format(max_rd_len)
    for stream in (sys.stderr, fw, fw_gc):
        print(block, file=stream)

    # Collect singletons first
    singletons = []
    for lib, fs in libs:
        if lib.size == 0:
            singletons += fs
            continue

    for lib, fs in libs:
        size = lib.size
        if size == 0:
            continue

        rank += 1
        block = "[LIB]\n"
        block += "avg_ins={0}\n".format(size)
        f = fs[0]
        block += "reverse_seq={0}\n".format(lib.reverse_seq)
        asm_flags = 2 if (rank > 1 and a1st) else lib.asm_flags
        block += "asm_flags={0}\n".format(asm_flags)
        block += "rank={0}\n".format(rank)
        if lib.reverse_seq:
            pair_num_cutoff = 3
            block += "pair_num_cutoff={0}\n".format(pair_num_cutoff)
        block += "map_len=35\n"

        for f in fs:
            if ".1." in f:
                tag = "q1"
            elif ".2." in f:
                tag = "q2"
            block += "{0}={1}\n".format(tag, f)

        if rank == 1:
            for s in singletons:
                tag = "q" if is_fastq(s) else "f"
                block += tag + "={0}\n".format(s)

        print(block, file=sys.stderr)
        print(block, file=fw)

        if asm_flags > 2:
            print(block, file=fw_gc)

    runfile = "run.sh"
    scaffold = opts.scaffold
    bb = 63 if K <= 63 else 127
    binary = "SOAPdenovo-{0}mer".format(bb)
    header = SOAPHEADER.format(opts.cpus, K, binary)
    if opts.gapclose:
        gapclose = opts.gapclose
        outfile = gapclose.rsplit(".", 1)[0] + ".closed.fasta"
        template = header + GCRUNG.format(gapclose, outfile)
    else:
        template = header + (SCFRUN % scaffold if scaffold else SOAPRUN)

    write_file(runfile, template)
    fw.close()
    fw_gc.close()
114233
def convert_arguments(value):
    """"""
    if isinstance(value, (list, tuple)):
        return [
            CommandLineBinding(**item) if isinstance(item, dict) else item
            for item in value
        ]
    return shlex.split(value)
74219
def transform_arguments(arguments, prev_values, inputs)
      arguments = arguments.replace_values_from_previous(prev_values)
      arguments.each do |arg_name, arg_values|
        arguments[arg_name] = {} unless arguments[arg_name].is_a?(Hash)
        arguments[arg_name]['value'] = ''
        if inputs.key?(arg_name)
          arguments[arg_name]['value'] = inputs[arg_name]
        elsif arg_values.is_a?(Hash) && arg_values.key?('default')
          arguments[arg_name]['value'] = arg_values['default']
        end
      end
    end
261100
private static Object[] getParams(Context context, Object... arguments)
    {
        final Collection<Object> params = new ArrayList<>(1);
        params.add(context);
        params.addAll(Arrays.asList(arguments));
        return params.toArray();
    }
1057601
def _map_arg_names(source, mapping):
        """"""
        return {cartopy_name: source[cf_name] for cartopy_name, cf_name in mapping
                if cf_name in source}
1330538
def _preprocess(argument, casesensitive):
        """"""
        pattern_set = PatternSet()
        if argument is not None:
            if isinstance(argument, STRING_TYPES):
                argument = [argument, ]

            for glob in argument:
                if isinstance(glob, str):
                    patterns = Pattern.create(glob, casesensitive)
                    pattern_set.extend(patterns)

                elif isinstance(glob, Pattern):
                    pattern_set.append(glob)

        return pattern_set
9570
def serialize_args(self):
        """"""

        args, kwargs = super(ListParameter, self).serialize_args()
        args.insert(0, [self.param_type.id, self.param_type.serialize_args()])
1110795
function mapValues(fn, obj) {
  return keys(obj).reduce(function(acc, key) {
    acc[key] = fn(obj[key]);
    return acc;
  }, {});
}
1296409
def mapped(cls, key='id', **kwargs):
    """"""
    kwargs.setdefault('metadata', {})
    kwargs['metadata']['jsonldPredicate'] = {'mapSubject': key}
    kwargs.setdefault('default', attr.Factory(list))

    def converter(value):
        """Convert mapping to a list of instances."""
        if isinstance(value, dict):
            result = []
            for k, v in iteritems(value):
                if not hasattr(cls, 'from_cwl'):
                    vv = dict(v)
                    vv[key] = k
                else:
                    vv = attr.evolve(cls.from_cwl(v), **{key: k})
                result.append(vv)
        else:
            result = value

        def fix_keys(data):
            """Fix names of keys."""
            for a in fields(cls):
                a_name = a.name.rstrip('_')
                if a_name in data:
                    yield a.name, data[a_name]

        return [
            cls(**{kk: vv
                   for kk, vv in fix_keys(v)}) if not isinstance(v, cls) else v
            for v in result
        ]

    kwargs['converter'] = converter
    return attr.ib(**kwargs)
1140889
public static Map<Object,Object> parse(List<String>   args)
	{
		final short START =1, VAL=2;
		short state = START;
		Map<Object,Object> map = new HashMap<>(args.size());
		
		String key=null,value=null;
		for (String arg : args)
		{
			arg = arg.trim();
			
			switch(state)
			{
				case START: 
					
					if(arg.startsWith("-"))
						arg = Text.replaceForRegExprWith(arg, "^-*", "");
					
					if(arg.contains("="))
					{
						String[] tokens = Text.splitRE(arg, "=");
						if(tokens.length == 2)
						{
							key = tokens[0];
							value = tokens[1];
							
							map.put(key, formatValue(value));
							
							state = START;
						}
					}
					else
					{
						key = arg;
						state = VAL;
					}
					
					System.out.println("key:"+key);
					
					
				break;
				case VAL: 
					
					map.put(key, formatValue(arg));
					state = START;
				break;
			 	default: throw new RuntimeException("Unknown message:");
			}
		}
		
		
		return map;
	}
413441
protected void initializeArguments() {

    Map<String, BasicDoubleLinkedNode<CliArgumentContainer>> argumentMap = new HashMap<>();
    BasicDoubleLinkedNode<CliArgumentContainer> startHead = null;
    BasicDoubleLinkedNode<CliArgumentContainer> startTail = null;
    BasicDoubleLinkedNode<CliArgumentContainer> endHead = null;
    BasicDoubleLinkedNode<CliArgumentContainer> endTail = null;
    for (CliArgumentContainer argumentContainer : this.arguments) {
      String id = argumentContainer.getId();
      if ((CliArgument.ID_FIRST.equals(id)) || (CliArgument.ID_LAST.equals(id))) {
        throw new NlsIllegalArgumentException(id, argumentContainer.toString());
      }
      if (argumentMap.containsKey(id)) {
        throw new DuplicateObjectException(argumentContainer, id);
      }
      BasicDoubleLinkedNode<CliArgumentContainer> node = new BasicDoubleLinkedNode<>();
      node.setValue(argumentContainer);
      argumentMap.put(id, node);
      CliArgument cliArgument = argumentContainer.getArgument();
      boolean addAfter = cliArgument.addAfter();
      String nextTo = cliArgument.addCloseTo();
      if (CliArgument.ID_FIRST.equals(nextTo)) {
        if ((startHead == null) || (startTail == null)) {
          startHead = node;
          startTail = node;
        } else {
          if (addAfter) {
            startTail.insertAsNext(node);
            startTail = node;
          } else {
            startHead.insertAsPrevious(node);
            startHead = node;
          }
        }
        argumentContainer.init();
      } else if (CliArgument.ID_LAST.equals(nextTo)) {
        if ((endTail == null) || (endHead == null)) {
          endTail = node;
          endHead = node;
        } else {
          if (addAfter) {
            endTail.insertAsNext(node);
            endTail = node;
          } else {
            endHead.insertAsPrevious(node);
            endHead = node;
          }
        }
        argumentContainer.init();
      }
    }
    if ((startTail != null) && (endHead != null)) {
      // connect start and end of list...
      startTail.insertAsNext(endHead);
    }
    for (BasicDoubleLinkedNode<CliArgumentContainer> node : argumentMap.values()) {
      List<String> cycle = initializeArgumentRecursive(node, argumentMap);
      if (cycle != null) {
        StringBuilder sb = new StringBuilder();
        for (int i = cycle.size() - 1; i >= 0; i--) {
          sb.append(cycle.get(i));
          if (i > 0) {
            sb.append("-->");
          }
        }
        throw new IllegalStateException("Cyclic dependency of CLI modes: " + sb.toString());
      }
    }
    // order arguments
    if (startHead != null) {
      this.arguments.clear();
      startHead.addToList(this.arguments);
    } else if (endHead != null) {
      this.arguments.clear();
      BasicDoubleLinkedNode<CliArgumentContainer> node = endHead;
      BasicDoubleLinkedNode<CliArgumentContainer> previous = node.getPrevious();
      while (previous != null) {
        node = previous;
        previous = node.getPrevious();
      }
      node.addToList(this.arguments);
    }
  }
419529
def map(self, func):
        
        ns = self.Namespace()
        ns.results = []

        def by(value, index, list, *args):
            ns.results.append(func(value, index, list))

        _(self.obj).each(by)
        return self._wrap(ns.results)
368382
def _parse_field_arguments(arg, faces, edges, coords):
    ''''''
    if not hasattr(arg, '__iter__'):
        raise RuntimeError('field argument must be a list-like collection of instructions')
    pot = [_parse_field_argument(instruct, faces, edges, coords) for instruct in arg]
    # make a new Potential sum unless the length is 1
    if len(pot) <= 1:
        return pot[0]
    else:
        sp = java_link().jvm.nben.mesh.registration.Fields.newSum()
        for field in pot: sp.addField(field)
        return sp
502745
def valuemap(f):
    
    @wraps(f)
    def wrapper(*args, **kwargs):
        if 'value' in kwargs:
            val = kwargs['value']
            del kwargs['value']
            _f = f(*args, **kwargs)
            def valued_f(*args, **kwargs):
                result = _f(*args, **kwargs)
                s, obj, span = result
                if callable(val):
                    return PegreResult(s, val(obj), span)
                else:
                    return PegreResult(s, val, span)
            return valued_f
        else:
            return f(*args, **kwargs)
    return wrapper
1224232
function arrayMap (obj, iterate, context) {
  var result = []
  if (obj && arguments.length > 1) {
    context = context || this
    if (!baseExports.isFunction(iterate)) {
      iterate = baseExports.property(iterate)
    }
    if (obj.map) {
      return obj.map(iterate, context)
    } else {
      baseExports.each(obj, function () {
        result.push(iterate.apply(context, arguments))
      })
    }
  }
  return result
}
324000
def parse_argument_defs(lexer: Lexer) -> List[InputValueDefinitionNode]:
    """"""
    return (
        cast(
            List[InputValueDefinitionNode],
            many_nodes(
                lexer, TokenKind.PAREN_L, parse_input_value_def, TokenKind.PAREN_R
            ),
        )
        if peek(lexer, TokenKind.PAREN_L)
        else []
    )