jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[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 &params; 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(-)

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 == '&params;':
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 == '&params;':
+ 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 @@
&params;

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 @@

&params;

-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 change 427304. To unsubscribe, visit 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@seznam.cz>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot <>