jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/427842 )
Change subject: interwiki.py: Fix docstring errors
......................................................................
interwiki.py: Fix docstring errors
In reStructuredText syntax a blank line is required before the first
and after the last items.
Use explicit literal blocks for the code samples in Subject class docstring.
Bug: T192357
Change-Id: I380a000614b89d6b8a98219206510fd22be24509
---
M docs/scripts/scripts.rst
M scripts/interwiki.py
2 files changed, 12 insertions(+), 4 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/scripts/scripts.rst b/docs/scripts/scripts.rst
index e4931e7..3322fed 100644
--- a/docs/scripts/scripts.rst
+++ b/docs/scripts/scripts.rst
@@ -312,7 +312,6 @@
.. automodule:: scripts.interwiki
:members:
- :exclude-members: Subject
:undoc-members:
:show-inheritance:
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 5e03fd2..5e5c031 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -134,6 +134,7 @@
There are some special hints, trying a number of languages
at once:
+
* all: All languages with at least ca. 100 articles
* 10: The 10 largest languages (sites with most
articles). Analogous for any other natural
@@ -146,6 +147,7 @@
Names of families that forward their interlanguage links
to the wiki family being worked upon can be used, they are:
+
* commons: Interlanguage links of Mediawiki Commons
* incubator: Links in pages on the Mediawiki Incubator
* meta: Interlanguage links of named pages on Meta
@@ -285,10 +287,12 @@
-whenneeded works like limittwo, but other languages are changed in the
following cases:
+
* If there are no interwiki links at all on the page
* If an interwiki link must be removed
* If an interwiki link must be changed and there has been
a conflict for this page
+
Optionally, -whenneeded can be given an additional number
(for example -whenneeded:3), in which case other languages
will be changed if there are that number or more links to
@@ -744,8 +748,11 @@
A formal way to compute that closure would be:
With P a set of pages, NL ('NextLevel') a function on sets defined as:
+
NL(P) = { target | ∃ source ∈ P, target ∈ source.langlinks() }
- pseudocode:
+
+ pseudocode::
+
todo <- [originPage]
done <- []
while todo != []:
@@ -759,7 +766,7 @@
to compute efficiently NL(P), one has to load the page contents of
pages in P.
(Not only the langlinks have to be parsed from each Page, but we also want
- to know if the Page is a redirect, a disambiguation, etc...)
+ to know if the Page is a redirect, a disambiguation, etc...)
Because of this, the pages in pending have to be preloaded.
However, because the pages in pending are likely to be in several sites
@@ -769,7 +776,8 @@
Site, and we put in pending all the pages from todo that belong to that
Site:
- Code becomes:
+ Code becomes::
+
todo <- {originPage.site:[originPage]}
done <- []
while todo != {}:
@@ -784,6 +792,7 @@
Subject objects only operate on pages that should have been preloaded
before. In fact, at any time:
+
* todo contains new Pages that have not been loaded yet
* done contains Pages that have been loaded, and that have been treated.
* If batch preloadings are successful, Page._get() is never called from
--
To view, visit
https://gerrit.wikimedia.org/r/427842
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I380a000614b89d6b8a98219206510fd22be24509
Gerrit-Change-Number: 427842
Gerrit-PatchSet: 5
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
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 <>