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

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/673695
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I55e4da4281eb7628164e11f7751db1bbe6f2c74d
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to