Show More
@@ -44,17 +44,16 class BaseIndexObject(object): | |||
|
44 | 44 | def append(self, tup): |
|
45 | 45 | self._extra.append(tup) |
|
46 | 46 | |
|
47 |
def _ |
|
|
47 | def _check_index(self, i): | |
|
48 | 48 | if not isinstance(i, int): |
|
49 | 49 | raise TypeError("expecting int indexes") |
|
50 | 50 | if i < 0 or i >= len(self): |
|
51 | 51 | raise IndexError |
|
52 | return i | |
|
53 | 52 | |
|
54 | 53 | def __getitem__(self, i): |
|
55 | 54 | if i == -1: |
|
56 | 55 | return (0, 0, 0, -1, -1, -1, -1, nullid) |
|
57 |
|
|
|
56 | self._check_index(i) | |
|
58 | 57 | if i >= self._lgt: |
|
59 | 58 | return self._extra[i - self._lgt] |
|
60 | 59 | index = self._calculate_index(i) |
@@ -79,7 +78,8 class IndexObject(BaseIndexObject): | |||
|
79 | 78 | def __delitem__(self, i): |
|
80 | 79 | if not isinstance(i, slice) or not i.stop == -1 or i.step is not None: |
|
81 | 80 | raise ValueError("deleting slices only supports a:-1 with step 1") |
|
82 |
i = |
|
|
81 | i = i.start | |
|
82 | self._check_index(i) | |
|
83 | 83 | if i < self._lgt: |
|
84 | 84 | self._data = self._data[:i * indexsize] |
|
85 | 85 | self._lgt = i |
@@ -113,7 +113,8 class InlinedIndexObject(BaseIndexObject | |||
|
113 | 113 | def __delitem__(self, i): |
|
114 | 114 | if not isinstance(i, slice) or not i.stop == -1 or i.step is not None: |
|
115 | 115 | raise ValueError("deleting slices only supports a:-1 with step 1") |
|
116 |
i = |
|
|
116 | i = i.start | |
|
117 | self._check_index(i) | |
|
117 | 118 | if i < self._lgt: |
|
118 | 119 | self._offsets = self._offsets[:i] |
|
119 | 120 | self._lgt = i |
General Comments 0
You need to be logged in to leave comments.
Login now