jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[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(-)

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):
"""

To view, visit change 673695. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I55e4da4281eb7628164e11f7751db1bbe6f2c74d
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged