collect operator
325623
function collectOpt(char) {
    if (char === '\r') {
      return;
    }

    char = char === '\n' ? ' ' : char;
    // merge the same operator
    if (last && last.unit === char && !scopeOpt.includes(char)) {
      last.expr += char;
    } else {
      const optEl = {
        expr: char,
        unit: char,
        type: 'opt',
      };

      // mark def type, like 'key' in '{ key: value }',
      // which is no need to prepend '_$o'
      let isDef = char === ':' && lastOpt && (lastOpt.expr === '{' || lastOpt.expr === ',');
      isDef = isDef && lastEl && lastEl.type === 'prop';
      if (isDef) {
        lastEl.type = 'def';
      }

      if (char !== ' ') {
        lastOpt = optEl;
      }

      fragments.push(last = optEl);
    }
  }
21327
def collect_rows &block
      return to_enum(:collect_rows) unless block_given?

      Daru::Vector.new(each_row.map(&block), index: @index)
    end
387954
def each_indexed_object(collection, index_name, **where):
    """"""
    index = _db[collection].indexes[index_name]
    for id in index.value_map.get(indexed_value(index, where), []):
        yield get_object(collection, id)
436293
def collect_tokens(cls, parseresult, mode):
        
        inner = '(%s)' if mode=='parens' else '[%s]'
        if parseresult is None: return []
        tokens = []
        for token in parseresult.asList():
            # If value is a tuple, the token will be a list
            if isinstance(token, list):
                token = cls.recurse_token(token, inner)
                tokens[-1] = tokens[-1] + token
            else:
                if token.strip() == ',': continue
                tokens.append(cls._strip_commas(token))
        return tokens
1194813
def collect_level level , objects
      next_level = Array.new
      #puts "collect level #{level} #{objects.length}"
      objects.each do |object|
        #puts "collect level #{level} #{object.object_id}"
        # not storing simple (value) objects
        next if is_value?(object)
        case object.class.name
        when "Array" , "Parfait::List"
          collect_array object , next_level
        when "Hash" , "Parfait::Dictionary"
          collect_hash object, next_level
        else
          # and recursively add attributes
          attributes = attributes_for(object)
          attributes.each do |a|
            val = get_value( object , a)
            next_level << val
          end
          #TODO get all superclsses here, but this covers 99% so . . moving on
          superclasses = [object.class.superclass.name]
          if superclasses.include?( "Array") or superclasses.include?( "Parfait::List")
            collect_array object, next_level
          end
          if superclasses.include?( "Hash") or superclasses.include?( "Parfait::Dictionary")
            collect_hash object, next_level
          end
        end
      end
      new_objects = next_level.collect { |o| add_object(o , level + 1) }
      new_objects.compact!
      # recurse , but break off if hit bottom
      collect_level( level + 1 , new_objects) unless new_objects.empty?
    end
592480
function collectProperties(groups, properties) { 
  var collection = {};
  for (var key in groups) {
    if (Array.isArray(groups[key])) {
      collection[key] = groups[key].reduce(function(coll, item) {
        properties.forEach(function(prop) { 
          if (!coll[prop]) coll[prop] = [];
          coll[prop] = coll[prop].concat(propertyAt(item,prop));
        })
        return coll;
      }, {})
    } else {
      collection[key] = collectProperties(groups[key], properties);
    }
  }
  return collection;
}
1069305
def _get_things(self, method, thing, thing_type, params=None, cacheable=True):
        """"""

        limit = params.get("limit", 1)
        seq = []
        for node in _collect_nodes(
            limit, self, self.ws_prefix + "." + method, cacheable, params
        ):
            title = _extract(node, "name")
            artist = _extract(node, "name", 1)
            playcount = _number(_extract(node, "playcount"))

            seq.append(TopItem(thing_type(artist, title, self.network), playcount))

        return seq
1138679
private void collect(PrintStream out, List<ItemSet> list, TotalSupportTree ttree, int[] itemset, int support) {
        if (list != null) {
            synchronized (list) {
                list.add(new ItemSet(itemset, support));
            }
        }
        if (out != null) {
            synchronized (out) {
                for (int i = 0; i < itemset.length; i++) {
                    out.format("%d ", itemset[i]);
                }
                out.format("(%d)%n", support);
            }
        }
        if (ttree != null) {
            synchronized (ttree) {
                ttree.add(itemset, support);
            }
        }
    }
544353
def collect(self):
        """"""
        for func in self._caches:
            cache = {}
            for key in self._caches[func]:
                if (time.time() - self._caches[func][key][1]) < self._timeouts[func]:
                    cache[key] = self._caches[func][key]
            self._caches[func] = cache
429519
function collectTransitiveDependencies(
  collected,
  depGraph,
  fromName
) {
  const immediateDeps = depGraph[fromName];
  if (immediateDeps) {
    Object.keys(immediateDeps).forEach(toName => {
      if (!collected[toName]) {
        collected[toName] = true;
        collectTransitiveDependencies(collected, depGraph, toName);
      }
    });
  }
}
1030649
public static <T, P, A, R extends Collection<A>> R collectWith(
            Iterable<T> iterable,
            Function2<? super T, ? super P, ? extends A> function,
            P parameter,
            R targetCollection)
    {
        if (iterable instanceof RichIterable)
        {
            return ((RichIterable<T>) iterable).collectWith(function, parameter, targetCollection);
        }
        if (iterable instanceof ArrayList)
        {
            return ArrayListIterate.collectWith((ArrayList<T>) iterable, function, parameter, targetCollection);
        }
        if (iterable instanceof RandomAccess)
        {
            return RandomAccessListIterate.collectWith((List<T>) iterable, function, parameter, targetCollection);
        }
        if (iterable != null)
        {
            return IterableIterate.collectWith(iterable, function, parameter, targetCollection);
        }
        throw new IllegalArgumentException("Cannot perform a collectWith on null");
    }
711789
function collect(what, which) {
    var res = {};
    while (what) {
      res = Object.assign({}, what[which], res); // Respect prototype priority
      what = Object.getPrototypeOf(what);
    }
    return res;
  }
1081005
def accumulate(iterable, func=operator.add):
    
    it = iter(iterable)
    total = next(it)
    yield total
    for element in it:
        total = func(total, element)
        yield total
40952
def collect_related(self, finder_funcs, obj, count, *args, **kwargs):
        
        collected = []
        for func in finder_funcs:
            gathered = func(obj, count, collected, *args, **kwargs)
            if gathered:
                collected += gathered
            if len(collected) >= count:
                return collected[:count]

        return collected
1174151
def collect(as_enum=false)
      file = Tempfile.new('collect', context.temp_dir)

      context.set_call_site(caller.first)
      RubyRDD.writeRDDToFile(jrdd.rdd, file.path)

      collect_from_file(file, as_enum)
    rescue => e
      raise Spark::RDDError, e.message
    ensure
      context.clear_call_site
    end
651654
function collect() {
		$inc_failed = count($this->_failed['inc']);
		$dec_failed = count($this->_failed['dec']);
		$n_saved    = count($this->_saved);
		$n_inc      = count($this->_increased);
		$n_dec      = count($this->_decreased);
		$n_fetched  = count($this->_fetched);
		$n_deleted  = count($this->_deleted);
		$data = array(
			'count'       =>0,
			'messages'    =>array(),
		);
		if ( $inc_failed+$dec_failed>0 ) {
			$data['messages'][] =  array(
				'message'  => "Caches Failed: [ Inc:{$inc_failed} , Dec:{$dec_failed} ]",
				'is_string'=> true,
				'label'    => 'Caches Summary'
			);
		}
		$message = "Caches Count: [ Saved:{$n_saved} ; Gets:{$n_fetched}";
		if ( $this->_nulls>0 ) {
			$message .= "(nulls:{$this->_nulls})";
		}
		if ( $n_inc>0 ) {
			$message .= " ; Inc:{$n_inc}";
		}
		if ( $n_dec>0 ) {
			$message .= " ; Dec:{$n_dec}";
		}
		if ( $n_deleted>0 ) {
			$message .= " ; Deleted:{$n_deleted}";
		}
		if ( $this->_flushed ) {
			$message .= " ; Has Flushed";
		}
		$data['messages'][] = array(
			'message'  => $message.' ]',
			'is_string'=> true,
			'label'    => 'Caches Summary'
		);

		if ( !$this->_mode && $this->_messagesCollector ) {
			foreach ( $data['messages'] as $value ) {
				$this->_messagesCollector->addMessage($value['message'],$value['label'],$value['is_string']);
			}
			return array();
		}

		$messages = array();
		foreach ( $this->_saved as $key=>$value ) {
			$lifetime = '';
			if ( $value['lifetime']!==null ) {
				$lifetime = "Lifetime=>"."{$value['lifetime']}";
			}
			$content    = $value['content'];
			if ( !is_string( $content ) ) {
				$content = $this->formatVars($content);
				$message= "Saved: [ Key=>\"$key\"  $lifetime  Value=> $content[0] ]";
			}else{
				$message= "Saved: [ Key=>\"$key\"  $lifetime  Value=> \"$content\" ]";
			}
			$messages[] = array(
				'message'   => $message,
				'is_string' => mb_strlen($message)>100?false:true,
				'label'     => 'Saved',
				'time'      =>$value['time'],
			);
		}
		foreach ( $this->_fetched as $key=>$value ) {
			$content = $value['value'];
			if ( !is_string( $value ) ) {
				$content = $this->formatVars($content);
				$message= "Gets: [ Key=>\"$key\"   Value=> $content[0] ]";
			}else{
				$message= "Gets: [ Key=>\"$key\"   Value=> \"$content\" ]";
			}
			$messages[] = array(
				'message'   => $message,
				'is_string' => mb_strlen($message)>100?false:true,
				'label'     => 'Gets',
				'time'      => $value['time'],
			);
		}
		foreach ( $this->_deleted as $value ) {
			$messages[] = array(
				'message'   => 'DeletedKey: [ '.$value['key'].' ]',
				'is_string' => true,
				'label'     => 'Deleted',
				'time'      => $value['time'],
			);
		}
		foreach ( $this->_increased as $value ) {
			$messages[] = array(
				'message'   => "Increased: [ Key:{$value['key']} , Step:{$value['step']} , NewValue:{$value['new_value']}] ",
				'is_string' => true,
				'label'     => 'Increased',
				'time'      => $value['time'],
			);
		}
		foreach ( $this->_decreased as $value ) {
			$messages[] = array(
				'message'   => "Decreased: [ Key:{$value['key']} , Step:{$value['step']} , NewValue:{$value['new_value']}] ",
				'is_string' => true,
				'label'     => 'Decreased',
				'time'      => $value['time'],
			);
		}
		foreach ( $this->_failed['inc'] as $value ) {
			$messages[] = array(
				'message'   => "IncFailed: [ Key:{$value['key']} , Step:{$value['step']}] ",
				'is_string' => true,
				'label'     => 'IncFailed',
				'time'      => $value['time'],
			);
		}
		foreach ( $this->_failed['dec'] as $value ) {
			$messages[] = array(
				'message'   => "DecFailed: [ Key:{$value['key']} , Step:{$value['step']}] ",
				'is_string' => true,
				'label'     => 'DecFailed',
				'time'      => $value['time'],
			);
		}
		$data['messages'] = array_merge($data['messages'],  $this->sort($messages));
		$data['count'] = count($messages);
		return $data;
	}
439222
def collect(self):
        
        collected = super(Command, self).collect()
        if self.faster:
            self.worker_spawn_method()
            self.post_processor()
        return collected