jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/435672 )
Change subject: [IMPR] Use skip_page method to ignore further processing
......................................................................
[IMPR] Use skip_page method to ignore further processing
- Move skipping condition from treat_page to skip_page which
improves code readability
Change-Id: Ibdef249f2caadb87f05cf1bf27eb127eadb43ff7
---
M scripts/delete.py
1 file changed, 29 insertions(+), 29 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/delete.py b/scripts/delete.py
index 158acf9..61a8b85 100755
--- a/scripts/delete.py
+++ b/scripts/delete.py
@@ -183,41 +183,41 @@
for page in islice_with_ellipsis(refs[ns], show_n_pages):
pywikibot.output(' {0!s}'.format(page.title()))
+ def skip_page(self, page):
+ """Skip the page under some conditions."""
+ if self.getOption('undelete') and page.exists():
+ pywikibot.output('Skipping: {0} already exists.'.format(page))
+ return True
+ if not self.getOption('undelete') and not page.exists():
+ pywikibot.output('Skipping: {0} does not exist.'.format(page))
+ return True
+ return super(DeletionRobot, self).skip_page(page)
+
def treat_page(self):
"""Process one page from the generator."""
if self.getOption('undelete'):
- if self.current_page.exists():
- pywikibot.output('Skipping: {0} already exists.'.format(
- self.current_page))
- else:
- self.current_page.undelete(self.summary)
+ self.current_page.undelete(self.summary)
else:
- if self.current_page.exists():
+ if (self.getOption('isorphan') is not False and
+ not self.getOption('always')):
+ self.display_references()
- if (self.getOption('isorphan') is not False and
- not self.getOption('always')):
- self.display_references()
+ if self.getOption('orphansonly'):
+ namespaces = self.getOption('orphansonly')
+ ns_with_ref = self.current_page.namespaces_with_ref_to_page(
+ namespaces)
+ ns_with_ref = sorted(list(ns_with_ref))
+ if ns_with_ref:
+ ns_names = ', '.join(str(ns.id) for ns in ns_with_ref)
+ pywikibot.output(
+ 'Skipping: {0} is not orphan in ns: {1}.'.format(
+ self.current_page, ns_names))
+ return # Not an orphan, do not delete.
- if self.getOption('orphansonly'):
- namespaces = self.getOption('orphansonly')
- ns_with_ref = \
- self.current_page.namespaces_with_ref_to_page(
- namespaces)
- ns_with_ref = sorted(list(ns_with_ref))
- if ns_with_ref:
- ns_names = ', '.join(str(ns.id) for ns in ns_with_ref)
- pywikibot.output(
- 'Skipping: {0} is not orphan in ns: {1}.'.format(
- self.current_page, ns_names))
- return # Not an orphan, do not delete.
-
- self.current_page.delete(self.summary,
- not self.getOption('always'),
- self.getOption('always'),
- quit=True)
- else:
- pywikibot.output('Skipping: {0} does not exist.'.format(
- self.current_page))
+ self.current_page.delete(self.summary,
+ not self.getOption('always'),
+ self.getOption('always'),
+ quit=True)
def main(*args):
--
To view, visit https://gerrit.wikimedia.org/r/435672
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibdef249f2caadb87f05cf1bf27eb127eadb43ff7
Gerrit-Change-Number: 435672
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463419 )
Change subject: Fix all diff_checker related errors in pywikibot/**
......................................................................
Fix all diff_checker related errors in pywikibot/**
Change-Id: I01354c293744eb5a9c079cd5c6d7fd29323f8e7b
---
M pywikibot/__init__.py
M pywikibot/bot.py
M pywikibot/bot_choice.py
M pywikibot/botirc.py
M pywikibot/comms/http.py
M pywikibot/comms/threadedhttp.py
M pywikibot/compat/query.py
M pywikibot/config2.py
M pywikibot/cosmetic_changes.py
M pywikibot/data/api.py
M pywikibot/data/sparql.py
M pywikibot/data/wikistats.py
M pywikibot/date.py
M pywikibot/diff.py
M pywikibot/echo.py
M pywikibot/editor.py
M pywikibot/exceptions.py
M pywikibot/families/i18n_family.py
M pywikibot/families/omegawiki_family.py
M pywikibot/families/osm_family.py
M pywikibot/families/vikidia_family.py
M pywikibot/families/wikia_family.py
M pywikibot/family.py
M pywikibot/fixes.py
M pywikibot/i18n.py
M pywikibot/interwiki_graph.py
M pywikibot/logentries.py
M pywikibot/logging.py
M pywikibot/login.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/plural.py
M pywikibot/proofreadpage.py
M pywikibot/site.py
M pywikibot/site_detect.py
M pywikibot/specialbots.py
M pywikibot/textlib.py
M pywikibot/throttle.py
M pywikibot/titletranslate.py
M pywikibot/tools/__init__.py
M pywikibot/tools/_logging.py
M pywikibot/tools/ip.py
M pywikibot/userinterfaces/gui.py
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/userinterfaces/transliteration.py
M pywikibot/userinterfaces/win32_unicode.py
M pywikibot/version.py
M pywikibot/weblib.py
M pywikibot/xmlreader.py
M tox.ini
50 files changed, 1,475 insertions(+), 1,413 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
--
To view, visit https://gerrit.wikimedia.org/r/463419
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I01354c293744eb5a9c079cd5c6d7fd29323f8e7b
Gerrit-Change-Number: 463419
Gerrit-PatchSet: 3
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463234 )
Change subject: [bugfix] Fix doc errors introduced in b686ea35fea2 and e6ed12025dc1
......................................................................
[bugfix] Fix doc errors introduced in b686ea35fea2 and e6ed12025dc1
+ resolve some other older doc errors
Bug: T187009
Change-Id: Icb69204554af276f28c574f5a4f86b4b55cd4223
---
M pywikibot/data/api.py
M pywikibot/site.py
M scripts/archive/featured.py
M scripts/patrol.py
M scripts/solve_disambiguation.py
M scripts/weblinkchecker.py
M scripts/welcome.py
M tests/archivebot_tests.py
M tests/plural_tests.py
9 files changed, 43 insertions(+), 43 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 2c801f9..b56ebd5 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1579,7 +1579,7 @@
@param value: param value(s)
@type value: unicode or str in site encoding
- (string types may be a |-separated list)
+ (string types may be a `|`-separated list)
iterable, where items are converted to unicode
with special handling for datetime.datetime to convert it to a
string using the ISO 8601 format accepted by the MediaWiki API.
diff --git a/pywikibot/site.py b/pywikibot/site.py
index c2f43fa..2eb28ad 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2323,10 +2323,10 @@
def notifications(self, **kwargs):
"""Yield Notification objects from the Echo extension.
- keyword format: If specified, notifications will be returned formatted
+ @keyword format: If specified, notifications will be returned formatted
this way. Its value is either 'model', 'special' or None. Default
is 'special'.
- type format: str or None
+ @type format: str or None
Refer API reference for other keywords.
"""
diff --git a/scripts/archive/featured.py b/scripts/archive/featured.py
index 13f2866..d21128b 100755
--- a/scripts/archive/featured.py
+++ b/scripts/archive/featured.py
@@ -3,54 +3,54 @@
"""
Manage featured/good article/list status template.
-This script understands various command-line arguments:
+*** This script understands various command-line arguments: ***
- Task commands:
+Task commands:
--featured use this script for featured articles. Default task if no task
- command is specified
+ -featured use this script for featured articles. Default task
+ if no task command is specified
--good use this script for good articles.
+ -good use this script for good articles.
--lists use this script for featured lists.
+ -lists use this script for featured lists.
--former use this script for removing {{Link FA|xx}} from former
- fearured articles
+ -former use this script for removing {{Link FA|xx}} from former
+ fearured articles
- NOTE: you may have all of these commands in one run
+ NOTE: you may have all of these commands in one run
- Option commands:
+Option commands:
--interactive: ask before changing each page
+ -interactive: ask before changing each page
--nocache doesn't include cache files file to remember if the article
- already was verified.
+ -nocache doesn't include cache files file to remember if the article
+ already was verified.
--nocache:xx,yy you may ignore language codes xx,yy,... from cache file
+ -nocache:xx,yy you may ignore language codes xx,yy,... from cache file
--fromlang:xx,yy xx,yy,zz,.. are the languages to be verified.
--fromlang:ar--fi Another possible with range the languages
+ -fromlang:xx,yy xx,yy,zz,.. are the languages to be verified.
+ -fromlang:ar--fi Another possible with range the languages
--fromall to verify all languages.
+ -fromall to verify all languages.
--tolang:xx,yy xx,yy,zz,.. are the languages to be updated
+ -tolang:xx,yy xx,yy,zz,.. are the languages to be updated
--after:zzzz process pages after and including page zzzz
- (sorry, not implemented yet)
+ -after:zzzz process pages after and including page zzzz
+ (sorry, not implemented yet)
--side use -side if you want to move all {{Link FA|lang}} next to the
- corresponding interwiki links. Default is placing
- {{Link FA|lang}} on top of the interwiki links.
- (This option is deprecated with wikidata)
+ -side use -side if you want to move all {{Link FA|lang}} next
+ to the corresponding interwiki links. Default is placing
+ {{Link FA|lang}} on top of the interwiki links.
+ (This option is deprecated with wikidata)
--count Only counts how many featured/good articles exist
- on all wikis (given with the "-fromlang" argument) or
- on several language(s) (when using the "-fromall" argument).
- Example: python pwb.py featured -fromlang:en,he -count
- counts how many featured articles exist in the en and he
- wikipedias.
+ -count Only counts how many featured/good articles exist
+ on all wikis (given with the "-fromlang" argument) or
+ on several language(s) (when using the "-fromall" argument).
+ Example: python pwb.py featured -fromlang:en,he -count
+ counts how many featured articles exist in the en and he
+ wikipedias.
--quiet no corresponding pages are displayed.
+ -quiet no corresponding pages are displayed.
"""
#
diff --git a/scripts/patrol.py b/scripts/patrol.py
index c48d50f..8be7cdb 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -23,8 +23,7 @@
On Wikisource, it'll also check if the page is on the author namespace in which
case it'll also patrol pages which are linked from that page.
-An example can be found at:
-
+An example can be found at
https://en.wikisource.org/wiki/User:Wikisource-bot/patrol_whitelist
Commandline parameters
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 5e6abb1..9196e66 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -705,11 +705,11 @@
@staticmethod
def firstlinks(page):
- """Return a list of first links of every line beginning with *.
+ """Return a list of first links of every line beginning with `*`.
When a disambpage is full of unnecessary links, this may be useful
to sort out the relevant links. E.g. from line
- *[[Jim Smith (smith)|Jim Smith]] ([[1832]]-[[1932]]) [[English]]
+ `* [[Jim Smith (smith)|Jim Smith]] ([[1832]]-[[1932]]) [[English]]`
it returns only 'Jim Smith (smith)'
Lines without an asterisk at the beginning will be disregarded.
No check for page existence, it has already been done.
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index 6923a6f..60add89 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -642,7 +642,7 @@
We assume that the first element in the list represents the first time we
found this dead link, and the last element represents the last time.
- Example:
+ Example::
dict = {
'https://www.example.org/page': [
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 71cf48f..79da206 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -84,7 +84,7 @@
********************************* GUIDE ***********************************
-Report, Bad and white list guide:
+*** Report, Bad and white list guide: ***
1) Set in the code which page it will use to load the badword, the
whitelist and the report
@@ -118,7 +118,7 @@
* Search if he's in the report page, if yes he will be skipped
* If no, he will be reported.
-Random signature guide:
+*** Random signature guide: ***
Some welcomed users will answer to the one who has signed the welcome message.
When you welcome many new users, you might be overwhelmed with such answers.
diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py
index 7d292d9..a8d9d3d 100644
--- a/tests/archivebot_tests.py
+++ b/tests/archivebot_tests.py
@@ -241,7 +241,7 @@
def testTwoThreadsWithCommentedOutThread(self):
"""Test recognizing two threads and ignoring a commented out thread.
- Talk:For-pywikibot-archivebot must have:
+ Talk:For-pywikibot-archivebot must have::
{{User:MiszaBot/config
|archive = Talk:Main_Page/archive
diff --git a/tests/plural_tests.py b/tests/plural_tests.py
index dff2a7f..8ec053d 100644
--- a/tests/plural_tests.py
+++ b/tests/plural_tests.py
@@ -48,7 +48,8 @@
return test_static_rule
for lang, rule in plural.plural_rules.items():
- cls.add_method(dct, 'test_{0}'.format(lang), create_test(rule),
+ cls.add_method(dct, 'test_{0}'.format(lang.replace('-', '_')),
+ create_test(rule),
doc_suffix='for "{0}"'.format(lang))
return super(MetaPluralRulesTest, cls).__new__(cls, name, bases, dct)
--
To view, visit https://gerrit.wikimedia.org/r/463234
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Icb69204554af276f28c574f5a4f86b4b55cd4223
Gerrit-Change-Number: 463234
Gerrit-PatchSet: 15
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)