converts the data structure into a compact version for output
181685
function (){
    var out = {}

    if(this.profiles.length !== 0){
      out.profiles = this.profiles
    }

    if(this.noProfilesFound.length !== 0){
      out.noProfilesFound = this.noProfilesFound;
    }

    if(utils.hasProperties(this.combinedProfile)){
      out.combinedProfile = this.combinedProfile
    }

    return out;
  }
673856
def output_generic(gandi, data, output_keys, justify=10):
    
    for key in output_keys:
        if key in data:
            output_line(gandi, key, data[key], justify)
605249
public void compact() {
        // Bare-bones iterator: no filter, don't bother with package strings
        for (NodeIterator<T> i = this.getNodeIterator(); i.hasNext();) {
            NodeIndex<T> n = i.next();
            if (n.node.exactKids != null)
                n.node.exactKids.trimToSize();
        }
    }
616475
public static void compact(Set<String> source, Adder adder, boolean shorterPairs) {
        compact(source,adder,shorterPairs,false);
    }
327823
def _organize_output(output, combine_map, file_key, combine_arg_keys):
    
    out_map = collections.defaultdict(list)
    extra_args = collections.defaultdict(list)
    final_args = collections.OrderedDict()
    extras = []
    for data in output:
        cur_file = data.get(file_key)
        if not cur_file:
            extras.append([data])
        else:
            cur_out = combine_map[cur_file]
            out_map[cur_out].append(cur_file)
            extra_args[cur_out].append([data[x] for x in combine_arg_keys])
            data[file_key] = cur_out
            if cur_out not in final_args:
                final_args[cur_out] = [data]
            else:
                extras.append([data])
    combine_args = [[v, k] + _get_extra_args(extra_args[k], combine_arg_keys)
                    for (k, v) in out_map.items()]
    return combine_args, list(final_args.values()) + extras
855616
def byteswap(data, word_size=4):
    
    return reduce(lambda x,y: x+''.join(reversed(y)), chunks(data, word_size), '')
836817
def _flatten_nested_input(v):
    
    v = copy.deepcopy(v)
    if isinstance(v["type"], dict) and v["type"]["type"] == "array":
        v["type"] = v["type"]["items"]
    else:
        assert isinstance(v["type"], (list, tuple)), v
        new_type = None
        want_null = False
        for x in v["type"]:
            if isinstance(x, dict) and x["type"] == "array":
                new_type = x["items"]
            elif isinstance(x, six.string_types) and x == "null":
                want_null = True
            else:
                new_type = x
        if want_null:
            if not isinstance(new_type, (list, tuple)):
                new_type = [new_type] if new_type is not None else []
            for toadd in ["null", "string"]:
                if toadd not in new_type:
                    new_type.append(toadd)
        assert new_type, v
        v["type"] = new_type
    return v
452661
def compress_txn_outputs(txn_outputs):
    '''
    
    '''
    result_dict = {}
    outputs = (output for output in txn_outputs if output.get('address'))
    for txn_output in outputs:
        if txn_output['address'] in result_dict:
            result_dict[txn_output['address']] += txn_output['value']
        else:
            result_dict[txn_output['address']] = txn_output['value']
    return result_dict
262493
private void compactGroup(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) {
    // Iterate through all segments being compacted and write entries to a single compact segment.
    for (int i = 0; i < segments.size(); i++) {
      compactSegment(segments.get(i), predicates.get(i), compactSegment);
    }
  }
873102
private void compact() {
        int from = 0;
        int to = 0;
        while (from < this.capacity) {
            Object key = this.list[from];
            long usage = age(this.ticks[from]);
            if (usage > 0) {
                this.ticks[to] = usage;
                this.list[to] = key;
                this.map.put(key, to);
                to += 1;
            } else {
                this.map.remove(key);
            }
            from += 1;
        }
        if (to < this.capacity) {
            this.length = to;
        } else {
            this.map.clear();
            this.length = 0;
        }
        this.power = 0;
    }
1143127
private List<Object> compact(List<Object> list) {
        if (list == null || list.isEmpty()) {
            return null;
        }

        List<Object> compacted = new ArrayList<Object>();
        StringBuilder stringAccumulator = new StringBuilder();
        for (Object object : list) {
            if (object instanceof FieldWriter) {
                // If a field writer is in the stream, then something may have specific writing logic tied to it.
                // pass it along same as field extractor
                if (stringAccumulator.length() > 0) {
                    compacted.add(new BytesArray(stringAccumulator.toString()));
                    stringAccumulator.setLength(0);
                }
                compacted.add(object);
            }
            else if (object instanceof FieldExtractor) {
                if (stringAccumulator.length() > 0) {
                    compacted.add(new BytesArray(stringAccumulator.toString()));
                    stringAccumulator.setLength(0);
                }
                compacted.add(new FieldWriter((FieldExtractor) object));
            }
            else {
                stringAccumulator.append(object.toString());
            }
        }

        if (stringAccumulator.length() > 0) {
            compacted.add(new BytesArray(stringAccumulator.toString()));
        }
        return compacted;
    }
798513
def compact
      r = self.clone
      r = r.collect{|c| c unless c.nil?}.compact
    end
170434
def translate_docs_compact(self, ds, field_mapping=None, slim=None, map_identifiers=None, invert_subject_object=False, **kwargs):
        
        amap = {}
        logging.info("Translating docs to compact form. Slim={}".format(slim))
        for d in ds:
            self.map_doc(d, field_mapping, invert_subject_object=invert_subject_object)

            subject = d[M.SUBJECT]
            subject_label = d[M.SUBJECT_LABEL]

            # TODO: use a more robust method; we need equivalence as separate field in solr
            if map_identifiers is not None:
                if M.SUBJECT_CLOSURE in d:
                    subject = self.map_id(subject, map_identifiers, d[M.SUBJECT_CLOSURE])
                else:
                    logging.debug("NO SUBJECT CLOSURE IN: "+str(d))

            rel = d.get(M.RELATION)
            skip = False

            # TODO
            if rel == 'not' or rel == 'NOT':
                skip = True

            # this is a list in GO
            if isinstance(rel,list):
                if 'not' in rel or 'NOT' in rel:
                    skip = True
                if len(rel) > 1:
                    logging.warn(">1 relation: {}".format(rel))
                rel = ";".join(rel)

            if skip:
                logging.debug("Skipping: {}".format(d))
                continue

            subject = self.make_canonical_identifier(subject)
            #if subject.startswith('MGI:MGI:'):
            #    subject = subject.replace('MGI:MGI:','MGI:')

            k = (subject,rel)
            if k not in amap:
                amap[k] = {'subject':subject,
                           'subject_label':subject_label,
                           'relation':rel,
                           'objects': []}
            if slim is not None and len(slim)>0:
                mapped_objects = [x for x in d[M.OBJECT_CLOSURE] if x in slim]
                logging.debug("Mapped objects: {}".format(mapped_objects))
                amap[k]['objects'] += mapped_objects
            else:
                amap[k]['objects'].append(d[M.OBJECT])
        for k in amap.keys():
            amap[k]['objects'] = list(set(amap[k]['objects']))

        return list(amap.values())
1150874
def flattencopy(lst):
    """"""
    # modified from
    # http://stackoverflow.com/questions/2158395/flatten-an-irregular-list-of-lists-in-python
    thelist = copy.deepcopy(lst)
    list_is_nested = True
    while list_is_nested:  # outer loop
        keepchecking = False
        atemp = []
        for element in thelist:  # inner loop
            if isinstance(element, list):
                atemp.extend(element)
                keepchecking = True
            else:
                atemp.append(element)
        list_is_nested = keepchecking  # determine if outer loop exits
        thelist = atemp[:]
    return thelist
949875
function compressOutput(output, bw) {
  bw.writeVarint(output.value);
  compressScript(output.script, bw);
  return bw;
}
4648
def formatted(self):
        """"""
        return ' '.join(self.compact[i:i + 4] for i in range(0, len(self.compact), 4))
138630
def compress(self, data_list):
        
        data = {}
        if data_list:
            return dict(
                (f.name, data_list[i]) for i, f in enumerate(self.form))
        return data