Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1328360?usp=email )

Change subject: xmlreader: Iterate revisions lazily
......................................................................

xmlreader: Iterate revisions lazily

Element.findall builds a list of all revisions before _fetch_revs can yield any 
of them.

Use iterfind to process each matching revision in document order without the 
intermediate list.

Change-Id: Ibad025b65f57120d5b008b82d2db0c26392c0c9c
---
M pywikibot/xmlreader.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Xqt: Verified; Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/xmlreader.py b/pywikibot/xmlreader.py
index bd5bc78..74037a6 100644
--- a/pywikibot/xmlreader.py
+++ b/pywikibot/xmlreader.py
@@ -251,7 +251,7 @@
         """
         uri = self.uri
         headers = self._headers(elem)
-        for revision in elem.findall(f'{uri}revision'):
+        for revision in elem.iterfind(f'{uri}revision'):
             revid = int(revision.findtext(f'{uri}id')) if with_id else 0
             yield RawRev(headers, revision, revid)


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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ibad025b65f57120d5b008b82d2db0c26392c0c9c
Gerrit-Change-Number: 1328360
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to