jenkins-bot has submitted this change and it was merged. Change subject: [IMPR] Improvements for interwikidata.py ......................................................................
[IMPR] Improvements for interwikidata.py - Add doc for already implemented option -summary. - Align explanation to the same column like for -help documentation - Add additional TODO hint (a separate phab task will be done). - fallback is enabled by default for i18n.twtranslate - Simplify arg parsing. Change-Id: I5a1629c4708a4c08898dc5f50977512859e6157e --- M scripts/interwikidata.py 1 file changed, 16 insertions(+), 18 deletions(-) Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/interwikidata.py b/scripts/interwikidata.py index 1d3c1f3..50ee841 100644 --- a/scripts/interwikidata.py +++ b/scripts/interwikidata.py @@ -14,12 +14,14 @@ Furthermore, the following command line parameters are supported: --clean Clean pages. +-clean Clean pages. --create Create items only. +-create Create items only. + +-summary: Use your own edit summary for cleaning the page. """ -# (C) Pywikibot team, 2015 +# (C) Pywikibot team, 2015-2016 # # Distributed under the terms of the MIT license. # @@ -42,8 +44,8 @@ # Allowed namespaces. main, project, template, category namespaces = [0, 4, 10, 14] -# TODO: Some templates on pages, like csd and afd templates, -# should cause the bot to skip the page +# TODO: Some templates on pages, like csd, inuse and afd templates, +# should cause the bot to skip the page, see T134497 class IWBot(ExistingPageBot, SingleSiteBot): @@ -56,7 +58,7 @@ 'clean': False, 'create': False, 'summary': None, - 'ignore_ns': False + 'ignore_ns': False, # used by interwikidata_tests only }) super(IWBot, self).__init__(generator=generator, site=site, **kwargs) if not self.site.has_data_repository: @@ -66,7 +68,7 @@ self.repo = site.data_repository() if not self.getOption('summary'): self.options['summary'] = pywikibot.i18n.twtranslate( - site, 'interwikidata-clean-summary', fallback=True) + site, 'interwikidata-clean-summary') def treat_page(self): """Check page.""" @@ -181,25 +183,21 @@ @type args: list of unicode """ generator = None - clean = False - create = False - always = False local_args = pywikibot.handle_args(args) genFactory = pagegenerators.GeneratorFactory() options = {} for arg in local_args: - if arg == '-clean': - clean = True - elif arg == '-create': - create = True - elif arg.startswith('-always'): - always = True + option, sep, value = arg.partition(':') + option = option[1:] if option.startswith('-') else None + if genFactory.handleArg(arg): + continue + if option == 'summary': + options[option] = value else: - genFactory.handleArg(arg) + options[option] = True site = pywikibot.Site() - options = {'always': always, 'create': create, 'clean': clean} if not generator: generator = genFactory.getCombinedGenerator() if generator: -- To view, visit https://gerrit.wikimedia.org/r/287096 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5a1629c4708a4c08898dc5f50977512859e6157e Gerrit-PatchSet: 4 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt <i...@gno.de> Gerrit-Reviewer: John Vandenberg <jay...@gmail.com> Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com> Gerrit-Reviewer: Xqt <i...@gno.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits