jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/791780 )
Change subject: [IMPR] Print the page list immediately except pages are preloaded ......................................................................
[IMPR] Print the page list immediately except pages are preloaded
- pages are collected in the the output_list due to T220905 but as long as pages aren't preloaded the list entries can be printed immediately. - clear list if self.opt.put is not True
Change-Id: I66399022f0e76ec7d74883ecf15ff5e8bd841bad --- M scripts/listpages.py 1 file changed, 9 insertions(+), 1 deletion(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/listpages.py b/scripts/listpages.py index dfedc77..1ca7def 100755 --- a/scripts/listpages.py +++ b/scripts/listpages.py @@ -181,6 +181,7 @@ 'notitle': False, 'outputlang': None, 'overwrite': False, + 'preloading': None, 'summary': '', 'get': False, 'put': None, @@ -207,6 +208,10 @@ f.write(page.text.encode(self.opt.encode)) self.counter['save'] += 1
+ if self.opt.preloading is False: + pywikibot.stdout(self.output_list[-1] + if self.opt.put else self.output_list.pop()) + def setup(self) -> None: """Initialize `output_list` and `num` and adjust base directory.""" self.output_list = [] @@ -240,7 +245,9 @@ if self.opt.put: self.current_page = self.opt.put self.put_current(text, summary=self.opt.summary, show_diff=False) - pywikibot.stdout(text) + + if self.opt.preloading is True: + pywikibot.stdout(text)
def main(*args: str) -> None: @@ -297,6 +304,7 @@ .format(page_target))
gen = gen_factory.getCombinedGenerator() + options['preloading'] = gen_factory.is_preloading if not suggest_help(missing_generator=not gen, unknown_parameters=unknown_args, additional_text=additional_text):
pywikibot-commits@lists.wikimedia.org