# Get an item from the queue
def _get(self):
- item = self.queue[0]
- del self.queue[0]
- return item
+ return self.queue.pop(0)
def pop (self):
if self.list:
- result = self.list[0]
- del self.list[0]
- return (1, result)
+ return (1, self.list.pop(0))
else:
return (0, None)
"""
plist = map(lambda x: x.strip(), line.split(';'))
- key = plist[0].lower()
- del plist[0]
+ key = plist.pop(0).lower()
pdict = {}
for p in plist:
i = p.find('=')
stop = None
while not stop:
if self.cmdqueue:
- line = self.cmdqueue[0]
- del self.cmdqueue[0]
+ line = self.cmdqueue.pop(0)
else:
if self.use_rawinput:
try:
names = []
classes = [self.__class__]
while classes:
- aclass = classes[0]
+ aclass = classes.pop(0)
if aclass.__bases__:
classes = classes + list(aclass.__bases__)
names = names + dir(aclass)
- del classes[0]
return names
def complete_help(self, *args):
return typ, dat
if not name in self.untagged_responses:
return typ, [None]
- data = self.untagged_responses[name]
+ data = self.untagged_responses.pop(name)
if __debug__:
if self.debug >= 5:
self._mesg('untagged_responses[%s] => %s' % (name, data))
- del self.untagged_responses[name]
return typ, data
def next(self):
if not self.boxes:
return None
- fn = self.boxes[0]
- del self.boxes[0]
+ fn = self.boxes.pop(0)
fp = open(os.path.join(self.dirname, fn))
return self.factory(fp)
def next(self):
if not self.boxes:
return None
- fn = self.boxes[0]
- del self.boxes[0]
+ fn = self.boxes.pop(0)
fp = open(fn)
return self.factory(fp)
self.level = max(0, self.level - 1)
del self.stack[0]
if self.seekable:
- self.start = self.posstack[0]
- del self.posstack[0]
+ self.start = self.posstack.pop(0)
if self.level > 0:
self.lastpos = abslastpos - self.start
"""Unlock a mutex. If the queue is not empty, call the next
function with its argument."""
if self.queue:
- function, argument = self.queue[0]
- del self.queue[0]
+ function, argument = self.queue.pop(0)
function(argument)
else:
self.locked = 0
dispatch[PERSID] = load_persid
def load_binpersid(self):
- stack = self.stack
-
- pid = stack[-1]
- del stack[-1]
-
+ pid = self.stack.pop()
self.append(self.persistent_load(pid))
dispatch[BINPERSID] = load_binpersid
def load_append(self):
stack = self.stack
- value = stack[-1]
- del stack[-1]
+ value = stack.pop()
list = stack[-1]
list.append(value)
dispatch[APPEND] = load_append
def load_setitem(self):
stack = self.stack
- value = stack[-1]
- key = stack[-2]
- del stack[-2:]
+ value = stack.pop()
+ key = stack.pop()
dict = stack[-1]
dict[key] = value
dispatch[SETITEM] = load_setitem
def load_build(self):
stack = self.stack
- value = stack[-1]
- del stack[-1]
+ value = stack.pop()
inst = stack[-1]
try:
setstate = inst.__setstate__
dispatch[MARK] = load_mark
def load_stop(self):
- value = self.stack[-1]
- del self.stack[-1]
+ value = self.stack.pop()
raise _Stop(value)
dispatch[STOP] = load_stop
while not self.queue:
self._note("get(): queue empty")
self.rc.wait()
- item = self.queue[0]
- del self.queue[0]
+ item = self.queue.pop(0)
self._note("get(): got %s, %d left", item, len(self.queue))
self.wc.notify()
self.mon.release()
dispatch["name"] = end_string # struct keys are always strings
def end_array(self, data):
- mark = self._marks[-1]
- del self._marks[-1]
+ mark = self._marks.pop()
# map arrays to Python lists
self._stack[mark:] = [self._stack[mark:]]
self._value = 0
dispatch["array"] = end_array
def end_struct(self, data):
- mark = self._marks[-1]
- del self._marks[-1]
+ mark = self._marks.pop()
# map structs to Python dictionaries
dict = {}
items = self._stack[mark:]