~jelmer/dulwich/python3

« back to all changes in this revision

Viewing changes to dulwich/pack.py

  • Committer: Chris Eberle
  • Date: 2011-11-27 23:51:46 UTC
  • Revision ID: git-v1:a69afd1ed7654aab632dc7dc5efe2e3fa6fe54dd
Got rid of some unneeded asserts

Show diffs side-by-side

added added

removed removed

Lines of Context:
312
312
    :return: Index of the SHA, or None if it wasn't found
313
313
    """
314
314
 
315
 
    assert isinstance(sha, bytes)
316
315
    assert start <= end
317
316
    while start <= end:
318
317
        i = (start + end) // 2
576
575
        return (name, offset, None)
577
576
 
578
577
    def _unpack_name(self, i):
579
 
        assert isinstance(i, int)
580
578
        offset = (0x100 * 4) + (i * 24) + 4
581
579
        return self._contents[offset:offset+20]
582
580
 
583
581
    def _unpack_offset(self, i):
584
 
        assert isinstance(i, int)
585
582
        offset = (0x100 * 4) + (i * 24)
586
583
        return unpack_from('>L', self._contents, offset)[0]
587
584
 
1171
1168
        """
1172
1169
        if offset in self._offset_cache:
1173
1170
            return self._offset_cache[offset]
1174
 
        assert isinstance(offset, int) or isinstance(offset, int),\
1175
 
                'offset was %r' % offset
 
1171
        assert isinstance(offset, int), 'offset was %r' % offset
1176
1172
        assert offset >= self._header_size
1177
1173
        self._file.seek(offset)
1178
1174
        unpacked, _ = unpack_object(self._file.read)