Deconstruct a queue-name to a set of arguments
420789
def deconstruct(name):
    ''''''
    name = coerce_unicode(name, _c.FSQ_CHARSET)
    new_arg = sep = u''
    args = []
    # can't get delimiter, if string is empty
    if 1 > len(name):
        raise FSQMalformedEntryError(errno.EINVAL, u'cannot derive delimiter'\
                                     u'from: {0}'.format(name))

    delimiter, encodeseq = delimiter_encodeseq(name[0], _c.FSQ_ENCODE,
                                               _c.FSQ_CHARSET)
    # edge case, no args
    if 1 == len(name):
        return delimiter, args

    # normal case
    encoding_trg = sep
    for c in name[1:]:
        if 3 == len(encoding_trg):
            encoding_trg = sep
        if c == encodeseq or len(encoding_trg):
            encoding_trg = sep.join([encoding_trg, c])
        elif c == delimiter:
            # at delimiter, append and reset working arg
            args.append(decode(new_arg, delimiter=delimiter,
                               encodeseq=encodeseq))
            new_arg = sep
            continue

        new_arg = sep.join([new_arg, c])

    # append our last arg
    args.append(decode(new_arg, delimiter=delimiter, encodeseq=encodeseq))
    return delimiter, args
749532
def _queue(self, kwargs):
    """"""
    if not 'hard resource_list' in kwargs: return 'all.q'
    d = dict([k.split('=') for k in kwargs['hard resource_list'].split(',')])
    for k in d:
      if k[0] == 'q' and d[k] == 'TRUE': return k
    return 'all.q'
1084335
def replace_argument(self, name, *args, **kwargs):
        
        new_arg = self.argument_class(name, *args, **kwargs)
        for index, arg in enumerate(self.args[:]):
            if new_arg.name == arg.name:
                del self.args[index]
                self.args.append(new_arg)
                break
        return self
783851
def split_func_name_args_params_handle(tokens):
    """"""
    internal_assert(len(tokens) == 2, "invalid function definition splitting tokens", tokens)
    func_name = tokens[0]
    func_args = []
    func_params = []
    for arg in tokens[1]:
        if len(arg) > 1 and arg[0] in ("*", "**"):
            func_args.append(arg[1])
        elif arg[0] != "*":
            func_args.append(arg[0])
        func_params.append("".join(arg))
    return [
        func_name,
        ", ".join(func_args),
        "(" + ", ".join(func_params) + ")",
    ]
753575
def extract_kwargs(names:Collection[str], kwargs:KWArgs):
    ""
    new_kwargs = {}
    for arg_name in names:
        if arg_name in kwargs:
            arg_val = kwargs.pop(arg_name)
            new_kwargs[arg_name] = arg_val
    return new_kwargs, kwargs
184331
function splitArgObjects (args) {
  const newArgs = []
  let index = 0

  while (index < args.length) {
    const arg = args[index]

    if (arg.indexOf('{') !== -1) {
      const temp = []

      while (args[index].indexOf('}') === -1) {
        temp.push(args[index])
        index++
      }
      temp.push(args[index])

      newArgs.push(temp.join(' ').replace(/([\w\d-]+):\s*([\w\d-]*)/g, '"$1": "$2"'))
    } else {
      newArgs.push(arg)
    }

    index++
  }

  return newArgs
}
133819
function Queue(parameters) {
    parameters = parameters || new composites.Parameters(new Catalog());
    if (!parameters.getParameter('$type')) parameters.setParameter('$type', '/bali/collections/Queue/v1');
    abstractions.Collection.call(this, utilities.types.QUEUE, parameters);

    // the capacity and array are private attributes so methods that use it are
    // defined in the constructor
    var capacity = 1024;  // default capacity
    if (parameters) {
        const value = parameters.getParameter('$capacity', 2);
        if (value) capacity = value.toNumber();
    }
    const array = [];

    this.acceptVisitor = function(visitor) {
        visitor.visitQueue(this);
    };

    this.toArray = function() {
        return array.slice();  // copy the array
    };

    this.getSize = function() {
        return array.length;
    };

    this.addItem = function(item) {
        if (array.length < capacity) {
            item = this.convert(item);
            array.push(item);
            return true;
        }
        throw new utilities.Exception({
            $module: '/bali/collections/Queue',
            $procedure: '$addItem',
            $exception: '$resourceLimit',
            $capacity: capacity,
            $text: '"The queue has reached its maximum capacity."'
        });
    };

    this.removeItem = function() {
        if (array.length > 0) return array.splice(0, 1)[0];  // remove the first item in the array
    };

    this.getHead = function() {
        return array[0];
    };

    this.deleteAll = function() {
        array.splice(0);
    };

    return this;
}
105535
def deconstruct(self):
        """"""
        name, path, args, kwargs = super(VersionField, self).deconstruct()
        kwargs['partial'] = self.partial
        kwargs['coerce'] = self.coerce
        return name, path, args, kwargs
1119351
function getArguments(name, mixin, obj) {
		let named = obj.named,
			ordered = obj.ordered,
			args = [],
			parameters;

		// Cache function parameter names
		if (! mixinArguments[name]) {
			mixinArguments[name] = mixin.toString()
				// Strip out quoted strings (stripping possible commas from parameters)
				.replace(/'((?:[^'\\])*)'|"((?:[^"\\])*)"/g, '')
				// Pull out parameters from function
				.match(/(?:function)?\s?.*?\s?\(([^)]*)\)/)[1]
				.split(',')
				.map(function(arg) {
					return arg.split('=')[0].trim();
				});
		}

		parameters = mixinArguments[name];

		Object.keys(named).forEach(key => {
			parameters.forEach((param, i) => {
				if (key === param) {
					args[i] = castArgument(named[key]);
				}
			});
		});

		ordered.forEach((arg, i) => {
			args[i] = castArgument(arg);
		});

		return args;
	}
237630
def process_kwargs(self, kwargs, prefix='default_', delete=True):
        
        processed = []
        for k in kwargs:
            if hasattr(self, prefix + k):
                processed += [k]
                setattr(self, prefix + k, kwargs[k])
        for k in processed:
            del(kwargs[k])
        return kwargs
521976
def _namify_arguments(mapping):
    
    result = []
    for name, parameter in mapping.iteritems():
        parameter.name = name
        result.append(parameter)
    return result
748775
function prepare_args(args) {
	var tmp = {};
	Object.keys(args).filter(function(key) {
		return key.length >= 3;
	}).forEach(function(key) {
		tmp[key.replace(/\-/g, '_')] = '' + args[key];
	});
	return tmp;
}
127637
def _set_named_args(self, **kv):
        
        for k in kv:
            self._body['${0}'.format(k)] = kv[k]
        return self
358638
def enqueue(self, name, value, valueType=None, stamp=None):
    """"""
    # If queue is too large, refuse to log.
    if self.maxQueueSize and self.queue.qsize() > self.maxQueueSize:
      return
    # Stick arguments into the queue
    self.queue.put((name, value, valueType, stamp))
1287037
def deconstruct(self):
        """"""
        path = '%s.%s' % (self.__class__.__module__, self.__class__.__name__)
        args, kwargs = (), {}

        if len(self.children) == 1 and not isinstance(self.children[0], Q):
            child = self.children[0]
            kwargs = {child[0]: child[1]}
        else:
            args = tuple(self.children)
            if self.connector != self.default:
                kwargs = {'_connector': self.connector}
        if self.negated:
            kwargs['_negated'] = True
        return path, args, kwargs
1208253
function purge() {
    qLog.info(`Purging queue ${channelName} - ${connectionName}`);
    return channel.purgeQueue(channelName).then(function(){
      qLog.debug(`Successfully purged queue ${channelName} - ${connectionName}`);
    });
  }
941308
def _get_queue_name(cls, queue_name=None):
        
        if queue_name is None and cls.queue_name is None:
            raise LimpydJobsException("Queue's name not defined")
        if queue_name is None:
            return cls.queue_name
        return queue_name