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 <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/427845 )
Change subject: redirect.py: Fix the docstring
......................................................................
redirect.py: Fix the docstring
redirect.__doc__:
Use field list for action commands. Move shortcuts to description to
prevent rendering of description of a single action to be placed into
seperate table cells.
redirect.get_redirects_via_api.__doc__:
Use field list for documenting the retuned tuple items.
Bug: T192356
Change-Id: I440786f1a6c86d01001841510b1daeeeade5f21a
---
M docs/scripts/scripts.rst
M scripts/redirect.py
2 files changed, 34 insertions(+), 29 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..7c0ce97 100644
--- a/docs/scripts/scripts.rst
+++ b/docs/scripts/scripts.rst
@@ -454,6 +454,10 @@
scripts.redirect script
-----------------------
+.. automodule:: scripts.redirect
+ :members:
+ :undoc-members:
+ :show-inheritance:
scripts.reflinks script
-----------------------
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 2511f46..b1d0bea 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -12,17 +12,16 @@
where action can be one of these:
-double Fix redirects which point to other redirects.
-do Shortcut action command is "do".
+:double: Shortcut: **do**. Fix redirects which point to other redirects.
-broken Tries to fix redirect which point to nowhere by using the last
-br moved target of the destination page. If this fails and the
- -delete option is set, it either deletes the page or marks it
- for deletion depending on whether the account has admin rights.
- It will mark the redirect not for deletion if there is no speedy
- deletion template available. Shortcut action command is "br".
+:broken: Shortcut: **br**. Tries to fix redirect which point to nowhere
+ by using the last moved target of the destination page. If this
+ fails and the -delete option is set, it either deletes the page
+ or marks it for deletion depending on whether the account has
+ admin rights. It will mark the redirect not for deletion if
+ there is no speedy deletion template available.
-both Both of the above. Retrieves redirect pages from live wiki,
+:both: Both of the above. Retrieves redirect pages from live wiki,
not from a special page.
and arguments can be:
@@ -233,27 +232,30 @@
yield apiQ
def get_redirects_via_api(self, maxlen=8):
- """
+ r"""
Return a generator that yields tuples of data about redirect Pages.
- 0 - page title of a redirect page
- 1 - type of redirect:
- 0 - broken redirect, target page title missing
- 1 - normal redirect, target page exists and is not a
- redirect
- 2..maxlen - start of a redirect chain of that many redirects
- (currently, the API seems not to return sufficient
- data to make these return values possible, but
- that may change)
- maxlen+1 - start of an even longer chain, or a loop
- (currently, the API seems not to return sufficient
- data to allow this return values, but that may
- change)
- None - start of a redirect chain of unknown length, or
- loop
- 2 - target page title of the redirect, or chain (may not exist)
- 3 - target page of the redirect, or end of chain, or page title
- where chain or loop detecton was halted, or None if unknown
+ The description of returned tuple items is as follows:
+
+ :[0]: page title of a redirect page
+ :[1]: type of redirect:
+
+ :None: start of a redirect chain of unknown length, or loop
+ :[0]: broken redirect, target page title missing
+ :[1]: normal redirect, target page exists and is not a
+ redirect
+ :[2\:maxlen]: start of a redirect chain of that many redirects
+ (currently, the API seems not to return sufficient
+ data to make these return values possible, but
+ that may change)
+ :[maxlen+1]: start of an even longer chain, or a loop
+ (currently, the API seems not to return sufficient
+ data to allow this return values, but that may
+ change)
+
+ :[2]: target page title of the redirect, or chain (may not exist)
+ :[3]: target page of the redirect, or end of chain, or page title
+ where chain or loop detecton was halted, or None if unknown
"""
for apiQ in self._next_redirect_group():
gen = pywikibot.data.api.Request(
@@ -265,7 +267,6 @@
raise RuntimeError("API query error: %s" % data)
if data == [] or 'query' not in data:
raise RuntimeError("No results given.")
- redirects = {}
pages = {}
redirects = {x['from']: x['to']
for x in data['query']['redirects']}
--
To view, visit https://gerrit.wikimedia.org/r/427845
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I440786f1a6c86d01001841510b1daeeeade5f21a
Gerrit-Change-Number: 427845
Gerrit-PatchSet: 6
Gerrit-Owner: 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 <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/427304 )
Change subject: [IMPR][doc] Solve various warnings thrown in doctests
......................................................................
[IMPR][doc] Solve various warnings thrown in doctests
- fix epydoc, reST and napoleon formating issues
- merge duplicate apidoc index files for tests
- replace &warning; in cosmetic_changes.py
- escape "*" wildcard in login.py
- exclude ¶ms; description from double-colon fixup
- escape "|" (not reST substitution blocks) - works only sometimes?
- standardize `python ...` examples indentation and remove its fixup
- import two missing modules to make diff_checker.py and mysql.py
available in docs
- fix and re-enable docs for welcome.py (T192355)
Bug: T187009
Bug: T192355
Change-Id: I75973748aaaf427f58a54f09f6ba762dd5bcfb32
---
M docs/api_ref/tests/index.rst
D docs/api_ref/tests/tests.rst
M docs/conf.py
M docs/requirements-py3.txt
M docs/scripts/scripts.rst
M pywikibot/bot.py
M pywikibot/data/api.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/proofreadpage.py
M pywikibot/site.py
M pywikibot/textlib.py
M pywikibot/tools/__init__.py
M requirements.txt
M scripts/add_text.py
M scripts/archivebot.py
M scripts/basic.py
M scripts/blockpageschecker.py
M scripts/category.py
M scripts/checkimages.py
M scripts/delete.py
M scripts/flickrripper.py
M scripts/image.py
M scripts/imagecopy.py
M scripts/interwiki.py
M scripts/listpages.py
M scripts/maintenance/make_i18n_dict.py
M scripts/nowcommons.py
M scripts/protect.py
M scripts/replace.py
M scripts/replicate_wiki.py
M scripts/table2wiki.py
M scripts/template.py
M scripts/templatecount.py
M scripts/transferbot.py
M scripts/upload.py
M scripts/watchlist.py
M scripts/weblinkchecker.py
M scripts/welcome.py
M scripts/wikisourcetext.py
M tests/archivebot_tests.py
41 files changed, 217 insertions(+), 266 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/api_ref/tests/index.rst b/docs/api_ref/tests/index.rst
index c4cd995..a0021c2 100644
--- a/docs/api_ref/tests/index.rst
+++ b/docs/api_ref/tests/index.rst
@@ -1,3 +1,12 @@
+===========
+Subpackages
+===========
+
+.. toctree::
+
+ i18n
+ pwb
+
=============
Library tests
=============
diff --git a/docs/api_ref/tests/tests.rst b/docs/api_ref/tests/tests.rst
deleted file mode 100644
index d0017fb..0000000
--- a/docs/api_ref/tests/tests.rst
+++ /dev/null
@@ -1,107 +0,0 @@
-tests package
-=============
-
-.. automodule:: tests
- :members:
- :undoc-members:
- :show-inheritance:
-
-Subpackages
------------
-
-.. toctree::
-
- i18n
- pwb
-
-Submodules
-----------
-
-.. toctree::
-
- add_text_tests
- api_tests
- archivebot_tests
- aspects
- basepage_tests
- bot_tests
- cache_tests
- category_bot_tests
- category_tests
- checkimages_tests
- conftest
- cosmetic_changes_tests
- data_ingestion_tests
- date_tests
- deletionbot_tests
- deprecation_tests
- diff_tests
- disambredir_tests
- djvu_tests
- dry_api_tests
- dry_site_tests
- edit_failure_tests
- edit_tests
- eventstreams_tests
- exceptions_tests
- family_tests
- file_tests
- fixes_tests
- flow_edit_tests
- flow_tests
- flow_thanks_tests
- http_tests
- i18n_tests
- imagecopy_tests
- interwiki_graph_tests
- interwiki_link_tests
- interwikidata_tests
- isbn_tests
- l10n_tests
- link_tests
- logentry_tests
- login_tests
- mediawikiversion_tests
- namespace_tests
- oauth_tests
- page_tests
- pagegenerators_tests
- paraminfo_tests
- patrolbot_tests
- plural_tests
- proofreadpage_tests
- protectbot_tests
- pwb_tests
- python_tests
- redirect_bot_tests
- reflinks_tests
- replacebot_tests
- script_tests
- site_detect_tests
- site_tests
- sparql_tests
- template_bot_tests
- tests_tests
- textlib_tests
- thanks_tests
- thread_tests
- timestamp_tests
- timestripper_tests
- tk_tests
- tools_chars_tests
- tools_formatter_tests
- tools_ip_tests
- tools_tests
- ui_options_tests
- ui_tests
- upload_tests
- uploadbot_tests
- user_tests
- utils
- weblib_tests
- weblinkchecker_tests
- wikibase_edit_tests
- wikibase_tests
- wikistats_tests
- xmlreader_tests
-
diff --git a/docs/conf.py b/docs/conf.py
index c691ca3..4d067db 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -29,6 +29,8 @@
sys.path.insert(0, repo_dir)
os.chdir(repo_dir)
+from scripts.cosmetic_changes import warning
+
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
@@ -264,30 +266,40 @@
if what != "module":
return
- if os.path.sep + "scripts" + os.path.sep not in obj.__file__:
+ if not name.startswith('scripts.'):
return
for index, line in enumerate(lines):
if line == '¶ms;':
lines[index] = ('This script supports use of '
':py:mod:`pywikibot.pagegenerators` arguments.')
- elif line == '&fixes-help;':
+ elif name == 'scripts.replace' and line == '&fixes-help;':
lines[index] = (' The available fixes are listed '
'in :py:mod:`pywikibot.fixes`.')
+ elif name == 'scripts.cosmetic_changes' and line == '&warning;':
+ lines[index] = warning
+ elif name == 'scripts.login' and '*' in line:
+ # Escape star wildcard in scripts/login.py
+ lines[index] = line.replace('*', '\\*')
elif (line.endswith(':') and not line.strip().startswith(':') and
'Traceback (most recent call last)' not in line):
- lines[index] = line + ':'
- elif line.startswith('-'):
+ # Initiate code block except pagegenerator arguments follows
+ for afterline in lines[index + 1:]:
+ if afterline == '':
+ continue
+ elif afterline == '¶ms;':
+ break
+ else:
+ lines[index] = line + ':'
+ break
+ if line.startswith('-'):
# Indent options
lines[index] = ' ' + line
elif line.startswith(' '):
# Indent description of options (as options are indented)
lines[index] = line.replace(' ', ' ')
- elif line.strip().startswith('python'):
- # Indent commands
- lines[index] = ' ' + line.strip()
- if '=' in line:
- # Escape equal signs
- lines[index] = line.replace('=', '\\=')
+ if '|' in line:
+ # Escape vertical bars
+ lines[index] = line.replace('|', '\\|')
def pywikibot_skip_members(app, what, name, obj, skip, options):
diff --git a/docs/requirements-py3.txt b/docs/requirements-py3.txt
index e4c7d88..215008f 100644
--- a/docs/requirements-py3.txt
+++ b/docs/requirements-py3.txt
@@ -4,4 +4,4 @@
sphinx
sphinx-epytext>=0.0.4
-
+unidiff
diff --git a/docs/scripts/scripts.rst b/docs/scripts/scripts.rst
index e4931e7..fc6966a 100644
--- a/docs/scripts/scripts.rst
+++ b/docs/scripts/scripts.rst
@@ -642,6 +642,11 @@
scripts.welcome script
----------------------
+.. automodule:: scripts.welcome
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
scripts.wikisourcetext script
-----------------------------
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 71bb5a0..94259e8 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1815,13 +1815,18 @@
already ItemPage (page in treat_page_and_item will be None).
If None it'll use ItemPage.fromPage when the page is not in the site's
item namespace.
+
@type use_from_page: bool, None
+
@cvar treat_missing_item: Whether pages without items should be treated.
Note that this is checked after create_missing_item.
+
@type treat_missing_item: bool
+
@ivar create_missing_item: If True, new items will be created if the current
page doesn't have one. Subclasses should override this in the
constructor with a bool value or using self.getOption.
+
@type create_missing_item: bool
"""
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c099574..e7ff833 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1569,8 +1569,11 @@
"""Set MediaWiki API request parameter.
@param key: param key
+
@type key: basestring
+
@param value: param value(s)
+
@type value: unicode or str in site encoding
(string types may be a |-separated list)
iterable, where items are converted to unicode
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 4755924..97c6681 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3545,7 +3545,7 @@
not None, iterate only non-minor edits (default: iterate both)
@keyword top_only: if True, iterate only edits which are the latest
revision (default: False)
- @return tuple of pywikibot.Page, revid, pywikibot.Timestamp, comment
+ @return: tuple of pywikibot.Page, revid, pywikibot.Timestamp, comment
@rtype: tuple
"""
for contrib in self.site.usercontribs(
@@ -3561,7 +3561,7 @@
"""Return first user contribution.
@return: first user contribution entry
- @return tuple of pywikibot.Page, revid, pywikibot.Timestamp, comment
+ @return: tuple of pywikibot.Page, revid, pywikibot.Timestamp, comment
@rtype: tuple or None
"""
return next(self.contributions(reverse=True, total=1), None)
@@ -3571,7 +3571,7 @@
"""Return last user contribution.
@return: last user contribution entry
- @return tuple of pywikibot.Page, revid, pywikibot.Timestamp, comment
+ @return: tuple of pywikibot.Page, revid, pywikibot.Timestamp, comment
@rtype: tuple or None
"""
return next(self.contributions(total=1), None)
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 6674501..74da441 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -615,7 +615,7 @@
@param category: category name with start parameter
@type category: str
- @rtype generator
+ @rtype: generator
"""
cat, startfrom = self.getCategory(category)
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index 44059f4..a1431cd 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -509,8 +509,8 @@
@return: file url of the scan ProofreadPage or None.
@rtype: str/unicode
- @raises:
- - Exception in case of http errors.
+ @raises Exception: in case of http errors
+ @raises ValueError: in case of no prp_page_image src found for scan
"""
# wrong link fail with various possible Exceptions.
if not hasattr(self, '_url_image'):
diff --git a/pywikibot/site.py b/pywikibot/site.py
index c19ec20..2eb4141 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2027,7 +2027,7 @@
@type autocreate: bool
@raises NoUsername: Username is not recognised by the site.
- U{https://www.mediawiki.org/wiki/API:Login}
+ @see: U{https://www.mediawiki.org/wiki/API:Login}
"""
# TODO: this should include an assert that loginstatus
# is not already IN_PROGRESS, however the
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 0c0940b..d637917 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -984,8 +984,8 @@
@param template_subpage: Indicates if text belongs to a template sub-page
or not.
@type template_subpage: bool
- @return The modified text.
- @rtype str
+ @return: The modified text.
+ @rtype: str
"""
# Find a marker that is not already in the text.
marker = findmarker(oldtext)
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 4df67fc..d4ce8a4 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -578,10 +578,9 @@
an iterable object).
@param qsize: The size of the lookahead queue. The larger the qsize,
- the more values will be computed in advance of use (which can eat
- up memory and processor time).
+ the more values will be computed in advance of use (which can eat
+ up memory and processor time).
@type qsize: int
-
"""
if kwargs is None:
kwargs = {}
diff --git a/requirements.txt b/requirements.txt
index ffd1dba..bcbb4b8 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -71,6 +71,7 @@
# The mysql generator in pagegenerators depends on either oursql or MySQLdb
# pywikibot prefers oursql. Both are Python 2 only; T89976.
oursql ; python_version < '3'
+mysqlclient ; python_version >= '3'
# scripts/script_wui.py depends on Lua, which is not available using pip
# but can be obtained from: https://github.com/bastibe/lunatic-python
diff --git a/scripts/add_text.py b/scripts/add_text.py
index a40d765..c3e1d74 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -35,7 +35,8 @@
-noreorder Avoid to reorder cats and interwiki
---- Example ---
+Example
+-------
1.
# This is a script to add a template to the top of the pages with
# category:catname
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 87eaf2f..9e1d328 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -30,28 +30,28 @@
Meanings of parameters are:
-archive Name of the page to which archived threads will be put.
- Must be a subpage of the current page. Variables are
- supported.
-algo specifies the maximum age of a thread. Must be in the form
- old(<delay>) where <delay> specifies the age in
- seconds (s), hours (h), days (d), weeks(w), or years (y)
- like 24h or 5d.
- Default is old(24h).
-counter The current value of a counter which could be assigned as
- variable. Will be actualized by bot. Initial value is 1.
-maxarchivesize The maximum archive size before incrementing the counter.
- Value can be given with appending letter like K or M which
- indicates KByte or MByte. Default value is 1000M.
-minthreadsleft Minimum number of threads that should be left on a page.
- Default value is 5.
-minthreadstoarchive The minimum number of threads to archive at once. Default
- value is 2.
-archiveheader Content that will be put on new archive pages as the
- header. This parameter supports the use of variables.
- Default value is {{talkarchive}}
-key A secret key that (if valid) allows archives to not be
- subpages of the page being archived.
+ archive Name of the page to which archived threads will be put.
+ Must be a subpage of the current page. Variables are
+ supported.
+ algo specifies the maximum age of a thread. Must be
+ in the form old(<delay>) where <delay> specifies
+ the age in seconds (s), hours (h), days (d),
+ weeks(w), or years (y) like 24h or 5d. Default is
+ old(24h).
+ counter The current value of a counter which could be assigned as
+ variable. Will be actualized by bot. Initial value is 1.
+ maxarchivesize The maximum archive size before incrementing the counter.
+ Value can be given with appending letter like K or M
+ which indicates KByte or MByte. Default value is 1000M.
+ minthreadsleft Minimum number of threads that should be left on a page.
+ Default value is 5.
+ minthreadstoarchive The minimum number of threads to archive at once. Default
+ value is 2.
+ archiveheader Content that will be put on new archive pages as the
+ header. This parameter supports the use of variables.
+ Default value is {{talkarchive}}
+ key A secret key that (if valid) allows archives to not be
+ subpages of the page being archived.
Variables below can be used in the value for "archive" in the template above:
@@ -77,6 +77,7 @@
- https://docs.python.org/3.4/library/datetime.html#datetime.date.isocalendar
Options (may be omitted):
+
-help show this help message and exit
-calc:PAGE calculate key for PAGE and exit
-file:FILE load list of pages from FILE
diff --git a/scripts/basic.py b/scripts/basic.py
index b532e2a..befec04 100755
--- a/scripts/basic.py
+++ b/scripts/basic.py
@@ -62,6 +62,7 @@
used is placed on /i18n subdirectory. The file containing these
messages should have the same name as the caller script (i.e. basic.py
in this case). Use summary_key to set a default edit summary message.
+
@type summary_key: str
"""
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index f48eb75..1ed9115 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -7,7 +7,8 @@
remove the warning! This script is useful if you want to remove those useless
warning left in these pages.
-Parameters:
+Parameters
+----------
These command line parameters can be used to specify which pages to work on:
diff --git a/scripts/category.py b/scripts/category.py
index 1aade2f..7fec876 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -27,6 +27,7 @@
¶ms;
Options for "listify" action:
+
* -overwrite - This overwrites the current page with the list even if
something is already there.
* -showimages - This displays images rather than linking them in the list.
@@ -34,12 +35,14 @@
listified in addition to the pages themselves.
Options for "remove" action:
+
* -nodelsum - This specifies not to use the custom edit summary as the
deletion reason. Instead, it uses the default deletion reason
for the language, which is "Category was disbanded" in
English.
Options for "move" action:
+
* -hist - Creates a nice wikitable on the talk page of target category
that contains detailed page history of the source category.
* -nodelete - Don't delete the old category after move
@@ -55,12 +58,14 @@
option.
Options for "tidy" action:
+
* -namespaces Filter the arcitles in the specified namespaces. Separate
-namespace multiple namespace numbers or names with commas. Examples:
-ns -ns:0,2,4
-ns:Help,MediaWiki
Options for several actions:
+
* -rebuild - reset the database
* -from: - The category to move from (for the move option)
Also, the category to remove from in the remove option
@@ -91,16 +96,15 @@
For example, to create a new category from a list of persons, type:
- python pwb.py category add -person
+ python pwb.py category add -person
and follow the on-screen instructions.
Or to do it all from the command-line, use the following syntax:
- python pwb.py category move -from:US -to:"United States"
+ python pwb.py category move -from:US -to:"United States"
This will move all pages in the category US to the category United States.
-
"""
#
# (C) Rob W.W. Hooft, 2004
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 3beb321..c6e5456 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -52,10 +52,10 @@
-nologerror If given, this option will disable the error that is risen
when the log is full.
----- Instructions for the real-time settings ----
-* For every new block you have to add:
+Instructions for the real-time settings.
+For every new block you have to add:
-<------- ------->
+ <------- ------->
In this way the Bot can understand where the block starts in order to take the
right parameter.
@@ -69,7 +69,8 @@
* Text= This is the template that the bot will use when it will report the
image's problem.
----- Known issues/FIXMEs: ----
+Todo
+----
* Clean the code, some passages are pretty difficult to understand.
* Add the "catch the language" function for commons.
* Fix and reorganise the new documentation
diff --git a/scripts/delete.py b/scripts/delete.py
index 57e99fe..4e197a4 100755
--- a/scripts/delete.py
+++ b/scripts/delete.py
@@ -42,7 +42,8 @@
python pwb.py delete [-category categoryName]
-Examples:
+Examples
+--------
Delete everything in the category "To delete" without prompting.
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index 3ef2fb2..83c21ba 100755
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -4,24 +4,25 @@
Tool to copy a flickr stream to Commons.
# Get a set to work on (start with just a username).
-# * Make it possible to delimit the set (from/to)
-#For each image
-#*Check the license
-#*Check if it isn't already on Commons
-#*Build suggested filename
-#**Check for name collision and maybe alter it
-#*Pull description from Flinfo
-#*Show image and description to user
-#**Add a nice hotcat lookalike for the adding of categories
-#**Filter the categories
-#*Upload the image
+ * Make it possible to delimit the set (from/to)
+# For each image
+ * Check the license
+ * Check if it isn't already on Commons
+ * Build suggested filename
+ * Check for name collision and maybe alter it
+ * Pull description from Flinfo
+ * Show image and description to user
+ * Add a nice hotcat lookalike for the adding of categories
+ * Filter the categories
+ * Upload the image
-Todo:
-*Check if the image is already uploaded (SHA hash)
-*Check and prevent filename collisions
-**Initial suggestion
-**User input
-*Filter the categories
+Todo
+----
+* Check if the image is already uploaded (SHA hash)
+* Check and prevent filename collisions
+ * Initial suggestion
+ * User input
+* Filter the categories
"""
#
# (C) Multichill, 2009
diff --git a/scripts/image.py b/scripts/image.py
index e265598..b3315b0 100755
--- a/scripts/image.py
+++ b/scripts/image.py
@@ -24,7 +24,8 @@
more mistakes. This only works with image replacement, not image
removal.
-Examples:
+Examples
+--------
The image "FlagrantCopyvio.jpg" is about to be deleted, so let's first remove
it from everything that displays it:
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index c37fb0d..b1a1eb0 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -33,25 +33,25 @@
Work on a single image::
- python pwb.py imagecopy.py -page:Image:<imagename>
+ python pwb.py imagecopy.py -page:Image:<imagename>
Work on the 100 newest images::
- python pwb.py imagecopy.py -newimages:100
+ python pwb.py imagecopy.py -newimages:100
Work on all images in a category:<cat>::
- python pwb.py imagecopy.py -cat:<cat>
+ python pwb.py imagecopy.py -cat:<cat>
Work on all images which transclude a template::
- python pwb.py imagecopy.py -transcludes:<template>
+ python pwb.py imagecopy.py -transcludes:<template>
Work on a single image and deletes the image when the transfer is complete
(only works if the user has sysops privilege, otherwise it will be marked for
deletion)::
- python pwb.py imagecopy.py -page:Image:<imagename> -delete
+ python pwb.py imagecopy.py -page:Image:<imagename> -delete
By default the bot works on your home wiki (set in user-config)
"""
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 5e03fd2..39a2ae0 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -307,21 +307,21 @@
Some configuration option can be used to change the working of this bot:
-interwiki_min_subjects: the minimum amount of subjects that should be processed
- at the same time.
+ interwiki_min_subjects: the minimum amount of subjects that should be
+ processed at the same time.
-interwiki_backlink: if set to True, all problems in foreign wikis will
- be reported
+ interwiki_backlink: if set to True, all problems in foreign wikis will
+ be reported
-interwiki_shownew: should interwiki.py display every new link it discovers?
+ interwiki_shownew: should interwiki.py display every new link it discovers?
-interwiki_graph: output a graph PNG file on conflicts? You need pydot for
- this: https://pypi.python.org/pypi/pydot/1.0.2
- https://code.google.com/p/pydot/
+ interwiki_graph: output a graph PNG file on conflicts? You need pydot for
+ this: https://pypi.python.org/pypi/pydot/1.0.2
+ https://code.google.com/p/pydot/
-interwiki_graph_format: the file format for interwiki graphs
+ interwiki_graph_format: the file format for interwiki graphs
-without_interwiki: save file with local articles without interwikis
+ without_interwiki: save file with local articles without interwikis
All these options can be changed through the user-config.py configuration file.
@@ -678,6 +678,7 @@
@ivar tree: dictionary with Site as keys and list of page as values.
All pages found within Site are kept in self.tree[site].
+
@type tree: dict
"""
self.tree = {}
diff --git a/scripts/listpages.py b/scripts/listpages.py
index 1a7a5e6..4214409 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -66,7 +66,7 @@
translation key.
Custom format can be applied to the following items extrapolated from a
- page object:
+page object:
site: obtained from page._link._site.
diff --git a/scripts/maintenance/make_i18n_dict.py b/scripts/maintenance/make_i18n_dict.py
index 1ceb233..132cbe5 100755
--- a/scripts/maintenance/make_i18n_dict.py
+++ b/scripts/maintenance/make_i18n_dict.py
@@ -3,8 +3,6 @@
"""
Generate a i18n file from a given script.
-usage:
-
run IDLE at topmost level:
>>> import pwb
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index 538a515..9dcbd38 100755
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -33,12 +33,15 @@
-replaceonly Use this if you do not have a local sysop account, but do
wish to replace links from the NowCommons template.
--- Example --
+Example
+-------
python pwb.py nowcommons -replaceonly -replaceloose -replacealways -replace
--- Known issues --
+Todo
+----
Please fix these if you are capable and motivated:
+
- if a file marked nowcommons is not present on Wikimedia Commons, the bot
will exit.
"""
diff --git a/scripts/protect.py b/scripts/protect.py
index dc66338..8171dd7 100755
--- a/scripts/protect.py
+++ b/scripts/protect.py
@@ -38,7 +38,8 @@
Usage: python protect.py <OPTIONS>
-Examples:
+Examples
+--------
Protect everything in the category 'To protect' prompting.
diff --git a/scripts/replace.py b/scripts/replace.py
index ddaea1b..f281e77 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -76,8 +76,10 @@
it'll ask for additional replacements at start.
-pairsfile Lines from the given file name(s) will be read as replacement
- arguments. i.e. a file containing lines "a" and "b", used as
- python pwb.py replace -page:X -pairsfile:file c d
+ arguments. i.e. a file containing lines "a" and "b", used as:
+
+ python pwb.py replace -page:X -pairsfile:file c d
+
will replace 'a' with 'b' and 'c' with 'd'.
-always Don't prompt you for each replacement
@@ -97,7 +99,8 @@
It is possible to introduce more than one pair of old text
and replacement.
-Examples:
+Examples
+--------
If you want to change templates from the old syntax, e.g. {{msg:Stub}}, to the
new syntax, e.g. {{Stub}}, download an XML dump file (pages-articles) from
diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index 72bd12b..9037131 100755
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -7,7 +7,7 @@
python pwb.py replicate_wiki [-r] -ns 10 -family:wikipedia -o nl li fy
-or
+or:
python pwb.py replicate_wiki [-r] -ns 10 -family:wikipedia -lang:nl li fy
@@ -18,27 +18,25 @@
You can add replicate_replace to your user-config.py, which has the following
format:
-replicate_replace = {
- 'wikipedia:li': {'Hoofdpagina': 'Veurblaad'}
-}
+ replicate_replace = {
+ 'wikipedia:li': {'Hoofdpagina': 'Veurblaad'}
+ }
to replace all occurrences of 'Hoofdpagina' with 'Veurblaad' when writing to
liwiki. Note that this does not take the origin wiki into account.
The following parameters are supported:
--r actually replace pages (without this option
---replace you will only get an overview page)
--o original wiki
---original (you may use -lang:<code> option instead)
+-r, --replace actually replace pages (without this option
+ you will only get an overview page)
-destination_wiki destination wiki(s)
+-o, --original original wiki (you may use -lang:<code> option
+ instead)
+-ns, --namespace specify namespace
--ns specify namespace
---namespace
+-dns, --dest-namespace destination namespace (if different)
--dns destination namespace (if different)
---dest-namespace
+ destination_wiki destination wiki(s)
"""
#
# (C) Kasper Souren, 2012-2013
diff --git a/scripts/table2wiki.py b/scripts/table2wiki.py
index a4a8379..5eb40ab 100644
--- a/scripts/table2wiki.py
+++ b/scripts/table2wiki.py
@@ -26,7 +26,7 @@
Example:
- pwb.py table2wiki -xml:20050713_pages_current.xml -lang:de
+ python pwb.py table2wiki -xml:20050713_pages_current.xml -lang:de
FEATURES
Save against missing </td>
diff --git a/scripts/template.py b/scripts/template.py
index ca51b7d..b04dd38 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -58,7 +58,8 @@
If you want to address a template which has spaces, put quotation
marks around it, or use underscores.
-Examples:
+Examples
+--------
If you have a template called [[Template:Cities in Washington]] and want to
change it to [[Template:Cities in Washington state]], start
diff --git a/scripts/templatecount.py b/scripts/templatecount.py
index 6756267..b31d22f 100755
--- a/scripts/templatecount.py
+++ b/scripts/templatecount.py
@@ -19,7 +19,8 @@
-namespace: Filters the search to a given namespace. If this is specified
multiple times it will search all given namespaces
-Examples:
+Examples
+--------
Counts how many times {{ref}} and {{note}} are transcluded in articles:
diff --git a/scripts/transferbot.py b/scripts/transferbot.py
index f6d2ee3..e1f9b5d 100755
--- a/scripts/transferbot.py
+++ b/scripts/transferbot.py
@@ -20,7 +20,8 @@
¶ms;
-Example commands:
+Examples
+--------
Transfer all pages in category "Query service" from the English Wikipedia to
the Arabic Wiktionary, adding "Wiktionary:Import enwp/" as prefix:
diff --git a/scripts/upload.py b/scripts/upload.py
index db13900..b98bb2a 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -16,11 +16,13 @@
-chunked: Upload the file in chunks (more overhead, but restartable). If
no value is specified the chunk size is 1 MiB. The value must
be a number which can be preceded by a suffix. The units are:
- No suffix: Bytes
- 'k': Kilobytes (1000 B)
- 'M': Megabytes (1000000 B)
- 'Ki': Kibibytes (1024 B)
- 'Mi': Mebibytes (1024x1024 B)
+
+ No suffix: Bytes
+ 'k': Kilobytes (1000 B)
+ 'M': Megabytes (1000000 B)
+ 'Ki': Kibibytes (1024 B)
+ 'Mi': Mebibytes (1024x1024 B)
+
The suffixes are case insensitive.
-always Don't ask the user anything. This will imply -keep and
-noverify and require that either -abortonwarn or -ignorewarn
diff --git a/scripts/watchlist.py b/scripts/watchlist.py
index cde0c03..3da8e4a 100755
--- a/scripts/watchlist.py
+++ b/scripts/watchlist.py
@@ -10,6 +10,7 @@
python pwb.py watchlist [-all | -new]
Command line options:
+
-all - Reloads watchlists for all wikis where a watchlist is already
present
-new - Load watchlists for all wikis where accounts is setting in
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index ce018a2..71bccd1 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -63,7 +63,7 @@
The following config variables are supported:
-max_external_links - The maximum number of web pages that should be
+ max_external_links The maximum number of web pages that should be
loaded simultaneously. You should change this
according to your Internet connection speed.
Be careful: if it is set too high, the script
@@ -71,12 +71,12 @@
is congested, and will then think that the page
is offline.
-report_dead_links_on_talk - If set to true, causes the script to report dead
+ report_dead_links_on_talk If set to true, causes the script to report dead
links on the article's talk page if (and ONLY if)
the linked page has been unavailable at least two
times during a timespan of at least one week.
-weblink_dead_days - sets the timespan (default: one week) after which
+ weblink_dead_days sets the timespan (default: one week) after which
a dead link will be reported
Syntax examples:
@@ -640,12 +640,12 @@
Example:
- dict = {
- 'https://www.example.org/page': [
- ('WikiPageTitle', DATE, '404: File not found'),
- ('WikiPageName2', DATE, '404: File not found'),
- ]
-
+ dict = {
+ 'https://www.example.org/page': [
+ ('WikiPageTitle', DATE, '404: File not found'),
+ ('WikiPageName2', DATE, '404: File not found'),
+ ]
+ }
"""
def __init__(self, reportThread, site=None):
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 1490051..cc78f4e 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-u"""
+"""
Script to welcome new users.
This script works out of the box for Wikis that
@@ -13,19 +13,20 @@
indicated by comments.
Description of basic functionality:
-* Request a list of new users every period (default: 3600 seconds)
- You can choose to break the script after the first check (see arguments)
-* Check if new user has passed a threshold for a number of edits
- (default: 1 edit)
-* Optional: check username for bad words in the username or if the username
- consists solely of numbers; log this somewhere on the wiki (default: False)
- Update: Added a whitelist (explanation below).
-* If user has made enough edits (it can be also 0), check if user has an empty
- talk page
-* If user has an empty talk page, add a welcome message.
-* Optional: Once the set number of users have been welcomed, add this to the
- configured log page, one for each day (default: True)
-* If no log page exists, create a header for the log page first.
+
+ * Request a list of new users every period (default: 3600 seconds)
+ You can choose to break the script after the first check (see arguments)
+ * Check if new user has passed a threshold for a number of edits
+ (default: 1 edit)
+ * Optional: check username for bad words in the username or if the username
+ consists solely of numbers; log this somewhere on the wiki (default: False)
+ Update: Added a whitelist (explanation below).
+ * If user has made enough edits (it can be also 0), check if user has an empty
+ talk page
+ * If user has an empty talk page, add a welcome message.
+ * Optional: Once the set number of users have been welcomed, add this to the
+ configured log page, one for each day (default: True)
+ * If no log page exists, create a header for the log page first.
This script (by default not yet implemented) uses two templates that need to
be on the local wiki:
@@ -96,6 +97,7 @@
recheck in the bad word list to see if there are other badword in the
username.
Example:
+
* dio is a badword
* Claudio is a normal name
* The username is "Claudio90 fuck!"
@@ -109,6 +111,7 @@
* You can decide to put a "you are blocked, change another username"
template or not.
* Delete the username from the page.
+
IMPORTANT : The Bot check the user in this order:
* Search if he has a talkpage (if yes, skip)
* Search if he's blocked, if yes he will be skipped
@@ -125,8 +128,8 @@
1) Set the page that the bot will load
2) Add the signatures in this way:
-*<SPACE>SIGNATURE
-<NEW LINE>
+ *<SPACE>SIGNATURE
+ <NEW LINE>
Example:
<pre>
diff --git a/scripts/wikisourcetext.py b/scripts/wikisourcetext.py
index 30b2cc5..d9bd119 100644
--- a/scripts/wikisourcetext.py
+++ b/scripts/wikisourcetext.py
@@ -14,10 +14,9 @@
In this case, also already existing pages with quality value 'Not Proofread'
can be treated. '-force' will override existing page in this case.
-The following parameters are supported:
-
# TODO: update params + handle quality level
+The following parameters are supported:
-index:... name of the index page
diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py
index f79cd4b..d1efe6d 100644
--- a/tests/archivebot_tests.py
+++ b/tests/archivebot_tests.py
@@ -242,19 +242,19 @@
Talk:For-pywikibot-archivebot must have:
- {{User:MiszaBot/config
- |archive = Talk:Main_Page/archive
- |algo = old(30d)
- }}
- <!-- normal comments -->
- == A ==
- foo bar
- <!--
- == Z ==
- foo bar bar
- -->
- == B ==
- foo bar bar bar
+ {{User:MiszaBot/config
+ |archive = Talk:Main_Page/archive
+ |algo = old(30d)
+ }}
+ <!-- normal comments -->
+ == A ==
+ foo bar
+ <!--
+ == Z ==
+ foo bar bar
+ -->
+ == B ==
+ foo bar bar bar
"""
page = pywikibot.Page(self.get_site(), 'Talk:For-pywikibot-archivebot')
archiver = archivebot.PageArchiver(
--
To view, visit https://gerrit.wikimedia.org/r/427304
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I75973748aaaf427f58a54f09f6ba762dd5bcfb32
Gerrit-Change-Number: 427304
Gerrit-PatchSet: 80
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
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 <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/427616 )
Change subject: [i18n] rename positional argument of _altlang from "code" to "lang"
......................................................................
[i18n] rename positional argument of _altlang from "code" to "lang"
rename positional argument of _altlang from "code" to "lang" because
i18n uses language code instead of site code by default
Change-Id: Ie1d2a3f06ae594537561b9b5d03252635c6ac53b
---
M pywikibot/i18n.py
1 file changed, 82 insertions(+), 82 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 282f4ef..22be4a2 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -89,7 +89,7 @@
return True
-def _altlang(code):
+def _altlang(lang):
"""Define fallback languages for particular languages.
If no translation is available to a specified language, translate() will
@@ -101,207 +101,207 @@
This code is used by other translating methods below.
- @param code: The language code
- @type code: string
+ @param lang: The language code
+ @type lang: string
@return: language codes
@rtype: list of str
"""
# Akan
- if code in ['ak', 'tw']:
+ if lang in ['ak', 'tw']:
return ['ak', 'tw']
# Amharic
- if code in ['aa', 'ti']:
+ if lang in ['aa', 'ti']:
return ['am']
# Arab
- if code in ['arc', 'arz', 'so']:
+ if lang in ['arc', 'arz', 'so']:
return ['ar']
- if code == 'kab':
+ if lang == 'kab':
return ['ar', 'fr']
# Bulgarian
- if code in ['cu', 'mk']:
+ if lang in ['cu', 'mk']:
return ['bg', 'sr', 'sh']
# Czech
- if code in ['cs', 'sk']:
+ if lang in ['cs', 'sk']:
return ['cs', 'sk']
# German
- if code in ['bar', 'frr', 'ksh', 'pdc', 'pfl']:
+ if lang in ['bar', 'frr', 'ksh', 'pdc', 'pfl']:
return ['de']
- if code == 'lb':
+ if lang == 'lb':
return ['de', 'fr']
- if code in ['als', 'gsw']:
+ if lang in ['als', 'gsw']:
return ['als', 'gsw', 'de']
- if code == 'nds':
+ if lang == 'nds':
return ['nds-nl', 'de']
- if code in ['dsb', 'hsb']:
+ if lang in ['dsb', 'hsb']:
return ['hsb', 'dsb', 'de']
- if code == 'sli':
+ if lang == 'sli':
return ['de', 'pl']
- if code == 'rm':
+ if lang == 'rm':
return ['de', 'it']
- if code == 'stq':
+ if lang == 'stq':
return ['nds', 'de']
# Greek
- if code in ['grc', 'pnt']:
+ if lang in ['grc', 'pnt']:
return ['el']
# Esperanto
- if code in ['io', 'nov']:
+ if lang in ['io', 'nov']:
return ['eo']
# Spanish
- if code in ['an', 'arn', 'ast', 'ay', 'ext', 'lad', 'nah', 'nv', 'qu',
+ if lang in ['an', 'arn', 'ast', 'ay', 'ext', 'lad', 'nah', 'nv', 'qu',
'yua']:
return ['es']
- if code == 'ca':
+ if lang == 'ca':
return ['oc', 'es']
- if code in ['gl', 'gn']:
+ if lang in ['gl', 'gn']:
return ['es', 'pt']
- if code == 'eu':
+ if lang == 'eu':
return ['es', 'fr']
- if code == 'cbk-zam':
+ if lang == 'cbk-zam':
return ['es', 'tl']
# Estonian
- if code in ['fiu-vro', 'vro']:
+ if lang in ['fiu-vro', 'vro']:
return ['fiu-vro', 'vro', 'et']
- if code == 'liv':
+ if lang == 'liv':
return ['et', 'lv']
# Persian (Farsi)
- if code in ['azb', 'lrc', 'ps']:
+ if lang in ['azb', 'lrc', 'ps']:
return ['fa']
- if code in ['glk', 'mzn']:
+ if lang in ['glk', 'mzn']:
return ['glk', 'mzn', 'fa', 'ar']
# Finnish
- if code == 'vep':
+ if lang == 'vep':
return ['et', 'fi', 'ru']
- if code == 'fit':
+ if lang == 'fit':
return ['fi', 'sv']
- if code == 'olo':
+ if lang == 'olo':
return ['fi']
# French
- if code in ['atj', 'bm', 'br', 'ff', 'ht', 'kbp', 'kg', 'ln', 'mg', 'nrm',
+ if lang in ['atj', 'bm', 'br', 'ff', 'ht', 'kbp', 'kg', 'ln', 'mg', 'nrm',
'pcd', 'rw', 'sg', 'ty', 'wa', 'wo']:
return ['fr']
- if code == 'oc':
+ if lang == 'oc':
return ['fr', 'ca', 'es']
- if code in ['co', 'frp']:
+ if lang in ['co', 'frp']:
return ['fr', 'it']
# Hindi
- if code in ['mai', 'sa']:
+ if lang in ['mai', 'sa']:
return ['hi']
- if code in ['ne', 'new']:
+ if lang in ['ne', 'new']:
return ['ne', 'new', 'hi']
- if code == 'dty':
+ if lang == 'dty':
return ['ne']
- if code in ['bh', 'bho']:
+ if lang in ['bh', 'bho']:
return ['bh', 'bho']
# Indonesian and Malay
- if code in ['ace', 'bug', 'bjn', 'id', 'jv', 'ms', 'su']:
+ if lang in ['ace', 'bug', 'bjn', 'id', 'jv', 'ms', 'su']:
return ['id', 'ms', 'jv']
- if code == 'map-bms':
+ if lang == 'map-bms':
return ['jv', 'id', 'ms']
- if code == 'min':
+ if lang == 'min':
return ['id']
# Inuit languages
- if code in ['ik', 'iu']:
+ if lang in ['ik', 'iu']:
return ['iu', 'kl']
- if code == 'kl':
+ if lang == 'kl':
return ['da', 'iu', 'no', 'nb']
# Italian
- if code in ['eml', 'fur', 'lij', 'lmo', 'nap', 'pms', 'roa-tara', 'sc',
+ if lang in ['eml', 'fur', 'lij', 'lmo', 'nap', 'pms', 'roa-tara', 'sc',
'scn', 'vec']:
return ['it']
# Lithuanian
- if code in ['bat-smg', 'sgs']:
+ if lang in ['bat-smg', 'sgs']:
return ['bat-smg', 'sgs', 'lt']
# Latvian
- if code == 'ltg':
+ if lang == 'ltg':
return ['lv']
# Dutch
- if code in ['af', 'fy', 'li', 'pap', 'srn', 'vls', 'zea']:
+ if lang in ['af', 'fy', 'li', 'pap', 'srn', 'vls', 'zea']:
return ['nl']
- if code == 'nds-nl':
+ if lang == 'nds-nl':
return ['nds', 'nl']
# Polish
- if code in ['csb', 'szl']:
+ if lang in ['csb', 'szl']:
return ['pl']
# Portuguese
- if code in ['fab', 'mwl', 'tet']:
+ if lang in ['fab', 'mwl', 'tet']:
return ['pt']
# Romanian
- if code in ['roa-rup', 'rup']:
+ if lang in ['roa-rup', 'rup']:
return ['roa-rup', 'rup', 'ro']
- if code in ['mo', 'rmy']:
+ if lang in ['mo', 'rmy']:
return ['ro']
# Russian and Belarusian
- if code in ['ab', 'av', 'ba', 'bxr', 'ce', 'cv', 'inh', 'kk', 'koi', 'krc',
+ if lang in ['ab', 'av', 'ba', 'bxr', 'ce', 'cv', 'inh', 'kk', 'koi', 'krc',
'kv', 'ky', 'lbe', 'lez', 'mdf', 'mhr', 'mn', 'mrj', 'myv',
'os', 'sah', 'tg', 'tyv', 'udm', 'uk', 'xal']:
return ['ru']
- if code in ['kbd', 'ady']:
+ if lang in ['kbd', 'ady']:
return ['kbd', 'ady', 'ru']
- if code == 'tt':
+ if lang == 'tt':
return ['tt-cyrl', 'ru']
- if code in ['be', 'be-tarask']:
+ if lang in ['be', 'be-tarask']:
return ['be', 'be-tarask', 'ru']
- if code == 'kaa':
+ if lang == 'kaa':
return ['uz', 'ru']
# Serbocroatian
- if code in ['bs', 'hr', 'sh']:
+ if lang in ['bs', 'hr', 'sh']:
return ['sh', 'hr', 'bs', 'sr', 'sr-el']
- if code == 'sr':
+ if lang == 'sr':
return ['sr-el', 'sh', 'hr', 'bs']
# Tagalog
- if code in ['bcl', 'ceb', 'ilo', 'pag', 'pam', 'war']:
+ if lang in ['bcl', 'ceb', 'ilo', 'pag', 'pam', 'war']:
return ['tl']
# Turkish and Kurdish
- if code in ['diq', 'ku']:
+ if lang in ['diq', 'ku']:
return ['ku', 'ku-latn', 'tr']
- if code == 'gag':
+ if lang == 'gag':
return ['tr']
- if code == 'ckb':
+ if lang == 'ckb':
return ['ku']
# Ukrainian
- if code in ['crh', 'crh-latn']:
+ if lang in ['crh', 'crh-latn']:
return ['crh', 'crh-latn', 'uk', 'ru']
- if code in ['rue']:
+ if lang in ['rue']:
return ['uk', 'ru']
# Chinese
- if code in ['zh-classical', 'lzh', 'minnan', 'nan', 'zh-tw',
+ if lang in ['zh-classical', 'lzh', 'minnan', 'nan', 'zh-tw',
'zh', 'zh-hans']:
return ['zh', 'zh-hans', 'zh-tw', 'zh-cn', 'zh-classical', 'lzh']
- if code == 'zh-min-nan':
+ if lang == 'zh-min-nan':
return ['cdo', 'zh', 'zh-hans', 'zh-tw', 'zh-cn', 'zh-classical',
'lzh']
- if code in ['cdo', 'gan', 'hak', 'ii', 'wuu', 'za', 'zh-classical', 'lzh',
+ if lang in ['cdo', 'gan', 'hak', 'ii', 'wuu', 'za', 'zh-classical', 'lzh',
'zh-cn', 'zh-yue', 'yue']:
return ['zh', 'zh-hans' 'zh-cn', 'zh-tw', 'zh-classical', 'lzh']
# Scandinavian languages
- if code in ['da', 'sv']:
+ if lang in ['da', 'sv']:
return ['da', 'no', 'nb', 'sv', 'nn']
- if code in ['fo', 'is']:
+ if lang in ['fo', 'is']:
return ['da', 'no', 'nb', 'nn', 'sv']
- if code == 'nn':
+ if lang == 'nn':
return ['no', 'nb', 'sv', 'da']
- if code in ['no', 'nb']:
+ if lang in ['no', 'nb']:
return ['no', 'nb', 'da', 'nn', 'sv']
- if code == 'se':
+ if lang == 'se':
return ['sv', 'no', 'nb', 'nn', 'fi']
# Other languages
- if code in ['bi', 'tpi']:
+ if lang in ['bi', 'tpi']:
return ['bi', 'tpi']
- if code == 'yi':
+ if lang == 'yi':
return ['he', 'de']
- if code in ['ia', 'ie']:
+ if lang in ['ia', 'ie']:
return ['ia', 'la', 'it', 'fr', 'es']
- if code == 'xmf':
+ if lang == 'xmf':
return ['ka']
- if code in ['nso', 'st']:
+ if lang in ['nso', 'st']:
return ['st', 'nso']
- if code in ['kj', 'ng']:
+ if lang in ['kj', 'ng']:
return ['kj', 'ng']
- if code in ['meu', 'hmo']:
+ if lang in ['meu', 'hmo']:
return ['meu', 'hmo']
- if code in ['as', 'bpy']:
+ if lang in ['as', 'bpy']:
return ['bn']
- if code == 'tcy':
+ if lang == 'tcy':
return ['kn']
# Default value
return []
--
To view, visit https://gerrit.wikimedia.org/r/427616
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie1d2a3f06ae594537561b9b5d03252635c6ac53b
Gerrit-Change-Number: 427616
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/427663 )
Change subject: [compat] Update conversion description
......................................................................
[compat] Update conversion description
Old compat modules catlib, userlib and query could be easily replaced
by its core equivalent. There is no need to use our compat module.
See also the deprecation warning for these replacements.
Bug: T183085
Change-Id: I9acb38602a2bdca2e21c8bcd30166227577714fe
---
M README-conversion.txt
1 file changed, 4 insertions(+), 3 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README-conversion.txt b/README-conversion.txt
index d89dec1..1d17d22 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -29,9 +29,10 @@
change "import wikipedia" to "import pywikibot"
change "import pagegenerators" to "from pywikibot import pagegenerators"
change "import config" to "from pywikibot import config"
- change "import catlib" to "from pywikibot.compat import catlib"
- change "import query" to "from pywikibot.compat import query"
- change "import userlib" to "from pywikibot.compat import userlib"
+ change "catlib.Category" to "pywikibot.Category"
+ change "catlib.change_category(page, ...)" to "page.change_category(...)"
+ change "query.GetData(request)" to "pywikibot.data.api.request(**request).submit()"
+ change "userlib.User" to "pywikibot.User"
change "wikipedia." to "pywikibot."
wikipedia.setAction() no longer works; you must revise the script to pass an
--
To view, visit https://gerrit.wikimedia.org/r/427663
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I9acb38602a2bdca2e21c8bcd30166227577714fe
Gerrit-Change-Number: 427663
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>