当前位置: 首页>>代码示例>>Python>>正文


Python cython.compiled方法代码示例

本文整理汇总了Python中cython.compiled方法的典型用法代码示例。如果您正苦于以下问题:Python cython.compiled方法的具体用法?Python cython.compiled怎么用?Python cython.compiled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cython的用法示例。


在下文中一共展示了cython.compiled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __get__

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def __get__(self, obj, klass):
        if obj is None:
            return self
        elif obj.none_bitmap & self.mask:
            return None
        if cython.compiled:
            pybuf = cython.address(obj.pybuf)
            buflen = pybuf.len
            assert (obj.offs + self.offs + cython.sizeof(cython.longlong)) <= buflen
            offs = obj.offs + cython.cast(cython.p_longlong,
                cython.cast(cython.p_uchar, pybuf.buf) + obj.offs + self.offs)[0]
            if obj.idmap is not None:
                poffs = offs # python version of offs
                rv = obj.idmap.get(poffs, poffs) # idmap cannot possibly hold "poffs" for that offset
                if rv is not poffs:
                    return rv
            assert offs + cython.sizeof(cython.ushort) <= buflen
        else:
            poffs = offs = obj.offs + struct.unpack_from('q', obj.buf, obj.offs + self.offs)[0]
        rv = self.typ.unpack_from(obj.buf, offs)
        if obj.idmap is not None:
            obj.idmap[poffs] = rv
        return rv 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:25,代码来源:mapped_struct.py

示例2: unpack_from

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def unpack_from(cls, buf, offs, idmap = None):
        if cython.compiled:
            buf = _likebuffer(buf)
            PyObject_GetBuffer(buf, cython.address(pybuf), PyBUF_SIMPLE)  # lint:ok
            pbuf = cython.cast(cython.p_uchar, pybuf.buf)  # lint:ok
            if offs >= pybuf.len:
                PyBuffer_Release(cython.address(pybuf))  # lint
                raise IndexError("Offset out of range")
        else:
            pbuf = buf
        try:
            if pbuf[offs] == 'm':
                # inline bitmap
                if cython.compiled and offs+7 >= pybuf.len:
                    raise IndexError("Object spans beyond buffer end")
                rv = []
                for i in xrange(7):
                    b = ord(pbuf[offs+1+i])
                    if b:
                        for j in xrange(8):
                            if b & (1<<j):
                                rv.append(i*8+j)
                return frozenset(rv)
            else:
                # unpack a list, build a set from it
                return frozenset(mapped_list.unpack_from(buf, offs, idmap))
        finally:
            if cython.compiled:
                if type(buf) is buffer:
                    PyBuffer_Release(cython.address(pybuf))  # lint:ok 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:32,代码来源:mapped_struct.py

示例3: _unpack_bytes_from_pybuffer

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def _unpack_bytes_from_pybuffer(buf, offs, idmap):
    if idmap is not None and offs in idmap:
        return idmap[offs]

    if cython.compiled:
        try:
            buf = _likebuffer(buf)
            PyObject_GetBuffer(buf, cython.address(pybuf), PyBUF_SIMPLE)  # lint:ok
            rv = _unpack_bytes_from_cbuffer(cython.cast(cython.p_char, pybuf.buf), offs, pybuf.len, None)  # lint:ok
        finally:
            PyBuffer_Release(cython.address(pybuf))  # lint:ok
    else:
        hpacker = struct.Struct('=H')
        objlen = hpacker.unpack_from(buf, offs)[0]
        offs = int(offs)
        dataoffs = offs + hpacker.size
        compressed = (objlen & 0x8000) != 0
        if (objlen & 0x7FFF) == 0x7FFF:
            qpacker = struct.Struct('=HQ')
            objlen = qpacker.unpack_from(buf, offs)[1]
            dataoffs = offs + qpacker.size
        else:
            objlen = objlen & 0x7FFF
        rv = buffer(buf, dataoffs, objlen)
        if compressed:
            rv = lz4_decompress(rv)
        else:
            rv = bytes(rv)
    
    if idmap is not None:
        idmap[offs] = rv
    return rv 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:34,代码来源:mapped_struct.py

示例4: __init__

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def __init__(self, buf, offs, none_bitmap, idmap = None):
        if cython.compiled:
            self.pybuf.buf = cython.NULL
        self._init(buf, offs, none_bitmap, idmap) 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:6,代码来源:mapped_struct.py

示例5: _init

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def _init(self, buf, offs, none_bitmap, idmap):
        if cython.compiled:
            if self.pybuf.buf == cython.NULL:
                PyBuffer_Release(cython.address(self.pybuf))  # lint:ok

        self.buf = buf
        self.idmap = idmap
        self.offs = offs
        self.none_bitmap = none_bitmap

        if cython.compiled:
            PyObject_GetBuffer(buf, cython.address(self.pybuf), PyBUF_SIMPLE)  # lint:ok 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:14,代码来源:mapped_struct.py

示例6: _print_buf

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def _print_buf(self, start=None, end='auto', **kwds):
        if start is None:
            start = self._data_offset
        if end == 'auto':
            end = self._get_end()
        elif end is None:
            end = len(self._seg.buf)
        p = BufferPrinter(self._seg.buf)
        p.printbuf(start=start, end=end, **kwds)


    # ------------------------------------------------------
    # Comparisons methods
    # ------------------------------------------------------
    #
    # this class can be used in two ways:
    #
    #   1. Pure Python mode (either on CPython or PyPy)
    #   2. compiled by Cython
    #
    # Cython does not support __eq__, __lt__ etc: instead, to enable
    # comparisons you need to define __richcmp__ (which Cython maps to the
    # CPython's tp_richcmp slot).  On the other hand, when in Pure Python
    # mode, we *need* __eq__, __lt__ etc:
    #
    #   1. we write the actual logic inside _cmp_*
    #
    #   2. we implement a __richcmp__ which will be used by Cython but ignored
    #      by Pure Python
    #
    #   3. we add __eq__, __lt__, etc. OUTSIDE the class definition. The
    #      assignments will fail when Struct is compiled by Cython, because
    #      you cannot modify the class dict of an extension type: this means
    #      that we will have the special methods only when in Pure Python
    #      mode, as wished 
开发者ID:antocuni,项目名称:capnpy,代码行数:37,代码来源:blob.py

示例7: __richcmp__

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def __richcmp__(self, other, op):
        return self._richcmp(other, op)

# add the special methods only when Struct has NOT been compiled by
# Cython. See the comment above for more explanation 
开发者ID:antocuni,项目名称:capnpy,代码行数:7,代码来源:blob.py

示例8: __repr__

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def __repr__(self):
        return self.__str__()

    # This awkward implementation is necessary so that binders can be compared for equality across
    # Cythonized and non-Cythonized Python 2 and 3. In pure-Python compiled classes, Cython only
    # supports overriding __richcmp__, not __eq__ (https://github.com/cython/cython/issues/690),
    # but if __eq__ is defined it throws an error. 
开发者ID:quora,项目名称:qcore,代码行数:9,代码来源:decorators.py

示例9: pack_into

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def pack_into(cls, obj, buf, offs, idmap = None, implicit_offs = 0):
        if idmap is not None:
            objid = id(obj)
            idmap[objid] = offs + implicit_offs
        objlen = len(obj)

        if objlen > MIN_COMPRESS_THRESHOLD:
            objcomp = lz4_compress(obj)
            objcomplen = len(objcomp)
            if objcomplen < (objlen - objlen/3):
                # Must get substantial compression to pay the price
                obj = objcomp
                objlen = objcomplen
                compressed = 0x8000
            else:
                compressed = 0
            del objcomp
        else:
            compressed = 0

        if (offs + 16 + len(obj)) > len(buf):
            raise struct.error('buffer too small')
        if cython.compiled:
            try:
                buf = _likebuffer(buf)
                PyObject_GetBuffer(buf, cython.address(pybuf), PyBUF_WRITABLE)  # lint:ok
                pbuf = cython.cast(cython.p_char, pybuf.buf) + offs  # lint:ok
                
                if objlen < 0x7FFF:
                    cython.cast('_varstr_header *', pbuf).shortlen = objlen | compressed
                    offs += cython.sizeof(cython.ushort)
                    pbuf += cython.sizeof(cython.ushort)
                else:
                    cython.cast('_varstr_header *', pbuf).shortlen = 0x7FFF | compressed
                    cython.cast('_varstr_header *', pbuf).biglen = objlen
                    offs += cython.sizeof('_varstr_header')
                    pbuf += cython.sizeof('_varstr_header')
                memcpy(pbuf, cython.cast(cython.p_char, obj), objlen)  # lint:ok
            finally:
                PyBuffer_Release(cython.address(pybuf))  # lint:ok
        else:
            if objlen < 0x7FFF:
                hpacker = struct.Struct('=H')
                hpacker.pack_into(buf, offs, objlen | compressed)
                offs += hpacker.size
            else:
                qpacker = struct.Struct('=HQ')
                qpacker.pack_into(buf, offs, 0x7FFF | compressed, objlen)
                offs += qpacker.size
            buf[offs:offs+objlen] = obj
        offs += objlen
        return offs 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:54,代码来源:mapped_struct.py

示例10: iteritems

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def iteritems(self):
        buf = self._buf
        dtype = self.dtype
        index = self.index
        if cython.compiled:
            #lint:disable
            buf = self._likebuf
            PyObject_GetBuffer(buf, cython.address(pybuf), PyBUF_SIMPLE)
            try:
                if dtype is npuint64:
                    PyObject_GetBuffer(index, cython.address(indexbuf), PyBUF_STRIDED_RO)
                    try:
                        if ( indexbuf.strides == cython.NULL 
                                or indexbuf.ndim < 2
                                or indexbuf.len < self.index_elements * indexbuf.strides[0] ):
                            raise ValueError("Invalid buffer state")
                        stride0 = indexbuf.strides[0]
                        stride1 = indexbuf.strides[1]
                        pindex = cython.cast(cython.p_char, indexbuf.buf)
                        for i in xrange(self.index_elements):
                            yield (
                                cython.cast(cython.p_ulonglong, pindex)[0],
                                cython.cast(cython.p_ulonglong, pindex + stride1)[0]
                            )
                            pindex += stride0
                    finally:
                        PyBuffer_Release(cython.address(indexbuf))
                elif dtype is npuint32:
                    PyObject_GetBuffer(index, cython.address(indexbuf), PyBUF_STRIDED_RO)
                    try:
                        if ( indexbuf.strides == cython.NULL 
                                or indexbuf.ndim < 2
                                or indexbuf.len < self.index_elements * indexbuf.strides[0] ):
                            raise ValueError("Invalid buffer state")
                        stride0 = indexbuf.strides[0]
                        stride1 = indexbuf.strides[1]
                        pindex = cython.cast(cython.p_char, indexbuf.buf)
                        for i in xrange(self.index_elements):
                            yield (
                                cython.cast(cython.p_uint, pindex)[0],
                                cython.cast(cython.p_uint, pindex + stride1)[0]
                            )
                            pindex += stride0
                    finally:
                        PyBuffer_Release(cython.address(indexbuf))
                else:
                    for i in xrange(self.index_elements):
                        yield (
                            index[i,0],
                            index[i,1]
                        )
            finally:
                PyBuffer_Release(cython.address(pybuf))
            #lint:enable
        else:
            for i in xrange(self.index_elements):
                yield (index[i,0], index[i,1]) 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:59,代码来源:mapped_struct.py

示例11: _search_hkey

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def _search_hkey(self, hkey):
        hi = self.index_elements
        lo = 0
        hikey = self._index_max
        lokey = self._index_min
        if hkey < lokey:
            return lo
        elif hkey > hikey:
            return hi
        if cython.compiled:
            dtype = self._dtype
            if dtype is npuint64 or dtype is npuint32:
                #lint:disable
                PyObject_GetBuffer(self.index, cython.address(indexbuf), PyBUF_STRIDED_RO)
                try:
                    if ( indexbuf.strides == cython.NULL 
                            or indexbuf.len < hi * indexbuf.strides[0] ):
                        raise ValueError("Invalid buffer state")
                    pindex = cython.cast(cython.p_char, indexbuf.buf)
                    stride0 = indexbuf.strides[0]

                    if dtype is npuint64:
                        # TO-DO: better hints?
                        hint = (lo+hi)//2
                        return _c_search_hkey_ui64(hkey, pindex, stride0, hi, hint)
                    elif dtype is npuint32:
                        # TO-DO: better hints?
                        hint = (lo+hi)//2
                        return _c_search_hkey_ui32(hkey, pindex, stride0, hi, hint)
                    else:
                        raise AssertionError("Internal error")
                finally:
                    PyBuffer_Release(cython.address(indexbuf))
                #lint:enable
            else:
                raise AssertionError("Internal error")
        else:
            dtype = self.dtype
            struct_dt = numpy.dtype([
                ('key', dtype),
                ('value', dtype),
            ])
            return self.index.view(struct_dt).reshape(self.index.shape[0]).searchsorted(
                numpy.array([(hkey,0)],dtype=struct_dt))[0] 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:46,代码来源:mapped_struct.py

示例12: get

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def get(self, key, default = None):
        if not isinstance(key, (int, long)):
            return default
        if key < 0 or key > self.dtypemax:
            return default
        hkey = key
        startpos = self._search_hkey(hkey)
        nitems = self.index_elements
        if 0 <= startpos < nitems:
            buf = self._buf
            dtype = self._dtype
            if cython.compiled:
                #lint:disable
                buf = self._likebuf
                PyObject_GetBuffer(buf, cython.address(pybuf), PyBUF_SIMPLE)
                try:
                    if dtype is npuint64:
                        PyObject_GetBuffer(self.index, cython.address(indexbuf), PyBUF_STRIDED_RO)
                        try:
                            if ( indexbuf.strides == cython.NULL 
                                    or indexbuf.ndim < 2
                                    or indexbuf.len < nitems * indexbuf.strides[0] ):
                                raise ValueError("Invalid buffer state")
                            stride0 = indexbuf.strides[0]
                            stride1 = indexbuf.strides[1]
                            pindex = cython.cast(cython.p_char, indexbuf.buf) + startpos * stride0
                            pindexend = cython.cast(cython.p_char, indexbuf.buf) + indexbuf.len - stride0 + 1
                            if pindex < pindexend and cython.cast(cython.p_ulonglong, pindex)[0] == hkey:
                                return cython.cast(cython.p_ulonglong, pindex + stride1)[0]
                        finally:
                            PyBuffer_Release(cython.address(indexbuf))
                    elif dtype is npuint32:
                        PyObject_GetBuffer(self.index, cython.address(indexbuf), PyBUF_STRIDED_RO)
                        try:
                            if ( indexbuf.strides == cython.NULL 
                                    or indexbuf.ndim < 2
                                    or indexbuf.len < nitems * indexbuf.strides[0] ):
                                raise ValueError("Invalid buffer state")
                            stride0 = indexbuf.strides[0]
                            stride1 = indexbuf.strides[1]
                            pindex = cython.cast(cython.p_char, indexbuf.buf) + startpos * stride0
                            pindexend = cython.cast(cython.p_char, indexbuf.buf) + indexbuf.len - stride0 + 1
                            if pindex < pindexend and cython.cast(cython.p_uint, pindex)[0] == hkey:
                                return cython.cast(cython.p_uint, pindex + stride1)[0]
                        finally:
                            PyBuffer_Release(cython.address(indexbuf))
                    else:
                        index = self.index
                        if startpos < nitems and index[startpos,0] == hkey:
                            return index[startpos,1]
                finally:
                    PyBuffer_Release(cython.address(pybuf))
                #lint:enable
            else:
                index = self.index
                if startpos < nitems and index[startpos,0] == hkey:
                    return index[startpos,1]
        return default 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:60,代码来源:mapped_struct.py

示例13: iterkeys

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def iterkeys(self, make_sequential = True):
        buf = self._buf
        dtype = self.dtype
        if make_sequential:
            # Big collections don't fit in RAM, so it helps if they're accessed sequentially
            # We'll just have to copy and sort the index, no big deal though
            index = numpy.sort(self.index[:,1])
            stride = 1
            offs = 0
        else:
            index = self.index
            stride = 3
            offs = 1
        if cython.compiled:
            #lint:disable
            buf = self._likebuf
            PyObject_GetBuffer(buf, cython.address(pybuf), PyBUF_SIMPLE)
            try:
                if dtype is npuint64:
                    PyObject_GetBuffer(index, cython.address(indexbuf), PyBUF_SIMPLE)
                    try:
                        if indexbuf.len < (self.index_elements * stride * cython.sizeof(cython.ulonglong)):
                            raise ValueError("Invalid buffer state")
                        for i in xrange(self.index_elements):
                            yield _unpack_bytes_from_cbuffer(
                                cython.cast(cython.p_char, pybuf.buf),
                                cython.cast(cython.p_ulonglong, indexbuf.buf)[i*stride+offs],
                                pybuf.len, None)
                    finally:
                        PyBuffer_Release(cython.address(indexbuf))
                elif dtype is npuint32:
                    PyObject_GetBuffer(index, cython.address(indexbuf), PyBUF_SIMPLE)
                    try:
                        if indexbuf.len < (self.index_elements * stride * cython.sizeof(cython.uint)):
                            raise ValueError("Invalid buffer state")
                        for i in xrange(self.index_elements):
                            yield _unpack_bytes_from_cbuffer(
                                cython.cast(cython.p_char, pybuf.buf),
                                cython.cast(cython.p_uint, indexbuf.buf)[i*stride+offs],
                                pybuf.len, None)
                    finally:
                        PyBuffer_Release(cython.address(indexbuf))
                else:
                    for i in xrange(self.index_elements):
                        yield _unpack_bytes_from_cbuffer(
                            cython.cast(cython.p_char, pybuf.buf),
                            index[i],
                            pybuf.len, None)
            finally:
                PyBuffer_Release(cython.address(pybuf))
            #lint:enable
        else:
            for i in xrange(self.index_elements):
                yield _unpack_bytes_from_pybuffer(buf, index[i], None) 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:56,代码来源:mapped_struct.py

示例14: __contains__

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def __contains__(self, key):
        if not isinstance(key, (int, long)):
            return False
        if key < 0 or key > self.dtypemax:
            return False
        hkey = key
        startpos = self._search_hkey(hkey)
        nitems = self.index_elements
        if 0 <= startpos < nitems:
            buf = self._buf
            dtype = self._dtype
            if cython.compiled:
                #lint:disable
                buf = self._likebuf
                PyObject_GetBuffer(buf, cython.address(pybuf), PyBUF_SIMPLE)
                try:
                    if dtype is npuint64:
                        PyObject_GetBuffer(self.index, cython.address(indexbuf), PyBUF_STRIDED_RO)
                        try:
                            if ( indexbuf.strides == cython.NULL 
                                    or indexbuf.ndim < 2
                                    or indexbuf.len < nitems * indexbuf.strides[0] ):
                                raise ValueError("Invalid buffer state")
                            stride0 = indexbuf.strides[0]
                            pindex = cython.cast(cython.p_char, indexbuf.buf) + startpos * stride0
                            pindexend = cython.cast(cython.p_char, indexbuf.buf) + indexbuf.len - stride0 + 1
                            if pindex < pindexend and cython.cast(cython.p_ulonglong, pindex)[0] == hkey:
                                return True
                        finally:
                            PyBuffer_Release(cython.address(indexbuf))
                    elif dtype is npuint32:
                        PyObject_GetBuffer(self.index, cython.address(indexbuf), PyBUF_STRIDED_RO)
                        try:
                            if ( indexbuf.strides == cython.NULL 
                                    or indexbuf.ndim < 2
                                    or indexbuf.len < nitems * indexbuf.strides[0] ):
                                raise ValueError("Invalid buffer state")
                            stride0 = indexbuf.strides[0]
                            pindex = cython.cast(cython.p_char, indexbuf.buf) + startpos * stride0
                            pindexend = cython.cast(cython.p_char, indexbuf.buf) + indexbuf.len - stride0 + 1
                            if pindex < pindexend and cython.cast(cython.p_uint, pindex)[0] == hkey:
                                return True
                        finally:
                            PyBuffer_Release(cython.address(indexbuf))
                    else:
                        index = self.index
                        if startpos < nitems and index[startpos,0] == hkey:
                            return True
                finally:
                    PyBuffer_Release(cython.address(pybuf))
                #lint:enable
            else:
                index = self.index
                if startpos < nitems and index[startpos,0] == hkey:
                    return True
        return False 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:58,代码来源:mapped_struct.py

示例15: get_iter

# 需要导入模块: import cython [as 别名]
# 或者: from cython import compiled [as 别名]
def get_iter(self, key):
        if not isinstance(key, (int, long)):
            return
        if key < 0 or key > self.dtypemax:
            return
        hkey = key
        startpos = self._search_hkey(hkey)
        nitems = self.index_elements
        if 0 <= startpos < nitems:
            buf = self._buf
            dtype = self._dtype
            if cython.compiled:
                #lint:disable
                buf = self._likebuf
                PyObject_GetBuffer(buf, cython.address(pybuf), PyBUF_SIMPLE)
                try:
                    if dtype is npuint64:
                        PyObject_GetBuffer(self.index, cython.address(indexbuf), PyBUF_STRIDED_RO)
                        try:
                            if ( indexbuf.strides == cython.NULL 
                                    or indexbuf.ndim < 2
                                    or indexbuf.len < nitems * indexbuf.strides[0] ):
                                raise ValueError("Invalid buffer state")
                            stride0 = indexbuf.strides[0]
                            stride1 = indexbuf.strides[1]
                            pindex = cython.cast(cython.p_char, indexbuf.buf) + startpos * stride0
                            pindexend = cython.cast(cython.p_char, indexbuf.buf) + indexbuf.len - stride0 + 1
                            while pindex < pindexend and cython.cast(cython.p_ulonglong, pindex)[0] == hkey:
                                yield cython.cast(cython.p_ulonglong, pindex + stride1)[0]
                                pindex += stride0
                        finally:
                            PyBuffer_Release(cython.address(indexbuf))
                    elif dtype is npuint32:
                        PyObject_GetBuffer(self.index, cython.address(indexbuf), PyBUF_STRIDED_RO)
                        try:
                            if ( indexbuf.strides == cython.NULL 
                                    or indexbuf.ndim < 2
                                    or indexbuf.len < nitems * indexbuf.strides[0] ):
                                raise ValueError("Invalid buffer state")
                            stride0 = indexbuf.strides[0]
                            stride1 = indexbuf.strides[1]
                            pindex = cython.cast(cython.p_char, indexbuf.buf) + startpos * stride0
                            pindexend = cython.cast(cython.p_char, indexbuf.buf) + indexbuf.len - stride0 + 1
                            while pindex < pindexend and cython.cast(cython.p_uint, pindex)[0] == hkey:
                                yield cython.cast(cython.p_uint, pindex + stride1)[0]
                                pindex += stride0
                        finally:
                            PyBuffer_Release(cython.address(indexbuf))
                    else:
                        index = self.index
                        while startpos < nitems and index[startpos,0] == hkey:
                            yield index[startpos,1]
                            startpos += 1
                finally:
                    PyBuffer_Release(cython.address(pybuf))
                #lint:enable
            else:
                index = self.index
                while startpos < nitems and index[startpos,0] == hkey:
                    yield index[startpos,1]
                    startpos += 1 
开发者ID:jampp,项目名称:sharedbuffers,代码行数:63,代码来源:mapped_struct.py


注:本文中的cython.compiled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。