Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/821796 )
Change subject: [IMPR] use backported pairwise in archivebot.py ......................................................................
[IMPR] use backported pairwise in archivebot.py
Function itertool.pairwise has been introduced in 3.10.
Change-Id: I7bdd71920855df782aab1a66ca2bde2f1976c484 --- M scripts/archivebot.py 1 file changed, 3 insertions(+), 4 deletions(-)
Approvals: Xqt: Verified; Looks good to me, approved
diff --git a/scripts/archivebot.py b/scripts/archivebot.py index e05e565..a756bbd 100755 --- a/scripts/archivebot.py +++ b/scripts/archivebot.py @@ -115,7 +115,6 @@ # Distributed under the terms of the MIT license. # import datetime -import itertools import locale import os import re @@ -129,7 +128,7 @@
import pywikibot from pywikibot import i18n -from pywikibot.backports import List, Set, Tuple +from pywikibot.backports import List, Set, Tuple, pairwise from pywikibot.exceptions import Error, NoPageError from pywikibot.textlib import ( TimeStripper, @@ -138,7 +137,7 @@ findmarker, to_local_digits, ) -from pywikibot.time import parse_duration, str2timedelta, MW_KEYS +from pywikibot.time import MW_KEYS, parse_duration, str2timedelta
ShouldArchive = Tuple[str, str] @@ -392,7 +391,7 @@
if self.keep: # set the timestamp to the previous if the current is lower - for first, second in itertools.pairwise(self.threads): + for first, second in pairwise(self.threads): second.timestamp = self.max(first.timestamp, second.timestamp)
# This extra info is not desirable when run under the unittest