Internal: takes in an array of hashes of documents and calculates the
 documentId

 Returns a hash of documents that are to be uploaded
769379
def get_documents(ios)
      ios.each_with_index.map do |io, index|
        {
          documentId: "#{index + 1}",
          name: io.original_filename
        }
      end
    end
635413
private void calculateCalendarHashChainOutput() throws KSIException {
        ChainResult lastRes = null;
        for (AggregationHashChain chain : aggregationChains) {
            if (lastRes == null) {
                lastRes = chain.calculateOutputHash(0L);
            } else {
                lastRes = chain.calculateOutputHash(lastRes.getLevel());
            }
            LOGGER.debug("Output hash of chain: {} is {}", chain, lastRes.getOutputHash());
        }
    }
1104133
function gatherHeaders(item) {
    var ret, i, l;
    if (isHashArray(item)) {
        //lets assume a multidimesional array with item 0 bing the title
        i = -1;
        l = item.length;
        ret = [];
        while (++i < l) {
            ret[i] = item[i][0];
        }
    } else if (isArray(item)) {
        ret = item;
    } else {
        ret = keys(item);
    }
    return ret;
}
1093109
function createFilenameHash(uploadDir, files) {
    let hashPath = path.resolve(uploadDir, 'name.json');
    let hashContent;
    let result = [];

    if (hashFileExist || fs.existsSync(hashPath)) {
      try {
        let content = fs.readFileSync(hashPath, 'utf8');
        hashContent = JSON.parse(content);
      } catch (err) {
        debug('get hash file failed:' + err);
      }
    } else {
      hashContent = {};
    }

    for (let item in files) {
      let fileName = files[item].name;
      let hashName = getUniqueId(0, hashContent, fileName);

      let fileItem = getFileItem(files[item], uploadDir)
      hashContent[hashName] = fileItem;
      result.push(util._extend(fileItem, {
        filename: hashName
      }))
    }

    try {
      let file = JSON.stringify(hashContent, null, 2);
      fs.writeFileSync(hashPath, file);
    } catch (err) {
      debug('write hash file failed:' + err);
    }

    hashFileExist = true;

    return result;
  }
1264069
def bulk_put(docs, opts={})

      docs.each { |doc| check_attachments(doc) }

      res = @http.post(adjust('_bulk_docs'), { 'docs' => docs })

      opts[:raw] ?
        res :
        res.collect { |row| { '_id' => row['id'], '_rev' => row['rev'] } }
    end
631657
function getShash() {
  const type = NodeType.ShashType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const end = token.shashEnd;
  let content = [];

  // Skip `#`.
  pos++;

  while (pos < end) {
    if (checkIdentOrInterpolation(pos)) {
      content = content.concat(getIdentOrInterpolation());
    } else if (checkPartialIdent(pos)) {
      content.push(getIdent());
    } else break;
  }

  return newNode(type, content, line, column);
}
102006
def to_hash
      {
        :repository   => repository.name,
        :model        => model.name,
        :fields       => fields,
        :links        => links,
        :conditions   => conditions,
        :offset       => offset,
        :limit        => limit,
        :order        => order,
        :unique       => unique?,
        :add_reversed => add_reversed?,
        :reload       => reload?,
      }
    end
1160064
def from_array(array):
        
        if array is None or not array:
            return None
        # end if
        assert_type_or_raise(array, dict, parameter_name="array")


        data = {}
        data['type'] = u(array.get('type'))
        data['hash'] = u(array.get('hash'))
        data['data'] = u(array.get('data')) if array.get('data') is not None else None
        data['phone_number'] = u(array.get('phone_number')) if array.get('phone_number') is not None else None
        data['email'] = u(array.get('email')) if array.get('email') is not None else None
        data['files'] = PassportFile.from_array_list(array.get('files'), list_level=1) if array.get('files') is not None else None
        data['front_side'] = PassportFile.from_array(array.get('front_side')) if array.get('front_side') is not None else None
        data['reverse_side'] = PassportFile.from_array(array.get('reverse_side')) if array.get('reverse_side') is not None else None
        data['selfie'] = PassportFile.from_array(array.get('selfie')) if array.get('selfie') is not None else None
        data['translation'] = PassportFile.from_array_list(array.get('translation'), list_level=1) if array.get('translation') is not None else None
        data['_raw'] = array
        return EncryptedPassportElement(**data)
1257072
def ensureHashIndex(self, fields, unique = False, sparse = True, deduplicate = False) :
        """"""
        data = {
            "type" : "hash",
            "fields" : fields,
            "unique" : unique,
            "sparse" : sparse,
            "deduplicate": deduplicate
        }
        ind = Index(self, creationData = data)
        self.indexes["hash"][ind.infos["id"]] = ind
        return ind
1170958
def to_hash
      characteristics.inject({}) do |memo, (k, v)|
        memo[k] = v.value
        memo
      end
    end
1066641
function populatePropertyFor (documents, next) {
    if (this._mongooseOptions.lean) {
      asArray(documents).forEach(function(doc) {
        paths.forEach(function(path) {
          try {
            const splitted = path.path.split('.');
            const key      = splitted.shift();
            const insert   = { values: path.enumValues };
            const value    = doc[key];

            insert.value = determineValue(splitted, value);
            doc[key]     = nest(splitted, insert);
          } catch (error) { return next(error); }
        });
      });
    }

    next();
  }
502834
function incrementDocument(params) {
  var doc = (collections[params.collection] || {})[params.id]

  if (doc !== undefined) {
    doc[params.key] = (doc[params.key] || 0) + (params.by || 1)

    eventEmitter.emit('documentIncremented', params.collection, doc)
  }
}
260603
def ids(cls, filter=None, **kwargs):
        """"""
        from mongoframes.queries import Condition, Group, to_refs

        # Find the documents
        if isinstance(filter, (Condition, Group)):
            filter = filter.to_dict()

        documents = cls.get_collection().find(
            to_refs(filter),
            projection={'_id': True},
            **kwargs
            )

        return [d['_id'] for d in list(documents)]
1326454
def to_array(self):
        
        array = super(Document, self).to_array()
        array['file_id'] = u(self.file_id)  # py2: type unicode, py3: type str

        if self.thumb is not None:
            array['thumb'] = self.thumb.to_array()  # type PhotoSize

        if self.file_name is not None:
            array['file_name'] = u(self.file_name)  # py2: type unicode, py3: type str

        if self.mime_type is not None:
            array['mime_type'] = u(self.mime_type)  # py2: type unicode, py3: type str

        if self.file_size is not None:
            array['file_size'] = int(self.file_size)  # type int
        return array
246780
def get!(id, params = {})
      slug = escape_docid(id)
      url = CouchRest.paramify_url("#{path}/#{slug}", params)
      result = connection.get(url)
      return result unless result.is_a?(Hash)
      doc = if /^_design/ =~ result["_id"]
        Design.new(result)
      else
        Document.new(result)
      end
      doc.database = self
      doc
    end
1055465
def get_cached_document_ids(ids, doc_type):
    """"""
    for batch in _split_list(ids):
        for id in _get_cached_document_ids(batch, doc_type):
            yield id
470387
def parse_hash
      query.map do |key, value|
        new_value = value.is_a?(Array) ? ["$in", value] : value
        [key.to_s, new_value]
      end
    end