mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1210687 - Remove PushbackIter now it's not used anymore. r=gps
This commit is contained in:
parent
8e61778945
commit
563b4fd669
@ -724,40 +724,6 @@ def lock_file(lockfile, max_wait = 600):
|
||||
return LockFile(lockfile)
|
||||
|
||||
|
||||
class PushbackIter(object):
|
||||
'''Utility iterator that can deal with pushed back elements.
|
||||
|
||||
This behaves like a regular iterable, just that you can call
|
||||
iter.pushback(item) to get the given item as next item in the
|
||||
iteration.
|
||||
'''
|
||||
def __init__(self, iterable):
|
||||
self.it = iter(iterable)
|
||||
self.pushed_back = []
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __nonzero__(self):
|
||||
if self.pushed_back:
|
||||
return True
|
||||
|
||||
try:
|
||||
self.pushed_back.insert(0, self.it.next())
|
||||
except StopIteration:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def next(self):
|
||||
if self.pushed_back:
|
||||
return self.pushed_back.pop()
|
||||
return self.it.next()
|
||||
|
||||
def pushback(self, item):
|
||||
self.pushed_back.append(item)
|
||||
|
||||
|
||||
def shell_quote(s):
|
||||
'''Given a string, returns a version enclosed with single quotes for use
|
||||
in a shell command line.
|
||||
|
Loading…
Reference in New Issue
Block a user