Logical implementation of the retrieve() command
175164
public function retrieve(Memento\Key $key, $expired = false)
    {
        if (!$this->__connect($key)) {
            $this->__disconnect();

            return NULL;
        }

        $meta = $this->getMeta($key);

        // handle arguments based on group or single key
        if ($this->groupKey) {
            $keys = $this->memcache->get($meta[Memento\Hash::FIELD_KEYS]);
            if (!is_array($keys) || !array_key_exists($key->getKey(), $keys)) {
                $this->__disconnect();

                return NULL;
            }
            $data = $this->memcache->get($keys[$key->getKey()]);
        } else {
            if (!array_key_exists(Memento\Hash::FIELD_DATA, $meta)) {
                $this->__disconnect();

                return NULL;
            }
            $data = $this->memcache->get($meta[Memento\Hash::FIELD_DATA]);
        }

        $this->__disconnect();

        return $data;
    }
369542
def _query_iterator(result, chunksize, columns, index_col=None,
                        coerce_float=True, parse_dates=None):
        """"""

        while True:
            data = result.fetchmany(chunksize)
            if not data:
                break
            else:
                yield _wrap_result(data, columns, index_col=index_col,
                                   coerce_float=coerce_float,
                                   parse_dates=parse_dates)
379153
def get(self, key, *, encoding=_NOTSET):
        """"""
        return self.execute(b'GET', key, encoding=encoding)
152539
def get_keys(self, key=None):
        
        if key:
            value = _lxc.Container.get_keys(self, key)
        else:
            value = _lxc.Container.get_keys(self)

        if value is False:
            return False
        elif value.endswith("\n"):
            return value.rstrip("\n").split("\n")
        else:
            return value
364677
function readcache($filename, &$err, $secs2cache, $rsClass)
		{
			$false = false;
			if (!$this->_connected) $this->connect($err);
			if (!$this->_memcache) return $false;

			$rs = $this->_memcache->get($filename);
			if (!$rs) {
				$err = 'Item with such key doesn\'t exists on the memcached server.';
				return $false;
			}

			// hack, should actually use _csv2rs
			$rs = explode("\n", $rs);
            unset($rs[0]);
            $rs = join("\n", $rs);
 			$rs = unserialize($rs);
			if (! is_object($rs)) {
				$err = 'Unable to unserialize $rs';
				return $false;
			}
			if ($rs->timeCreated == 0) return $rs; // apparently have been reports that timeCreated was set to 0 somewhere

			$tdiff = intval($rs->timeCreated+$secs2cache - time());
			if ($tdiff <= 2) {
				switch($tdiff) {
					case 2:
						if ((rand() & 15) == 0) {
							$err = "Timeout 2";
							return $false;
						}
						break;
					case 1:
						if ((rand() & 3) == 0) {
							$err = "Timeout 1";
							return $false;
						}
						break;
					default:
						$err = "Timeout 0";
						return $false;
				}
			}
			return $rs;
		}
765311
def _query(options, collection_name, num_to_skip,
           num_to_return, query, field_selector, opts, check_keys):
    """"""
    encoded = _dict_to_bson(query, check_keys, opts)
    if field_selector:
        efs = _dict_to_bson(field_selector, False, opts)
    else:
        efs = b""
    max_bson_size = max(len(encoded), len(efs))
    return b"".join([
        _pack_int(options),
        _make_c_string(collection_name),
        _pack_int(num_to_skip),
        _pack_int(num_to_return),
        encoded,
        efs]), max_bson_size
702656
def hgetall(self, key, *, encoding=_NOTSET):
        """"""
        fut = self.execute(b'HGETALL', key, encoding=encoding)
        return wait_make_dict(fut)
513585
def _get_data(filenames):
    
    if filenames:
        data = ""
        for filename in filenames:
            with open(filename, "rb") as f:
                data += f.read()
    else:
        data = sys.stdin.read()

    return data
397313
def hmget(self, name, keys, *args):
        
        member_encode = self.memberparse.encode
        keys = [k for k in self._parse_values(keys, args)]
        with self.pipe as pipe:
            f = Future()
            res = pipe.hmget(self.redis_key(name),
                             [member_encode(k) for k in keys])

            def cb():
                f.set([self._value_decode(keys[i], v)
                       for i, v in enumerate(res.result)])

            pipe.on_execute(cb)
            return f
1015469
def perform_get_or_create(self, request, *args, **kwargs):
        """"""
        serializer = self.get_serializer(data=request.data)
        serializer.is_valid(raise_exception=True)
        process = serializer.validated_data.get('process')
        process_input = request.data.get('input', {})

        fill_with_defaults(process_input, process.input_schema)

        checksum = get_data_checksum(process_input, process.slug, process.version)
        data_qs = Data.objects.filter(
            checksum=checksum,
            process__persistence__in=[Process.PERSISTENCE_CACHED, Process.PERSISTENCE_TEMP],
        )
        data_qs = get_objects_for_user(request.user, 'view_data', data_qs)
        if data_qs.exists():
            data = data_qs.order_by('created').last()
            serializer = self.get_serializer(data)
            return Response(serializer.data)
492748
async def fetch(self, n, *, timeout=None):
        
        """
        self._check_ready()
        if n <= 0:
            raise exceptions.InterfaceError('n must be greater than zero')
        if self._exhausted:
            return []
        recs = await self._exec(n, timeout)
        if len(recs) < n:
            self._exhausted = True
        return recs
1285726
def _dig_get(obj, default, *key):
    
    key = _splice_index(*key)

    if len(key) == 1:
        if isinstance(key[0], str):
            return obj.get(key[0], default)
        else:
            try:
                return obj[key[0]]
            except IndexError:
                return default

    return _dig_get(obj[key[0]], default, *key[1:])
786315
function scan(str, re) {
  var match = null;
  var ret = [];

  while (match = re.exec(str)) {
    ret.push(match);
  }

  return ret;
}
234197
def hgetall(key, host=None, port=None, db=None, password=None):
    '''
    
    '''
    server = _connect(host, port, db, password)
    return server.hgetall(key)
233574
def fetch(self, command):
        
        logging.debug('SENT: %s: %s' % (self.host, command))
        self.write('%s\n' % command)
        while 1:
            buffer = self.read_until('\n').strip()
            if len(buffer):
                break
        status, length = map(int, buffer.split())
        content = ''
        assert status == 200, 'Bad response code: {status} {text} ({command})'.format(status=status, text=self.read_until('\n').strip(), command=command)
        while len(content) < length:
            content += self.read_until('\n')
        logging.debug('RECV: %s: %dB %s' % (status,length,content[:30]))
        self.read_eager()
        return (status, length), content
605100
def _get_by(key, val, l):
    
    return [x for x in l if _check_value_recursively(key, val, x)]
1315039
def __retrieve_data(self):
        """"""

        if self.__eof is True:
            return b''

        logging.debug("Reading another block.")        
        block = self.read(self.__block_size)
        if block == b'':
            self.__log.debug("We've encountered the EOF.")
            self.__eof = True

        return block