~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_btree_serializer_pyx.pyx

  • Committer: John Arbash Meinel
  • Date: 2010-08-23 17:51:17 UTC
  • mto: This revision was merged to the branch mainline in revision 5390.
  • Revision ID: john@arbash-meinel.com-20100823175117-hr3b7p8gkw4ap8bb
Change the _test names to _get and _py so that it doesn't provoke bad smells :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
379
379
    return 1
380
380
 
381
381
 
382
 
def _test_unhexlify(as_hex):
 
382
def _py_unhexlify(as_hex):
383
383
    """For the test infrastructure, just thunks to _unhexlify_sha1"""
384
384
    if len(as_hex) != 40 or not PyString_CheckExact(as_hex):
385
385
        raise ValueError('not a 40-byte hex digest')
402
402
        j += 1
403
403
 
404
404
 
405
 
def _test_hexlify(as_bin):
 
405
def _py_hexlify(as_bin):
406
406
    """For test infrastructure, thunk to _hexlify_sha1"""
407
407
    if len(as_bin) != 20 or not PyString_CheckExact(as_bin):
408
408
        raise ValueError('not a 20-byte binary digest')
439
439
    return 1
440
440
 
441
441
 
442
 
def _test_key_to_sha1(key):
 
442
def _py_key_to_sha1(key):
443
443
    """Map a key to a simple sha1 string.
444
444
 
445
445
    This is a testing thunk to the C function.
475
475
    return key
476
476
 
477
477
 
478
 
def _test_sha1_to_key(sha1_bin):
 
478
def _py_sha1_to_key(sha1_bin):
479
479
    """Test thunk to check the sha1 mapping."""
480
480
    if not PyString_CheckExact(sha1_bin) or PyString_GET_SIZE(sha1_bin) != 20:
481
481
        raise ValueError('sha1_bin must be a str of exactly 20 bytes')
765
765
        this_offset = (as_uint >> self.common_shift) & 0xFF
766
766
        return this_offset
767
767
 
768
 
    def test_offset_for_sha1(self, sha1):
 
768
    def _get_offset_for_sha1(self, sha1):
769
769
        return self._offset_for_sha1(PyString_AS_STRING(sha1))
770
770
 
771
771
    cdef _compute_common(self):
814
814
            self.offsets[offset] = max_offset
815
815
            offset += 1
816
816
 
817
 
    property _test_offsets:
818
 
        def __get__(self):
819
 
            cdef int i
820
 
            result = []
821
 
            for i from 0 <= i < 257:
822
 
                PyList_Append(result, self.offsets[i])
823
 
            return result
 
817
    def _get_offsets(self):
 
818
        cdef int i
 
819
        result = []
 
820
        for i from 0 <= i < 257:
 
821
            PyList_Append(result, self.offsets[i])
 
822
        return result
824
823
 
825
824
 
826
825
def _parse_into_chk(bytes, key_length, ref_list_length):