jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/673695 )
Change subject: [IMPR] Provide an object representation for DequeGenerator ......................................................................
[IMPR] Provide an object representation for DequeGenerator
Provide an object representation for DequeGenerator without clearing the content
Change-Id: I55e4da4281eb7628164e11f7751db1bbe6f2c74d --- M pywikibot/tools/__init__.py 1 file changed, 8 insertions(+), 1 deletion(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py index 2274554..9eb2bba 100644 --- a/pywikibot/tools/__init__.py +++ b/pywikibot/tools/__init__.py @@ -960,10 +960,17 @@
def __next__(self): """Iterator method.""" - if len(self): + if self: return self.popleft() raise StopIteration
+ def __repr__(self): + """Provide an object representation without clearing the content.""" + items = list(self) + result = '{}({})'.format(self.__class__.__name__, items) + self.extend(items) + return result +
def open_archive(filename, mode='rb', use_extension=True): """
pywikibot-commits@lists.wikimedia.org