mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-18 08:02:49 +01:00
Prevent name clashes in utils.structures.
This commit is contained in:
parent
452c706092
commit
6514db9b3f
@ -121,11 +121,11 @@ class RingBuffer(object):
|
|||||||
if self.full:
|
if self.full:
|
||||||
oidx = idx
|
oidx = idx
|
||||||
if type(oidx) == types.SliceType:
|
if type(oidx) == types.SliceType:
|
||||||
range = xrange(*slice.indices(oidx, len(self)))
|
range_ = xrange(*slice.indices(oidx, len(self)))
|
||||||
if len(range) != len(elt):
|
if len(range_) != len(elt):
|
||||||
raise ValueError, 'seq must be the same length as slice.'
|
raise ValueError, 'seq must be the same length as slice.'
|
||||||
else:
|
else:
|
||||||
for (i, x) in zip(range, elt):
|
for (i, x) in zip(range_, elt):
|
||||||
self[i] = x
|
self[i] = x
|
||||||
else:
|
else:
|
||||||
(m, idx) = divmod(oidx, len(self.L))
|
(m, idx) = divmod(oidx, len(self.L))
|
||||||
@ -135,11 +135,11 @@ class RingBuffer(object):
|
|||||||
self.L[idx] = elt
|
self.L[idx] = elt
|
||||||
else:
|
else:
|
||||||
if type(idx) == types.SliceType:
|
if type(idx) == types.SliceType:
|
||||||
range = xrange(*slice.indices(idx, len(self)))
|
range_ = xrange(*slice.indices(idx, len(self)))
|
||||||
if len(range) != len(elt):
|
if len(range_) != len(elt):
|
||||||
raise ValueError, 'seq must be the same length as slice.'
|
raise ValueError, 'seq must be the same length as slice.'
|
||||||
else:
|
else:
|
||||||
for (i, x) in zip(range, elt):
|
for (i, x) in zip(range_, elt):
|
||||||
self[i] = x
|
self[i] = x
|
||||||
else:
|
else:
|
||||||
self.L[idx] = elt
|
self.L[idx] = elt
|
||||||
@ -240,15 +240,15 @@ class queue(object):
|
|||||||
if len(self) == 0:
|
if len(self) == 0:
|
||||||
raise IndexError, 'queue index out of range'
|
raise IndexError, 'queue index out of range'
|
||||||
if type(oidx) == types.SliceType:
|
if type(oidx) == types.SliceType:
|
||||||
range = xrange(*slice.indices(oidx, len(self)))
|
range_ = xrange(*slice.indices(oidx, len(self)))
|
||||||
if len(range) != len(value):
|
if len(range_) != len(value):
|
||||||
raise ValueError, 'seq must be the same length as slice.'
|
raise ValueError, 'seq must be the same length as slice.'
|
||||||
else:
|
else:
|
||||||
for i in range:
|
for i in range_:
|
||||||
(m, idx) = divmod(oidx, len(self))
|
(m, idx) = divmod(oidx, len(self))
|
||||||
if m and m != -1:
|
if m and m != -1:
|
||||||
raise IndexError, oidx
|
raise IndexError, oidx
|
||||||
for (i, x) in zip(range, value):
|
for (i, x) in zip(range_, value):
|
||||||
self[i] = x
|
self[i] = x
|
||||||
else:
|
else:
|
||||||
(m, idx) = divmod(oidx, len(self))
|
(m, idx) = divmod(oidx, len(self))
|
||||||
@ -261,8 +261,8 @@ class queue(object):
|
|||||||
|
|
||||||
def __delitem__(self, oidx):
|
def __delitem__(self, oidx):
|
||||||
if type(oidx) == types.SliceType:
|
if type(oidx) == types.SliceType:
|
||||||
range = xrange(*slice.indices(oidx, len(self)))
|
range_ = xrange(*slice.indices(oidx, len(self)))
|
||||||
for i in range:
|
for i in range_:
|
||||||
del self[i]
|
del self[i]
|
||||||
else:
|
else:
|
||||||
(m, idx) = divmod(oidx, len(self))
|
(m, idx) = divmod(oidx, len(self))
|
||||||
|
Loading…
Reference in New Issue
Block a user