Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(2)  |  Derive(0)  |  Import(3)

        def oid_repr(oid):
    if isinstance(oid, _bytes) and len(oid) == 8:
        # Convert to hex and strip leading zeroes.
        as_hex = hexlify(oid).lstrip(b'0')
        # Ensure two characters per input byte.
        chunks = [b'0x']
        if len(as_hex) & 1:
            chunks.append(b'0')
        elif as_hex == b'':
            as_hex = b'00'
        chunks.append(as_hex)
        return b''.join(chunks)
    else:
        return repr(oid)
        


src/b/t/BTrees-4.0.8/BTrees/check.py   BTrees(Download)
 
from BTrees.utils import positive_id
from BTrees.utils import oid_repr
 
TYPE_UNKNOWN, TYPE_BTREE, TYPE_BUCKET = range(3)
def type_and_adr(obj):
    if hasattr(obj, '_p_oid'):
        oid = oid_repr(obj._p_oid)
    else:
        oid = 'None'

src/b/t/BTrees-4.0.8/BTrees/tests/test_utils.py   BTrees(Download)
    def _callFUT(self, oid):
        from BTrees.utils import oid_repr
        return oid_repr(oid)
 
    def test_w_non_strings(self):

src/b/t/BTrees-4.0.8/BTrees/tests/test_check.py   BTrees(Download)
    def test_type_and_adr_w_oid(self):
        from BTrees.utils import oid_repr
        class WithOid(object):
            _p_oid = b'DEADBEEF'
        t_and_a = self._callFUT(WithOid())