mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-20 17:39:27 +01:00
Enabled __slots__ on RingBuffer.
This commit is contained in:
parent
45b4d95184
commit
25daf96a9c
@ -42,7 +42,7 @@ import types
|
||||
__all__ = ['RingBuffer', 'queue', 'MaxLengthQueue']
|
||||
|
||||
class RingBuffer(object):
|
||||
#__slots__ = ('L', 'i', 'full')
|
||||
__slots__ = ('L', 'i', 'full', 'maxSize')
|
||||
def __init__(self, maxSize, seq=()):
|
||||
if maxSize <= 0:
|
||||
raise ValueError, 'maxSize must be > 0.'
|
||||
@ -145,6 +145,15 @@ class RingBuffer(object):
|
||||
else:
|
||||
return 'RingBuffer(%r, %r)' % (self.maxSize, list(self))
|
||||
|
||||
def __getstate__(self):
|
||||
return (self.maxSize, self.full, self.i, self.L)
|
||||
|
||||
def __setstate__(self, (maxSize, full, i, L)):
|
||||
self.maxSize = maxSize
|
||||
self.full = full
|
||||
self.i = i
|
||||
self.L = L
|
||||
|
||||
|
||||
class queue(object):
|
||||
__slots__ = ('front', 'back')
|
||||
|
Loading…
Reference in New Issue
Block a user