From 563b4fd669df76b4434dc76a50711794918a4934 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 8 Oct 2015 09:35:59 +0900 Subject: [PATCH] Bug 1210687 - Remove PushbackIter now it's not used anymore. r=gps --- python/mozbuild/mozbuild/util.py | 34 -------------------------------- 1 file changed, 34 deletions(-) diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py index fa2b10ee233..8e3eddbdf3e 100644 --- a/python/mozbuild/mozbuild/util.py +++ b/python/mozbuild/mozbuild/util.py @@ -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.