jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1083761?usp=email )
Change subject: [cleanup] remove -repository option which was never implemented in core
......................................................................
[cleanup] remove -repository option which was never implemented in core
Change-Id: Iddc89be2f5127c9965b78639728deb6e169344b6
---
M scripts/interwiki.py
1 file changed, 6 insertions(+), 9 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index de206ac..6b02cd5 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -171,8 +171,6 @@
above for the format, one can for example give
"en:something" or "20:" as hint.
--repository Include data repository
-
-same Looks over all 'serious' languages for the same title.
``-same`` is equivalent to ``-hint:all``.
@@ -566,10 +564,11 @@
elif arg == 'lack':
self.lacklanguage, _, minlinks = value.partition(':')
self.minlinks = int(minlinks or 1)
- elif arg in ('cleanup', 'confirm', 'force', 'hintnobracket',
- 'hintsareright', 'initialredirect', 'localonly', 'quiet',
- 'repository', 'same', 'select', 'skipauto',
- 'untranslated'):
+ elif arg in (
+ 'cleanup', 'confirm', 'force', 'hintnobracket', 'hintsareright',
+ 'initialredirect', 'localonly', 'quiet', 'same', 'select',
+ 'skipauto', 'untranslated',
+ ):
assert hasattr(self, arg)
assert value == ''
setattr(self, arg, True)
@@ -643,8 +642,7 @@
"""
def __init__(self, origin=None, hints=None, conf=None) -> None:
- """
- Initializer.
+ """Initializer.
Takes as arguments the Page on the home wiki
plus optionally a list of hints for translation
@@ -653,7 +651,6 @@
super().__init__(origin)
- self.repoPage = None
# todo is a list of all pages that still need to be analyzed.
# Mark the origin page as todo.
self.todo = SizedKeyCollection('site')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1083761?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iddc89be2f5127c9965b78639728deb6e169344b6
Gerrit-Change-Number: 1083761
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1083432?usp=email )
Change subject: [doc] solve some sphinx warnings
......................................................................
[doc] solve some sphinx warnings
Change-Id: Ic51f0fda375995456759f1a332347b44f133105e
---
M docs/conf.py
M scripts/checkimages.py
M scripts/coordinate_import.py
M scripts/image.py
M scripts/imagetransfer.py
M scripts/interwiki.py
M scripts/interwikidata.py
M scripts/listpages.py
M scripts/movepages.py
M scripts/pagefromfile.py
M scripts/replicate_wiki.py
M scripts/template.py
M scripts/touch.py
M scripts/unusedfiles.py
M scripts/upload.py
M scripts/watchlist.py
M scripts/welcome.py
17 files changed, 674 insertions(+), 604 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/docs/conf.py b/docs/conf.py
index e36ab8f..6f2432e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -565,7 +565,7 @@
if match:
opt, sp, desc = match.groups()
desc = re.sub(r'\[(float|int|str)\]', r'*(\1)*', desc)
- if ':' in opt or ' ' in opt:
+ if ':' in opt or ' ' in opt and ', ' not in opt:
length = len(opt + sp)
lines[index] = f':kbd:`{opt}`'
else:
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 5c7077e..6dd9bed 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -4,68 +4,72 @@
This script checks if a file description is present and if there are
other problems in the image's description.
-This script will have to be configured for each language. Please submit
-translations as addition to the Pywikibot framework.
+This script will have to be configured for each site. Please submit
+localisations as addition to the Pywikibot framework.
Everything that needs customisation is indicated by comments.
This script understands the following command-line arguments:
--limit The number of images to check (default: 80)
+-limit [int] The number of images to check (default: 80)
--commons The bot will check if an image on Commons has the same name
- and if true it reports the image.
+-commons The bot will check if an image on Commons has the
+ same name and if true it reports the image.
--duplicates[:#] Checking if the image has duplicates (if arg, set how many
- rollback wait before reporting the image in the report
- instead of tag the image) default: 1 rollback.
+-duplicates[:#] Checking if the image has duplicates (if arg, set how
+ many rollback wait before reporting the image in the
+ report instead of tag the image) default: 1 rollback.
--duplicatesreport Report the duplicates in a log *AND* put the template in
- the images.
+-duplicatesreport Report the duplicates in a log *AND* put the template
+ in the images.
--maxusernotify Maximum notifications added to a user talk page in a single
- check, to avoid email spamming.
+-maxusernotify Maximum notifications added to a user talk page in a
+ single check, to avoid email spamming.
--sendemail Send an email after tagging.
+-sendemail Send an email after tagging.
--break To break the bot after the first check (default: recursive)
+-break To break the bot after the first check (default:
+ recursive)
--sleep[:#] Time in seconds between repeat runs (default: 30)
+-sleep[:#] Time in seconds between repeat runs (default: 30)
--wait[:#] Wait x second before check the images (default: 0)
+-wait[:#] Wait x second before check the images (default: 0)
--skip[:#] The bot skip the first [:#] images (default: 0)
+-skip[:#] The bot skip the first [:#] images (default: 0)
--start[:#] Use allimages() as generator
- (it starts already from File:[:#])
+-start[:#] Use allimages() as generator (it starts already from
+ File:[:#])
--cat[:#] Use a category as generator
+-cat[:#] Use a category as generator
--regex[:#] Use regex, must be used with -url or -page
+-regex[:#] Use regex, must be used with ``-url`` or ``-page``
--page[:#] Define the name of the wikipage where are the images
+-page[:#] Define the name of the wikipage where are the images
--url[:#] Define the url where are the images
+-url[:#] Define the url where are the images
--nologerror If given, this option will disable the error that is risen
- when the log is full.
+-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.
+ <------- ------->
-* Name= Set the name of the block
-* Find= search this text in the image's description
-* Findonly= search for exactly this text in the image's description
-* Summary= That's the summary that the bot will use when it will notify the
- problem.
-* Head= That's the incipit that the bot will use for the message.
-* Text= This is the template that the bot will use when it will report the
- image's problem.
+In this way the bot can understand where the block starts in order to
+take the right parameter:
+
+.. code:: text
+
+ Name= Set the name of the block
+ Find= search this text in the image's description
+ Findonly= search for exactly this text in the image's description
+ Summary= That's the summary that the bot will use when it will
+ notify the problem.
+ Head= That's the incipit that the bot will use for the message.
+ Text= This is the template that the bot will use when it will
+ report the image's problem.
.. versionchanged:: 8.4
Welcome messages are imported from :mod:`scripts.welcome` script.
diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py
index 25813ed..c802a70 100755
--- a/scripts/coordinate_import.py
+++ b/scripts/coordinate_import.py
@@ -1,14 +1,13 @@
#!/usr/bin/env python3
-r"""
-Coordinate importing script.
+r"""Coordinate importing script.
Usage:
python pwb.py coordinate_import -site:wikipedia:en \
--cat:Category:Coordinates_not_on_Wikidata
+ -cat:Category:Coordinates_not_on_Wikidata
-This will work on all pages in the category "coordinates not on Wikidata" and
-will import the coordinates on these pages to Wikidata.
+This will work on all pages in the category "coordinates not on Wikidata"
+and will import the coordinates on these pages to Wikidata.
The data from the "GeoData" extension
(https://www.mediawiki.org/wiki/Extension:GeoData)
@@ -18,7 +17,7 @@
You can use any typical pagegenerator to provide with a list of pages:
python pwb.py coordinate_import -lang:it -family:wikipedia -namespace:0 \
--transcludes:Infobox_stazione_ferroviaria
+ -transcludes:Infobox_stazione_ferroviaria
You can also run over a set of items on the repo without coordinates and
try to import them from any connected page. To do this, you have to
@@ -27,19 +26,18 @@
Example:
python pwb.py coordinate_import -site:wikidata:wikidata -namespace:0 \
--querypage:Deadendpages
+ -querypage:Deadendpages
The following command line parameters are supported:
--always If used, the bot won't ask if it should add the specified
- text
+-always If used, the bot won't ask if it should add the specified text.
--create Create items for pages without one.
+-create Create items for pages without one.
-.. note:: This script is a
- :py:obj:`ConfigParserBot <bot.ConfigParserBot>`. All options
- can be set within a settings file which is scripts.ini by default.
+.. note:: This script is a :class:`ConfigParserBot <bot.ConfigParserBot>`.
+ All options can be set within a settings file which is scripts.ini by
+ default.
¶ms;
"""
diff --git a/scripts/image.py b/scripts/image.py
index a8a5632..3bd14f6 100755
--- a/scripts/image.py
+++ b/scripts/image.py
@@ -1,37 +1,39 @@
#!/usr/bin/env python3
-"""
-This script can be used to change one image to another or remove an image.
+"""This script can be used to change one image to another or remove an image.
Syntax:
python pwb.py image image_name [new_image_name]
-If only one command-line parameter is provided then that image will be removed;
-if two are provided, then the first image will be replaced by the second one on
-all pages.
+If only one command-line parameter is provided then that image will be
+removed; if two are provided, then the first image will be replaced by
+the second one on all pages.
Command line options:
-summary: Provide a custom edit summary. If the summary includes spaces,
surround it with single quotes, such as:
- -summary:'My edit summary'
+ ``-summary:'My edit summary'``
+
-always Don't prompt to make changes, just do them.
--loose Do loose replacements. This will replace all occurrences of the name
- of the image (and not just explicit image syntax). This should work
- to catch all instances of the image, including where it is used as a
- template parameter or in image galleries. However, it can also make
- more mistakes. This only works with image replacement, not image
- removal.
+
+-loose Do loose replacements. This will replace all occurrences of
+ the name of the image (and not just explicit image syntax).
+ This should work to catch all instances of the image,
+ including where it is used as a template parameter or in
+ image galleries. However, it can also make more mistakes.
+ This only works with image replacement, not image removal.
Examples
--------
-The image "FlagrantCopyvio.jpg" is about to be deleted, so let's first remove
-it from everything that displays it:
+The image "FlagrantCopyvio.jpg" is about to be deleted, so let's first
+remove it from everything that displays it:
python pwb.py image FlagrantCopyvio.jpg
-The image "Flag.svg" has been uploaded, making the old "Flag.jpg" obsolete:
+The image "Flag.svg" has been uploaded, making the old "Flag.jpg"
+obsolete:
python pwb.py image Flag.jpg Flag.svg
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index c990df2..829e766 100755
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
-"""
-Script to copy images to Wikimedia Commons, or to another wiki.
+"""Script to copy images to Wikimedia Commons, or to another wiki.
Syntax:
@@ -8,31 +7,38 @@
The following parameters are supported:
- -interwiki Look for images in pages found through interwiki links.
+-interwiki Look for images in pages found through interwiki
+ links.
- -keepname Keep the filename and do not verify description while
- replacing
+-keepname Keep the filename and do not verify description while
+ replacing.
- -tolang:x Copy the image to the wiki in code x
+-tolang:x [str] Copy the image to the wiki in code x.
- -tofamily:y Copy the image to a wiki in the family y
+-tofamily:y [str] Copy the image to a wiki in the family y.
- -tosite:s Copy the image to the given site like wikipedia:test
+-tosite:s [str] Copy the image to the given site like
+ wikipedia:test.
- -force_if_shared Upload the file to the target, even if it exists on that
- wiki's shared repo
+-force_if_shared Upload the file to the target, even if it exists on
+ that wiki's shared repo
- -asynchronous Upload to stash.
+-asynchronous Upload to stash.
- -chunk_size:n Upload in chunks of n bytes.
+-chunk_size:n [int] Upload in chunks of n bytes.
- -file:z Upload many files from textfile: [[Image:x]]
- [[Image:y]]
+-file:z [str] Upload many files from textfile z
+ like:
-If pagename is an image description page, offers to copy the image to the
-target site. If it is a normal page, it will offer to copy any of the images
-used on that page, or if the -interwiki argument is used, any of the images
-used on a page reachable via interwiki links.
+ .. code:: wikitext
+
+ [[Image:x]]
+ [[Image:y]]
+
+If pagename is an image description page, offers to copy the image to
+the target site. If it is a normal page, it will offer to copy any of
+the images used on that page, or if the -interwiki argument is used, any
+of the images used on a page reachable via interwiki links.
¶ms;
"""
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index d303363..de206ac 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1,324 +1,348 @@
#!/usr/bin/env python3
"""Script to check language links for general pages.
-Uses existing translations of a page, plus hints from the command line, to
-download the equivalent pages from other languages. All of such pages are
-downloaded as well and checked for interwiki links recursively until there are
-no more links that are encountered. A rationalization process then selects the
-right interwiki links, and if this is unambiguous, the interwiki links in the
-original page will be automatically updated and the modified page uploaded.
+Uses existing translations of a page, plus hints from the command line,
+to download the equivalent pages from other languages. All of such pages
+are downloaded as well and checked for interwiki links recursively until
+there are no more links that are encountered. A rationalization process
+then selects the right interwiki links, and if this is unambiguous, the
+interwiki links in the original page will be automatically updated and
+the modified page uploaded.
-These command-line arguments can be used to specify which pages to work on:
+.. hint:: This script should not be used for wiki farms having a data
+ repository like Wikidata for Wikimedia cluster. Possibly use the
+ :mod:``scripts.interwikidata`` script for similar purpose in such
+ environments.
- -days: Like -years, but runs through all date pages. Stops at
- Dec 31. If the argument is given in the form -days:X,
- it will start at month no. X through Dec 31. If the
- argument is simply given as -days, it will run from
- Jan 1 through Dec 31. E.g. for -days:9 it will run
- from Sep 1 through Dec 31.
+These command-line arguments can be used to specify which pages to work
+on:
- -years: run on all year pages in numerical order. Stop at year 2050.
- If the argument is given in the form -years:XYZ, it
- will run from [[XYZ]] through [[2050]]. If XYZ is a
- negative value, it is interpreted as a year BC. If the
- argument is simply given as -years, it will run from 1
- through 2050.
+-days: Like -years, but runs through all date pages. Stops at
+ Dec 31. If the argument is given in the form -days:X, it
+ will start at month no. X through Dec 31. If the
+ argument is simply given as -days, it will run from Jan
+ 1 through Dec 31. E.g. for -days:9 it will run from Sep
+ 1 through Dec 31.
- This implies -noredirect.
+-years: Run on all year pages in numerical order. Stop at year
+ 2050. If the argument is given in the form -years:XYZ,
+ it will run from [[XYZ]] through [[2050]]. If XYZ is a
+ negative value, it is interpreted as a year BC. If the
+ argument is simply given as -years, it will run from 1
+ through 2050.
- -new: Work on the 100 newest pages. If given as -new:x, will work
- on the x newest pages.
- When multiple -namespace parameters are given, x pages are
- inspected, and only the ones in the selected name spaces are
- processed. Use -namespace:all for all namespaces. Without
- -namespace, only article pages are processed.
+ This option implies ``-noredirect``.
- This implies -noredirect.
+-new: Work on the 100 newest pages. If given as -new:x, will
+ work on the x newest pages. When multiple -namespace
+ parameters are given, x pages are inspected, and only
+ the ones in the selected name spaces are processed. Use
+ ``-namespace:all`` for all namespaces. Without
+ ``-namespace``, only article pages are processed.
- -restore: restore a set of "dumped" pages the bot was working on
- when it terminated. The dump file will be subsequently
- removed.
+ This option implies ``-noredirect``.
- -restore:all restore a set of "dumped" pages of all dumpfiles to a given
- family remaining in the "interwiki-dumps" directory. All
- these dump files will be subsequently removed. If restoring
- process interrupts again, it saves all unprocessed pages in
- one new dump file of the given site.
+-restore: Restore a set of "dumped" pages the bot was working on
+ when it terminated. The dump file will be subsequently
+ removed.
- -continue: like restore, but after having gone through the dumped
- pages, continue alphabetically starting at the last of the
- dumped pages. The dump file will be subsequently removed.
+-restore:all Restore a set of "dumped" pages of all dumpfiles to a
+ given family remaining in the "interwiki-dumps"
+ directory. All these dump files will be subsequently
+ removed. If restoring process interrupts again, it saves
+ all unprocessed pages in one new dump file of the given
+ site.
+
+-continue: Like restore, but after having gone through the dumped
+ pages, continue alphabetically starting at the last of
+ the dumped pages. The dump file will be subsequently
+ removed.
¶ms;
-Additionally, these arguments can be used to restrict the bot to certain pages:
+Additionally, these arguments can be used to restrict the bot to certain
+pages:
- -namespace:n Number or name of namespace to process. The parameter can be
- used multiple times. It works in combination with all other
- parameters, except for the -start parameter. If you e.g.
- want to iterate over all categories starting at M, use
- -start:Category:M.
+-namespace:n [int] Number or name of namespace to process. The
+ parameter can be used multiple times. It works in
+ combination with all other parameters, except for the
+ ``-start`` parameter. If you e.g. want to iterate over
+ all categories starting at M, use ``-start:Category:M``.
- -number: used as -number:#, specifies that the bot should process
- that amount of pages and then stop. This is only useful in
- combination with -start. The default is not to stop.
+-number: [int] Used as -number:#, specifies that the bot should
+ process that amount of pages and then stop. This is only
+ useful in combination with ``-start``. The default is
+ not to stop.
- -until: used as -until:title, specifies that the bot should
- process pages in wiki default sort order up to, and
- including, "title" and then stop. This is only useful in
- combination with -start. The default is not to stop.
- Note: do not specify a namespace, even if -start has one.
+-until: [str] Used as -until:title, specifies that the bot
+ should process pages in wiki default sort order up to,
+ and including, "title" and then stop. This is only
+ useful in combination with ``-start``. The default is
+ not to stop.
- -bracket only work on pages that have (in the home language)
- parenthesis in their title. All other pages are skipped.
- (note: without ending colon)
+ .. note:: Do not specify a namespace, even if ``-start``
+ has one.
- -skipfile: used as -skipfile:filename, skip all links mentioned in
- the given file. This does not work with -number!
+-bracket Only work on pages that have (in the home language)
+ parenthesis in their title. All other pages are skipped.
- -skipauto use to skip all pages that can be translated automatically,
- like dates, centuries, months, etc.
- (note: without ending colon)
+-skipfile: Used as -skipfile:filename, skip all links mentioned in
+ the given file. This does not work with ``-number``!
- -lack: used as -lack:xx with xx a language code: only work on pages
- without links to language xx. You can also add a number nn
- like -lack:xx:nn, so that the bot only works on pages with
- at least nn interwiki links (the default value for nn is 1).
+-skipauto Use to skip all pages that can be translated
+ automatically, like dates, centuries, months, etc.
+
+-lack: Used as -lack:xx with xx a language code: only work on
+ pages without links to language xx. You can also add a
+ number nn like ``-lack:xx:nn``, so that the bot only
+ works on pages with at least nn interwiki links (the
+ default value for nn is 1).
These arguments control miscellaneous bot behaviour:
- -quiet Use this option to get less output
- (note: without ending colon)
+-quiet Use this option to get less output
- -async Put page on queue to be saved to wiki asynchronously. This
- enables loading pages during saving throttling and gives a
- better performance.
- NOTE: For post-processing it always assumes that saving the
- the pages was successful.
- (note: without ending colon)
+-async Put page on queue to be saved to wiki asynchronously.
+ This enables loading pages during saving throttling and
+ gives a better performance.
- -summary: Set an additional action summary message for the edit. This
- could be used for further explainings of the bot action.
- This will only be used in non-autonomous mode.
+ .. note:: For post-processing it always assumes that
+ saving the pages was successful.
- -hintsonly The bot does not ask for a page to work on, even if none of
- the above page sources was specified. This will make the
- first existing page of -hint or -hinfile slip in as start
- page, determining properties like namespace, disambiguation
- state, and so on. When no existing page is found in the
- hints, the bot does nothing.
- Hitting return without input on the "Which page to check:"
- prompt has the same effect as using -hintsonly.
- Options like -back or -same are in effect only after a page
- has been found to work on. (note: without ending colon)
+-summary: [str] Set an additional action summary message for the
+ edit. This could be used for further explainings of the
+ bot action. This will only be used in non-autonomous
+ mode.
+
+-hintsonly The bot does not ask for a page to work on, even if none
+ of the above page sources was specified. This will make
+ the first existing page of -hint or -hinfile slip in as
+ start page, determining properties like namespace,
+ disambiguation state, and so on. When no existing page
+ is found in the hints, the bot does nothing. Hitting
+ return without input on the "Which page to check:"
+ prompt has the same effect as using ``-hintsonly``.
+ Options like ``-back`` or ``-same`` are in effect only
+ after a page has been found to work on.
These arguments are useful to provide hints to the bot:
- -hint: used as -hint:de:Anweisung to give the bot a hint
- where to start looking for translations. If no text
- is given after the second ':', the name of the page
- itself is used as the title for the hint, unless the
- -hintnobracket command line option (see there) is also
- selected.
+-hint: Used as -hint:de:Anweisung to give the bot a hint where
+ to start looking for translations. If no text is given
+ after the second ':', the name of the page itself is
+ used as the title for the hint, unless the
+ ``-hintnobracket`` command line option (see there) is
+ also selected.
- There are some special hints, trying a number of languages
- at once:
+ 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
- number
- * arab: All languages using the Arabic alphabet
- * cyril: All languages that use the Cyrillic alphabet
- * chinese: All Chinese dialects
- * latin: All languages using the Latin script
- * scand: All Scandinavian languages
+ * *all:* All languages with at least ca. 100
+ articles
+ * *10:* The 10 largest languages (sites with most
+ articles). Analogous for any other natural number
+ * *arab:* All languages using the Arabic alphabet
+ * *cyril:* All languages that use the Cyrillic alphabet
+ * *chinese:* All Chinese dialects
+ * *latin:* All languages using the Latin script
+ * *scand:* All Scandinavian languages
- Names of families that forward their interlanguage links
- to the wiki family being worked upon can be used, they are:
+ Names of families that forward their interlanguage links
+ to the wiki family being worked upon can be used, they
+ are:
- * commons: Interlanguage links of Wikimedia Commons
- * incubator: Links in pages on the Wikimedia Incubator
- * meta: Interlanguage links of named pages on Meta
- * species: Interlanguage links of the Wikispecies wiki
- * strategy: Links in pages on Wikimedia Strategy wiki
- * test: Take interwiki links from Test Wikipedia
- * wikimania: Interwiki links of Wikimania
+ * *commons:* Interlanguage links of Wikimedia Commons
+ * *incubator:* Links in pages on the Wikimedia Incubator
+ * *meta:* Interlanguage links of named pages on Meta
+ * *species:* Interlanguage links of the Wikispecies wiki
+ * *strategy:* Links in pages on Wikimedia Strategy wiki
+ * *test:* Take interwiki links from Test Wikipedia
+ * *wikimania:* Interwiki links of Wikimania
- Languages, groups and families having the same page title
- can be combined, as -hint:5,scand,sr,pt,commons:New_York
+ Languages, groups and families having the same page
+ title can be combined, as
+ ``-hint:5,scand,sr,pt,commons:New_York``
- -hintfile: similar to -hint, except that hints are taken from the given
- file, enclosed in [[]] each, instead of the command line.
+-hintfile: Similar to -hint, except that hints are taken from the
+ given file, enclosed in [[]] each, instead of the
+ command line.
- -askhints: for each page one or more hints are asked. See hint: above
- for the format, one can for example give "en:something" or
- "20:" as hint.
+-askhints: For each page one or more hints are asked. See ``-hint:``
+ above for the format, one can for example give
+ "en:something" or "20:" as hint.
- -repository Include data repository
+-repository Include data repository
- -same looks over all 'serious' languages for the same title.
- -same is equivalent to -hint:all:
- (note: without ending colon)
+-same Looks over all 'serious' languages for the same title.
+ ``-same`` is equivalent to ``-hint:all``.
- -untranslated: works normally on pages with at least one interlanguage
- link; asks for hints for pages that have none.
+-untranslated: Works normally on pages with at least one interlanguage
+ link; asks for hints for pages that have none.
- -untranslatedonly: same as -untranslated, but pages which already have a
- translation are skipped. Hint: do NOT use this in
- combination with -start without a -number limit, because
- you will go through the whole alphabet before any queries
- are performed!
+-untranslatedonly: Same as ``-untranslated``,
+ but pages which already have a translation are skipped.
- -showpage when asking for hints, show the first bit of the text
- of the page always, rather than doing so only when being
- asked for (by typing '?'). Only useful in combination
- with a hint-asking option like -untranslated, -askhints
- or -untranslatedonly.
- (note: without ending colon)
+ .. hint:: do NOT use this in combination with ``-start``
+ without a ``-number`` limit, because you will go
+ through the whole alphabet before any queries are
+ performed!
- -noauto Do not use the automatic translation feature for years and
- dates, only use found links and hints.
- (note: without ending colon)
+-showpage When asking for hints, show the first bit of the text of
+ the page always, rather than doing so only when being
+ asked for (by typing '?'). Only useful in combination
+ with a hint-asking option like ``-untranslated``,
+ ``-askhints`` or ``-untranslatedonly``.
- -hintnobracket used to make the bot strip everything in last brackets,
- and surrounding spaces from the page name, before it is
- used in a -hint:xy: where the page name has been left out,
- or -hint:all:, -hint:10:, etc. without a name, or
- an -askhint reply, where only a language is given.
+-noauto Do not use the automatic translation feature for years
+ and dates, only use found links and hints.
+
+-hintnobracket Used to make the bot strip everything in last brackets,
+ and surrounding spaces from the page name, before it is
+ used in a ``-hint:xy:`` where the page name has been
+ left out, or ``-hint:all:``, ``-hint:10:``, etc. without
+ a name, or an ``-askhint`` reply, where only a language
+ is given.
These arguments define how much user confirmation is required:
- -autonomous run automatically, do not ask any questions. If a question
- -auto to an operator is needed, write the name of the page
- to autonomous_problems.dat and continue on the next page.
- (note: without ending colon)
+-autonomous, -auto
+ Run automatically, do not ask any questions. If a
+ question to an operator is needed, write the name of the
+ page to autonomous_problems.dat and continue on the next
+ page.
- -confirm ask for confirmation before any page is changed on the
- live wiki. Without this argument, additions and
- unambiguous modifications are made without confirmation.
- (note: without ending colon)
+-confirm Ask for confirmation before any page is changed on the
+ live wiki. Without this argument, additions and
+ unambiguous modifications are made without confirmation.
- -force do not ask permission to make "controversial" changes,
- like removing a language because none of the found
- alternatives actually exists.
- (note: without ending colon)
+-force Do not ask permission to make "controversial" changes,
+ like removing a language because none of the found
+ alternatives actually exists.
- -cleanup like -force but only removes interwiki links to non-existent
- or empty pages.
+-cleanup Like ``-force`` but only removes interwiki links to
+ non-existent or empty pages.
- -select ask for each link whether it should be included before
- changing any page. This is useful if you want to remove
- invalid interwiki links and if you do multiple hints of
- which some might be correct and others incorrect. Combining
- -select and -confirm is possible, but seems like overkill.
- (note: without ending colon)
+-select Ask for each link whether it should be included before
+ changing any page. This is useful if you want to remove
+ invalid interwiki links and if you do multiple hints of
+ which some might be correct and others incorrect.
+ Combining ``-select`` and ``-confirm`` is possible, but
+ seems like overkill.
-These arguments specify in which way the bot should follow interwiki links:
+These arguments specify in which way the bot should follow interwiki
+links:
- -noredirect do not follow redirects nor category redirects.
- (note: without ending colon)
+-noredirect Do not follow redirects nor category redirects.
- -initialredirect work on its target if a redirect or category redirect is
- entered on the command line or by a generator (note: without
- ending colon). It is recommended to use this option with the
- -movelog pagegenerator.
+-initialredirect
+ Work on its target if a redirect or category redirect is
+ entered on the command line or by a generator.
- -neverlink: used as -neverlink:xx where xx is a language code:
- Disregard any links found to language xx. You can also
- specify a list of languages to disregard, separated by
- commas.
+ .. tip:: It is recommended to use this option with the
+ ``-movelog`` pagegenerator.
- -ignore: used as -ignore:xx:aaa where xx is a language code, and
- aaa is a page title to be ignored.
+-neverlink: Used as ``-neverlink:xx`` where xx is a language code,
+ disregard any links found to language xx. You can also
+ specify a list of languages to disregard, separated by
+ commas.
- -ignorefile: similar to -ignore, except that the pages are taken from
- the given file instead of the command line.
+-ignore: Used as -ignore:xx:aaa where xx is a language code, and
+ aaa is a page title to be ignored.
- -localright do not follow interwiki links from other pages than the
- starting page. (Warning! Should be used very sparingly,
- only when you are sure you have first gotten the interwiki
- links on the starting page exactly right).
- (note: without ending colon)
+-ignorefile: Similar to ``-ignore``, except that the pages are taken
+ from the given file instead of the command line.
- -hintsareright do not follow interwiki links to sites for which hints
- on existing pages are given. Note that, hints given
- interactively, via the -askhint command line option,
- are only effective once they have been entered, thus
- interwiki links on the starting page are followed
- regardess of hints given when prompted.
- (Warning! Should be used with caution!)
- (note: without ending colon)
+-localright Do not follow interwiki links from other pages than the
+ starting page.
- -back only work on pages that have no backlink from any other
- language; if a backlink is found, all work on the page
- will be halted. (note: without ending colon)
+ .. warning:: Should be used very sparingly, only when
+ you are sure you have first gotten the interwiki
+ links on the starting page exactly right.
-The following arguments are only important for users who have accounts for
-multiple languages, and specify on which sites the bot should modify pages:
+-hintsareright Do not follow interwiki links to sites for which hints
+ on existing pages are given. Note that, hints given
+ interactively, via the -askhint command line option, are
+ only effective once they have been entered, thus
+ interwiki links on the starting page are followed
+ regardess of hints given when prompted.
- -localonly only work on the local wiki, not on other wikis in the
- family I have a login at. (note: without ending colon)
+ .. caution:: Should be used with care!
- -limittwo only update two pages - one in the local wiki (if logged-in)
- and one in the top available one.
- For example, if the local page has links to de and fr,
- this option will make sure that only the local site and
- the de: (larger) sites are updated. This option is useful
- to quickly set two way links without updating all of the
- wiki families sites.
- (note: without ending colon)
+-back Only work on pages that have no backlink from any other
+ language; if a backlink is found, all work on the page
+ will be halted.
- -whenneeded works like limittwo, but other languages are changed in the
- following cases:
+The following arguments are only important for users who have accounts
+for multiple languages, and specify on which sites the bot should modify
+pages:
- * 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
+-localonly Only work on the local wiki, not on other wikis in the
+ family I have a login at.
- 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
- change or add. (note: without ending colon)
+-limittwo Only update two pages - one in the local wiki (if
+ logged-in) and one in the top available one. For example,
+ if the local page has links to de and fr, this option
+ will make sure that only the local site and the de:
+ (larger) sites are updated. This option is useful to
+ quickly set two way links without updating all of the
+ wiki families sites.
-The following arguments influence how many pages the bot works on at once:
+-whenneeded Works like ``-limittwo``, but other languages are
+ changed in the following cases:
- -array: The number of pages the bot tries to be working on at once.
- If the number of pages loaded is lower than this number,
- a new set of pages is loaded from the starting wiki. The
- default is 100, but can be changed in the config variable
- interwiki_min_subjects
+ * 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
- -query: The maximum number of pages that the bot will load at once.
- Default value is 50.
+ 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 change or add.
+
+The following arguments influence how many pages the bot works on at
+once:
+
+-array: The number of pages the bot tries to be working on at
+ once. If the number of pages loaded is lower than this
+ number, a new set of pages is loaded from the starting
+ wiki. The default is 100, but can be changed in the
+ config variable ``interwiki_min_subjects``.
+
+-query: The maximum number of pages that the bot will load at
+ once. Default value is 50.
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.org/project/pydot/
+*interwiki_graph*
+ output a graph PNG file on conflicts? You need pydot for this:
+ https://pypi.org/project/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 configuration file.
-If interwiki.py is terminated before it is finished, it will write a dump file
-to the interwiki-dumps subdirectory. The program will read it if invoked with
-the "-restore" or "-continue" option, and finish all the subjects in that list.
-After finishing the dump file will be deleted. To run the interwiki-bot on all
-pages on a language, run it with option "-start:!", and if it takes so long
-that you have to break it off, use "-continue" next time.
-
+If this script is terminated before it is finished, it will write a dump
+file to the interwiki-dumps subdirectory. The program will read it if
+invoked with the ``-restore`` or ``-continue`` option, and finish all
+the subjects in that list. After finishing the dump file will be deleted.
+To run the script on all pages on a language, run it with option
+``-start:!``, and if it takes so long that you have to break it off, use
+``-continue`` next time.
"""
#
# (C) Pywikibot team, 2003-2024
diff --git a/scripts/interwikidata.py b/scripts/interwikidata.py
index 1af5d86..018c606 100755
--- a/scripts/interwikidata.py
+++ b/scripts/interwikidata.py
@@ -1,32 +1,33 @@
#!/usr/bin/env python3
-"""
-Script to handle interwiki links based on Wikibase.
+"""Script to handle interwiki links based on Wikibase.
-This script connects pages to Wikibase items using language links on the page.
-If multiple language links are present, and they are connected to different
-items, the bot skips. After connecting the page to an item, language links
-can be removed from the page.
+This script connects pages to Wikibase items using language links on the
+page. If multiple language links are present, and they are connected to
+different items, the bot skips. After connecting the page to an item,
+language links can be removed from the page.
-These command line parameters can be used to specify which pages to work on:
+These command line parameters can be used to specify which pages to work
+on:
¶ms;
Furthermore, the following command line parameters are supported:
--always If used, the bot won't ask if it should add the specified
- text
+-always If used, the bot won't ask if it should add the specified
+ text.
--clean Clean pages.
+-clean Clean pages.
--create Create items.
+-create Create items.
--merge Merge items.
+-merge Merge items.
--summary: Use your own edit summary for cleaning the page.
+-summary: [str] Use your own edit summary for cleaning the page.
-.. note:: This script is a
- :py:obj:`ConfigParserBot <bot.ConfigParserBot>`. All options
- can be set within a settings file which is scripts.ini by default.
+
+.. note:: This script is a :class:`ConfigParserBot <bot.ConfigParserBot>`.
+ All options can be set within a settings file which is scripts.ini by
+ default.
"""
# (C) Pywikibot team, 2015-2024
diff --git a/scripts/listpages.py b/scripts/listpages.py
index 0ae87e6..64688ff 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
-r"""
-Print a list of pages, as defined by page generator parameters.
+r"""Print a list of pages, as defined by page generator parameters.
Optionally, it also prints page content to STDOUT or save it to a file
in the current directory.
diff --git a/scripts/movepages.py b/scripts/movepages.py
index 1b2940a..266e369 100755
--- a/scripts/movepages.py
+++ b/scripts/movepages.py
@@ -1,39 +1,42 @@
#!/usr/bin/env python3
-"""
-This script can move pages.
+"""This script can move pages.
-These command line parameters can be used to specify which pages to work on:
+These command line parameters can be used to specify which pages to work
+on:
¶ms;
Furthermore, the following command line parameters are supported:
--from and -to The page to move from and the page to move to.
+-from The page to move from.
--noredirect Leave no redirect behind.
+-to The page to move to.
--notalkpage Do not move this page's talk page (if it exists)
+-noredirect Leave no redirect behind.
--nosubpages Do not move subpages
+-notalkpage Do not move this page's talk page (if it exists)
--prefix Move pages by adding a namespace prefix to the names of the
- pages. (Will remove the old namespace prefix if any)
- Argument can also be given as "-prefix:namespace:".
+-nosubpages Do not move subpages
--always Don't prompt to make changes, just do them.
+-prefix Move pages by adding a namespace prefix to the names of
+ the pages. (Will remove the old namespace prefix if any)
+ Argument can also be given as ``-prefix:namespace:``.
--skipredirects Skip redirect pages (Warning: increases server load)
+-always Don't prompt to make changes, just do them.
--summary Prompt for a custom summary, bypassing the predefined message
- texts. Argument can also be given as "-summary:XYZ".
+-skipredirects Skip redirect pages (Warning: increases server load)
--pairsfile Read pairs of file names from a file. The file must be in a
- format [[frompage]] [[topage]] [[frompage]] [[topage]] ...
- Argument can also be given as "-pairsfile:filename"
+-summary [str] Prompt for a custom summary, bypassing the
+ predefined message texts. Argument can also be given as
+ ``-summary:XYZ``.
+-pairsfile Read pairs of file names from a file. The file must be
+ in a format [[frompage]] [[topage]] [[frompage]]
+ [[topage]] ... Argument can also be given as
+ ``-pairsfile:filename``
"""
#
-# (C) Pywikibot team, 2006-2022
+# (C) Pywikibot team, 2006-2024
#
# Distributed under the terms of the MIT license.
#
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index c5ef416..5cba3d1 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -1,63 +1,74 @@
#!/usr/bin/env python3
-r"""
-Bot to upload pages from a text file.
+r"""Bot to upload pages from a text file.
-This bot takes its input from the UTF-8 text file that contains
-a number of pages to be put on the wiki. The pages should all have
-the same beginning and ending text (which may not overlap).
-The beginning and ending text is not uploaded with the page content
-by default.
+This bot takes its input from the UTF-8 text file that contains a number
+of pages to be put on the wiki. The pages should all have the same
+beginning and ending text (which may not overlap). The beginning and
+ending text is not uploaded with the page content by default.
-As a pagename is by default taken the first text block
-from the page content marked in bold (wrapped between ''' and ''').
-If you expect the page title not to be present in the text
-or marked by different markers, use -titlestart, -titleend,
-and -notitle parameters.
+As a pagename is by default taken the first text block from the page
+content marked in bold (wrapped between ''' and '''). If you expect the
+page title not to be present in the text or marked by different markers,
+use -titlestart, -titleend, and -notitle parameters.
Specific arguments:
--file:xxx The filename we are getting our material from,
- the default value is "dict.txt"
--begin:xxx The text that marks the beginning of a page,
- the default value is "{{-start-}}"
--end:xxx The text that marks the end of the page,
- the default value is "{{-stop-}}"
--include Include the beginning and end markers to the page
--textonly Text is given without markers. Only one page text is given.
- -begin and -end options are ignored.
--titlestart:xxx The text used in place of ''' for identifying
- the beginning of a page title
--titleend:xxx The text used in place of ''' for identifying
- the end of the page title
--notitle Do not include the page title, including titlestart
- and titleend, to the page. Can be used to specify unique
- page title above the page content
--title:xxx The page title is given directly. Ignores -titlestart,
- -titleend and -notitle options
--nocontent:xxx If the existing page contains specified statement,
- the page is skipped from editing
--noredirect Do not upload on redirect pages
--summary:xxx The text used as an edit summary for the upload.
- If the page exists, standard messages for prepending,
- appending, or replacement are appended after it
--autosummary Use MediaWiki's autosummary when creating a new page,
- overrides -summary
--minor Set the minor edit flag on page edits
--showdiff Show difference between current page and page to upload,
- also forces the bot to ask for confirmation
- on every edit
+-file:xxx The filename we are getting our material from,
+ the default value is "dict.txt"
-If the page to be uploaded already exists, it is skipped by default.
-But you can override this behavior if you want to:
+-begin:xxx The text that marks the beginning of a page,
+ the default value is "{{-start-}}"
--appendtop Add the text to the top of the existing page
--appendbottom Add the text to the bottom of the existing page
--force Overwrite the existing page
+-end:xxx The text that marks the end of the page,
+ the default value is "{{-stop-}}"
-It is possible to define a separator after the 'append' modes which
-is added between the existing and the new text. For example
-a parameter -appendtop:foo would add 'foo' between them. A new line
-can be added between them by specifying '\n' as a value.
+-include Include the beginning and end markers to the page
+
+-textonly Text is given without markers. Only one page text is
+ given. ``-begin`` and ``-end`` options are ignored.
+
+-titlestart:xxx The text used in place of ''' for identifying
+ the beginning of a page title
+
+-titleend:xxx The text used in place of ''' for identifying
+ the end of the page title
+
+-notitle Do not include the page title, including titlestart
+ and titleend, to the page. Can be used to specify
+ unique page title above the page content
+
+-title:xxx The page title is given directly. Ignores ``-titlestart``,
+ -titleend and -notitle options
+
+-nocontent:xxx If the existing page contains specified statement,
+ the page is skipped from editing
+
+-noredirect Do not upload on redirect pages
+
+-summary:xxx The text used as an edit summary for the upload.
+ If the page exists, standard messages for prepending,
+ appending, or replacement are appended after it.
+
+-autosummary Use MediaWiki's autosummary when creating a new page,
+ overrides ``-summary``-
+
+-minor Set the minor edit flag on page edits
+
+-showdiff Show difference between current page and page to upload,
+ also forces the bot to ask for confirmation
+ on every edit.
+
+If the page to be uploaded already exists, it is skipped by default. But
+you can override this behavior if you want to:
+
+-appendtop Add the text to the top of the existing page
+-appendbottom Add the text to the bottom of the existing page
+-force Overwrite the existing page
+
+It is possible to define a separator after the 'append' modes which is
+added between the existing and the new text. For example a parameter
+``-appendtop:foo`` would add 'foo' between them. A new line can be added
+between them by specifying '\n' as a value.
"""
#
# (C) Pywikibot team, 2004-2024
diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index 9c8a523..4f11c20 100755
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -1,28 +1,32 @@
#!/usr/bin/env python3
-"""
-This bot replicates pages in a wiki to a second wiki within one family.
+"""This bot replicates pages in a wiki to a second wiki within one family.
Example:
+::
+
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
-to copy all templates from nlwiki to liwiki and fywiki. It will show which
-pages have to be changed if -r is not present, and will only actually write
-pages if -r /is/ present.
+to copy all templates from nlwiki to liwiki and fywiki. It will show
+which pages have to be changed if -r is not present, and will only
+actually write pages if -r is present.
You can add replicate_replace to your user config file (user-config.py),
which has the following format:
- replicate_replace = {
- 'wikipedia:li': {'Hoofdpagina': 'Veurblaad'}
- }
+.. code-block:: python
-to replace all occurrences of 'Hoofdpagina' with 'Veurblaad' when writing to
-liwiki. Note that this does not take the origin wiki into account.
+ 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:
@@ -35,10 +39,10 @@
-dns, --dest-namespace destination namespace (if different)
- destination_wiki destination wiki(s)
+destination_wiki destination wiki(s)
"""
#
-# (C) Pywikibot team, 2012-2023
+# (C) Pywikibot team, 2012-2024
#
# Distributed under the terms of the MIT license.
#
diff --git a/scripts/template.py b/scripts/template.py
index 1e57e89..d76108a 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
-r"""
-Very simple script to replace a template with another one.
+r"""Very simple script to replace a template with another one.
It also converts the old MediaWiki boilerplate format to the new format.
@@ -9,94 +8,94 @@
python pwb.py template [-remove] [xml[:filename]] oldTemplate \
[newTemplate]
-Specify the template on the command line. The program will pick up the template
-page, and look for all pages using it. It will then automatically loop over
-them, and replace the template.
+Specify the template on the command line. The program will pick up the
+template page, and look for all pages using it. It will then
+automatically loop over them, and replace the template.
Command line options:
-remove Remove every occurrence of the template from every article
-subst Resolves the template by putting its text directly into the
- article. This is done by changing {{...}} or {{msg:...}} into
- {{subst:...}}. If you want to use safesubst, you
- can do -subst:safe. Substitution is not available inside
+ article. This is done by changing {{...}} or {{msg:...}}
+ into {{subst:...}}. If you want to use safesubst, you can
+ do -subst:safe. Substitution is not available inside
<ref>...</ref>, <gallery>...</gallery>, <poem>...</poem>
and <pagelist ... /> tags.
-assubst Replaces the first argument as old template with the second
- argument as new template but substitutes it like -subst does.
- Using both options -remove and -subst in the same command line has
- the same effect.
+ argument as new template but substitutes it like ``-subst``
+ does. Using both options -remove and -subst in the same
+ command line has the same effect.
-xml retrieve information from a local dump
(https://dumps.wikimedia.org). If this argument isn't given,
- info will be loaded from the maintenance page of the live wiki.
- argument can also be given as "-xml:filename.xml".
+ info will be loaded from the maintenance page of the live
+ wiki. argument can also be given as "-xml:filename.xml".
-onlyuser: Only process pages edited by a given user
-skipuser: Only process pages not edited by a given user
--timestamp: (With -onlyuser or -skipuser). Only check for a user where his
- edit is not older than the given timestamp. Timestamp must be
- written in MediaWiki timestamp format which is "%Y%m%d%H%M%S".
- If this parameter is missed, all edits are checked but this is
- restricted to the last 100 edits.
+-timestamp: (With -onlyuser or -skipuser). Only check for a user where
+ his edit is not older than the given timestamp. Timestamp
+ must be written in MediaWiki timestamp format which is
+ "%Y%m%d%H%M%S". If this parameter is missed, all edits are
+ checked but this is restricted to the last 100 edits.
--summary: Lets you pick a custom edit summary. Use quotes if edit summary
- contains spaces.
+-summary: [str] Lets you pick a custom edit summary. Use quotes if
+ edit summary contains spaces.
-always Don't bother asking to confirm any of the changes, Just Do It.
--addcat: Appends the given category to every page that is edited. This is
- useful when a category is being broken out from a template
- parameter or when templates are being upmerged but more
- information must be preserved.
+-addcat: Appends the given category to every page that is edited.
+ This is useful when a category is being broken out from a
+ template parameter or when templates are being upmerged but
+ more information must be preserved.
-other: First argument is the old template name, second one is the new
- name.
- If you want to address a template which has spaces, put quotation
- marks around it, or use underscores.
+other: First argument is the old template name, second one is the
+ new name. If you want to address a template which has
+ spaces, put quotation marks around it, or use underscores.
Examples
--------
-If you have a template called [[Template:Cities in Washington]] and want to
-change it to [[Template:Cities in Washington state]], start:
+If you have a template called [[Template:Cities in Washington]] and want
+to change it to [[Template:Cities in Washington state]], start:
python pwb.py template "Cities in Washington" "Cities in Washington state"
Move the page [[Template:Cities in Washington]] manually afterwards.
-If you have a template called [[Template:test]] and want to substitute it only
-on pages in the User: and User talk: namespaces, do:
+If you have a template called [[Template:test]] and want to substitute
+it only on pages in the User: and User talk: namespaces, do:
python pwb.py template test -subst -namespace:2 -namespace:3
.. note:: -namespace: is a global Pywikibot parameter
-This next example substitutes the template lived with a supplied edit summary.
-It only performs substitutions in main article namespace and doesn't prompt to
-start replacing. Note that -putthrottle: is a global Pywikibot parameter:
+This next example substitutes the template lived with a supplied edit
+summary. It only performs substitutions in main article namespace and
+doesn't prompt to start replacing. Note that -putthrottle: is a global
+Pywikibot parameter:
python pwb.py template -putthrottle:30 -namespace:0 lived -subst -always \
--summary:"BOT: Substituting {{lived}}, see [[WP:SUBST]]."
+ -summary:"BOT: Substituting {{lived}}, see [[WP:SUBST]]."
-This next example removes the templates {{cfr}}, {{cfru}}, and {{cfr-speedy}}
-from five category pages as given:
+This next example removes the templates {{cfr}}, {{cfru}}, and
+{{cfr-speedy}} from five category pages as given:
python pwb.py template cfr cfru cfr-speedy -remove -always \
--page:"Category:Mountain monuments and memorials" \
--page:"Category:Indian family names" \
--page:"Category:Tennis tournaments in Belgium" \
--page:"Category:Tennis tournaments in Germany" \
--page:"Category:Episcopal cathedrals in the United States" \
--summary:"Removing Cfd templates from category pages that survived."
+ -page:"Category:Mountain monuments and memorials" \
+ -page:"Category:Indian family names" \
+ -page:"Category:Tennis tournaments in Belgium" \
+ -page:"Category:Tennis tournaments in Germany" \
+ -page:"Category:Episcopal cathedrals in the United States" \
+ -summary:"Removing Cfd templates from category pages that survived."
-This next example substitutes templates test1, test2, and space test on all
-user talk pages (namespace #3):
+This next example substitutes templates test1, test2, and space test on
+all user talk pages (namespace #3):
python pwb.py template test1 test2 "space test" -subst -ns:3 -always
"""
diff --git a/scripts/touch.py b/scripts/touch.py
index ae4974b..9004e63 100755
--- a/scripts/touch.py
+++ b/scripts/touch.py
@@ -1,24 +1,24 @@
#!/usr/bin/env python3
-"""
-This bot goes over multiple pages of a wiki, and edits them without changes.
+"""This bot goes over multiple pages of a wiki, and edits them without changes.
This is for example used to get category links in templates working.
Command-line arguments:
--purge Purge the page instead of touching it
+-purge Purge the page instead of touching it
-Touch mode (default):
+*Touch* mode (default):
--botflag Force botflag in case of edits with changes.
+-botflag Force botflag in case of edits with changes.
-Purge mode:
+*Purge* mode:
--converttitles Convert titles to other variants if necessary
--forcelinkupdate Update the links tables
--forcerecursivelinkupdate Update the links table, and update the links tables
- for any page that uses this page as a template
--redirects Automatically resolve redirects
+-converttitles Convert titles to other variants if necessary
+-forcelinkupdate Update the links tables
+-forcerecursivelinkupdate
+ Update the links table, and update the links tables
+ for any page that uses this page as a template
+-redirects Automatically resolve redirects
¶ms;
"""
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index a1bff9e..82feda7 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -6,6 +6,7 @@
-limit:n [int] Specify number of pages to work on where *n* is
the maximum number of articles to work on. If not used,
all pages are processe.
+
-always Don't be asked every time.
This script is a :class:`ConfigParserBot <bot.ConfigParserBot>`. The
diff --git a/scripts/upload.py b/scripts/upload.py
index 10152bd..07d9aec 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -5,9 +5,9 @@
-keep Keep the filename as is
--filename: Target filename without the namespace prefix
+-filename: [str] Target filename without the namespace prefix
--prefix: Add specified prefix to every filename.
+-prefix: [str] Add specified prefix to every filename.
-noverify Do not ask for verification of the upload description if
one is given
@@ -43,9 +43,10 @@
-recursive When the filename is a directory it also uploads the
files from the subdirectories.
--summary: Pick a custom edit summary for the bot.
+-summary: [str] Pick a custom edit summary for the bot.
--descfile: Specify a filename where the description is stored
+-descfile: [str] Specify a filename where the description is stored
+
It is possible to combine ``-abortonwarn`` and ``-ignorewarn`` so that
if the specific warning is given it won't apply the general one but more
diff --git a/scripts/watchlist.py b/scripts/watchlist.py
index 8a15ec5..f6c1df6 100755
--- a/scripts/watchlist.py
+++ b/scripts/watchlist.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
-"""
-Allows access to the bot account's watchlist.
+"""Allows access to the bot account's watchlist.
The watchlist can be updated manually by running this script.
@@ -10,14 +9,17 @@
Command line options:
--all Reloads watchlists for all wikis where a watchlist is already
- present
--count Count only the total number of pages on the watchlist of the
- account the bot has access to
--count:all Count only the total number of pages on all wikis watchlists
- that the bot is connected to.
--new Load watchlists for all wikis where accounts is set in user
- config file
+-all Reloads watchlists for all wikis where a watchlist is
+ already present.
+
+-count Count only the total number of pages on the watchlist of the
+ account the bot has access to.
+
+-count:all Count only the total number of pages on all wikis watchlists
+ that the bot is connected to.
+
+-new Load watchlists for all wikis where accounts is set in user
+ config file
.. versionchanged:: 7.7
watchlist is retrieved in parallel tasks.
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 341e6e6..18a4be1 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -1,159 +1,174 @@
#!/usr/bin/env python3
-"""
-Script to welcome new users.
+"""Script to welcome new users.
-This script works out of the box for Wikis that have been
-defined in the script.
+This script works out of the box for Wikis that have been defined in the
+script.
-Ensure you have community support before running this bot!
+.. important::
+ Ensure you have community support before running this bot!
Everything that needs customisation to support additional projects is
indicated by comments.
-Description of basic functionality
+**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). A whitelist is also implemented (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
+This script uses two templates that need to be on the local wiki:
-* {{WLE}}: contains mark up code for log entries (just copy it from Commons)
-* {{welcome}}: contains the information for new users
+.. role:: tmpl(code)
+ :language: wikitext
+
+* :tmpl:`{{WLE}}`: contains mark up code for log entries (just copy it
+ from Commons)
+* :tmpl:`{{welcome}}`: contains the information for new users
This script understands the following command-line arguments:
- -edit[:#] Define how many edits a new user needs to be welcomed
- (default: 1, max: 50)
+-edit[:#] [int] Define how many edits a new user needs to be
+ welcomed (default: 1, max: 50)
- -time[:#] Define how many seconds the bot sleeps before restart
- (default: 3600)
+-time[:#] Define how many seconds the bot sleeps before restart
+ (default: 3600)
- -break Use it if you don't want that the Bot restart at the end
- (it will break) (default: False)
+-break Use it if you don't want that the Bot restart at the
+ end (it will break) (default: False)
- -nlog Use this parameter if you do not want the bot to log all
- welcomed users (default: False)
+-nlog Use this parameter if you do not want the bot to log
+ all welcomed users (default: False)
- -limit[:#] Use this parameter to define how may users should be
- checked (default:50)
+-limit[:#] [int] Use this parameter to define how may users should
+ be checked (default:50)
- -offset[:TIME] Skip the latest new users (those newer than TIME)
- to give interactive users a chance to welcome the
- new users (default: now)
- Timezone is the server timezone, GMT for Wikimedia
- TIME format : yyyymmddhhmmss or yyyymmdd
+-offset[:TIME] Skip the latest new users (those newer than TIME) to
+ give interactive users a chance to welcome the new
+ users (default: now) Timezone is the server timezone,
+ GMT for Wikimedia TIME format : yyyymmddhhmmss or yyyymmdd
- -timeoffset[:#] Skip the latest new users, accounts newer than
- # minutes
+-timeoffset[:#] Skip the latest new users, accounts newer than #
+ minutes
- -numberlog[:#] The number of users to welcome before refreshing the
- welcome log (default: 4)
+-numberlog[:#] The number of users to welcome before refreshing the
+ welcome log (default: 4)
- -filter Enable the username checks for bad names (default: False)
+-filter Enable the username checks for bad names (default:
+ False)
- -ask Use this parameter if you want to confirm each possible
- bad username (default: False)
+-ask Use this parameter if you want to confirm each possible
+ bad username (default: False)
- -random Use a random signature, taking the signatures from a wiki
- page (for instruction, see below).
+-random Use a random signature, taking the signatures from a
+ wiki page (for instruction, see below).
- -file[:#] Use a file instead of a wikipage to take the random sign.
- If you use this parameter, you don't need to use -random.
+-file[:#] Use a file instead of a wikipage to take the random
+ sign. If you use this parameter, you don't need to use
+ ``-random``.
- -sign Use one signature from command line instead of the default
+-sign Use one signature from command line instead of the
+ default
- -savedata This feature saves the random signature index to allow to
- continue to welcome with the last signature used.
+-savedata This feature saves the random signature index to allow
+ to continue to welcome with the last signature used.
- -sul Welcome the auto-created users (default: False)
+-sul Welcome the auto-created users (default: False)
- -quiet Prevents users without contributions are displayed
+-quiet Prevents users without contributions are displayed
-********************************* GUIDE ***********************************
+GUIDE
+-----
-*** Report, Bad and white list guide: ***
+**Report, Bad and white list guide**
-1) Set in the code which page it will use to load the badword, the
- whitelist and the report
-2) In these page you have to add a "tuple" with the names that you want to
- add in the two list. For example: ('cat', 'mouse', 'dog')
- You can write also other text in the page, it will work without problem.
-3) What will do the two pages? Well, the Bot will check if a badword is in
- the username and set the "warning" as True. Then the Bot check if a word
- of the whitelist is in the username. If yes it remove the word and
- recheck in the bad word list to see if there are other badword in the
- username.
- Example
+1) Set in the code which page it will use to load the badword, the
+ whitelist and the report.
- * dio is a badword
- * Claudio is a normal name
- * The username is "Claudio90 fuck!"
- * The Bot finds dio and sets "warning"
- * The Bot finds Claudio and sets "ok"
- * The Bot finds fuck at the end and sets "warning"
- * Result: The username is reported.
-4) When a user is reported you have to check him and do
+2) In these page you have to add a "tuple" with the names that you want
+ to add in the two list. For example: ('cat', 'mouse', 'dog') You can
+ write also other text in the page, it will work without problem.
- * If he's ok, put the {{welcome}}
- * If he's not, block him
- * You can decide to put a "you are blocked, change another username"
- template or not.
- * Delete the username from the page.
+3) What will do the two pages? Well, the Bot will check if a badword is
+ in the username and set the "warning" as True. Then the Bot check if
+ a word of the whitelist is in the username. If yes it remove the word
+ and recheck in the bad word list to see if there are other badword in
+ the username.
- IMPORTANT : The Bot check the user in this order
+ Example:
- * Search if he has a talkpage (if yes, skip)
- * Search if he's blocked, if yes he will be skipped
- * Search if he's in the report page, if yes he will be skipped
- * If no, he will be reported.
+ * dio is a badword
+ * Claudio is a normal name
+ * The username is "Claudio90 fuck!"
+ * The Bot finds dio and sets "warning"
+ * The Bot finds Claudio and sets "ok"
+ * The Bot finds fuck at the end and sets "warning"
+ * Result: The username is reported.
-*** Random signature guide: ***
+4) When a user is reported you have to check him and do
-Some welcomed users will answer to the one who has signed the welcome message.
-When you welcome many new users, you might be overwhelmed with such answers.
-Therefore you can define usernames of other users who are willing to receive
-some of these messages from newbies.
+ * If he's ok, put the :tmpl:`{{welcome}}`
+ * If he's not, block him
+ * 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
+ * Search if he's in the report page, if yes he will be skipped
+ * If no, he will be reported.
+
+**Random signature guide**
+
+Some welcomed users will answer to the one who has signed the welcome
+message. When you welcome many new users, you might be overwhelmed with
+such answers. Therefore you can define usernames of other users who are
+willing to receive some of these messages from newbies.
1) Set the page that the bot will load
-2) Add the signatures in this way:
+2) Add the signature lines in this way:
- *<SPACE>SIGNATURE
- <NEW LINE>
+ * SIGNATURE
-Example of signatures:
+ Example of signatures:
- <pre>
- * [[User:Filnik|Filnik]]
- * [[User:Rock|Rock]]
- </pre>
+ .. code:: wikitext
-.. note:: The white space and <pre></pre> aren't required but I suggest
- you to use them.
+ <pre>
+ * [[User:Filnik|Filnik]]
+ * [[User:Rock|Rock]]
+ </pre>
-******************************** Badwords **********************************
+ .. note:: The white space after asterisk and ``<pre></pre>`` aren't
+ required but it is recommended you to use them.
+
+Badwords
+--------
The list of Badwords of the code is opened. If you think that a word is
-international and it must be blocked in all the projects feel free to add it.
-If also you think that a word isn't so international, feel free to delete it.
+international and it must be blocked in all the projects feel free to
+add it. If also you think that a word isn't so international, feel free
+to delete it.
-However, there is a dinamic-wikipage to load that badwords of your project or
-you can add them directly in the source code that you are using without adding
-or deleting.
+However, there is a dinamic-wikipage to load that badwords of your
+project or you can add them directly in the source code that you are
+using without adding or deleting.
-Some words, like "Administrator" or "Dio" (God in italian) or "Jimbo" aren't
-badwords at all but can be used for some bad-nickname.
+Some words, like "Administrator" or "Dio" (God in italian) or "Jimbo"
+aren't badwords at all but can be used for some bad-nickname.
"""
#
# (C) Pywikibot team, 2006-2024
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1083432?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic51f0fda375995456759f1a332347b44f133105e
Gerrit-Change-Number: 1083432
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1081972?usp=email )
Change subject: [doc] Adjust scripts options
......................................................................
[doc] Adjust scripts options
script options where idented by 1 space to show it as literal block.
Now use the option list and not appropriate e.g. having a ':' inside
the option use a definition list and mark the option with 'kbd: role.
Change-Id: I0cfc01994264c17815f4e838759af3118a8decfb
---
M docs/conf.py
M scripts/archivebot.py
M scripts/basic.py
M scripts/blockpageschecker.py
M scripts/category.py
M scripts/category_graph.py
M scripts/commonscat.py
M scripts/create_isbn_edition.py
M scripts/delete.py
M scripts/djvutext.py
M scripts/listpages.py
M scripts/reflinks.py
M scripts/revertbot.py
M scripts/unusedfiles.py
M scripts/upload.py
15 files changed, 570 insertions(+), 494 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index f18f61c..e36ab8f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -44,7 +44,6 @@
os.environ['PYWIKIBOT_NO_USER_CONFIG'] = '1'
import pywikibot # noqa: E402
-from pywikibot.backports import removeprefix # noqa: E402
# -- General configuration ------------------------------------------------
@@ -533,17 +532,11 @@
"""Pywikibot specific conversions."""
from scripts.cosmetic_changes import warning
- # these scripts are skipped for fixing options lists
- skipscripts = {'add_text', 'clean_sandbox'}
-
- if what != 'module':
- return
-
- if not name.startswith('scripts.'):
+ if what != 'module' or 'scripts.' not in name:
return
length = 0
- shortname = removeprefix(name, 'scripts.')
+ desc = ''
for index, line in enumerate(lines):
# highlight the first line
if index == 0: # highlight the first line
@@ -563,46 +556,30 @@
elif name == 'scripts.cosmetic_changes' and line == '&warning;':
lines[index] = warning
- # Initiate code block except pagegenerator arguments follows
- elif (shortname not in skipscripts
- and line.endswith(':')
- and not line.lstrip().startswith(':')
- and 'Traceback (most recent call last)' not in line):
- for afterline in lines[index + 1:]:
- if not afterline:
- continue
- if afterline != '¶ms;':
- lines[index] = line + ':'
- break
-
- # adjust options
- if shortname not in skipscripts and line.startswith('-'):
- # Indent options
- match = re.match(r'-[^ ]+? +', line)
+ # adjust options: if the option contains a colon, convert it to a
+ # definition list and mark the option with a :kbd: role. Also convert
+ # option types enclosed in square brackets to italic style.
+ if line.startswith('-'):
+ # extract term and wrap it with :kbd: role
+ match = re.fullmatch(r'(-\w.+?[^ ])( {2,})(.+)', line)
if match:
- length = len(match[0])
- lines[index] = ' ' + line
- elif length and line.startswith(' ' * length):
- # Indent descriptions of options (as options are indented)
- lines[index] = ' ' + line
+ opt, sp, desc = match.groups()
+ desc = re.sub(r'\[(float|int|str)\]', r'*(\1)*', desc)
+ if ':' in opt or ' ' in opt:
+ length = len(opt + sp)
+ lines[index] = f':kbd:`{opt}`'
+ else:
+ lines[index] = f'{opt}{sp}{desc}'
+
+ elif length and (not line or line.startswith(' ' * length)):
+ # Add descriptions to the next line
+ lines[index] = ' ' * length + f'{desc} {line.strip()}'
+ length = 0
elif line:
# Reset length
length = 0
-TYPE_PATTERN = re.compile(r'( +)\[(float|int|str)\]')
-
-
-def pywikibot_option_types_fixups(app, what, name, obj, options, lines):
- """Convert option types enclosed in square brackets to italic style."""
- if what != 'module' or 'scripts.' not in name:
- return
-
- for index, line in enumerate(lines):
- if line.startswith('-'):
- lines[index] = TYPE_PATTERN.sub(r'\1*(\2)*', line)
-
-
def pywikibot_family_classproperty_getattr(obj, name, *defargs):
"""Custom getattr() to get classproperty instances."""
from sphinx.util.inspect import safe_getattr
@@ -631,7 +608,6 @@
"""Implicit Sphinx extension hook."""
app.connect('autodoc-process-docstring', pywikibot_docstring_fixups)
app.connect('autodoc-process-docstring', pywikibot_script_docstring_fixups)
- app.connect('autodoc-process-docstring', pywikibot_option_types_fixups)
app.add_autodoc_attrgetter(type, pywikibot_family_classproperty_getattr)
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 8694d64..3a2b220 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -17,76 +17,100 @@
Transcluded template may contain the following parameters:
- {{TEMPLATE_PAGE
- |archive =
- |algo =
- |counter =
- |maxarchivesize =
- |minthreadsleft =
- |minthreadstoarchive =
- |archiveheader =
- |key =
- }}
+.. code:: wikitext
+
+ {{TEMPLATE_PAGE
+ |archive =
+ |algo =
+ |counter =
+ |maxarchivesize =
+ |minthreadsleft =
+ |minthreadstoarchive =
+ |archiveheader =
+ |key =
+ }}
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 updated 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 200K.
- 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 not to 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
+ :code:`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 :code:`old(24h)`.
+counter
+ The current value of a counter which could be assigned as variable.
+ Will be updated 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 ``200K``.
+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 not to be subpages of
+ the page being archived.
Variables below can be used in the value for "archive" in the template
-above; numbers are latin digits:
+above; numbers are **latin** digits. Alternatively you may use
+**localized** digits. This is only available for a few site languages.
+Refer :attr:`NON_LATIN_DIGITS
+<userinterfaces.transliteration.NON_LATIN_DIGITS>` whether there is a
+localized one.
-%(counter)d the current value of the counter
-%(year)d year of the thread being archived
-%(isoyear)d ISO year of the thread being archived
-%(isoweek)d ISO week number of the thread being archived
-%(semester)d semester term of the year of the thread being archived
-%(quarter)d quarter of the year of the thread being archived
-%(month)d month (as a number 1-12) of the thread being archived
-%(monthname)s localized name of the month above
-%(monthnameshort)s first three letters of the name above
-%(week)d week number of the thread being archived
+.. list-table::
+ :header-rows: 1
-Alternatively you may use localized digits. This is only available for a
-few site languages. Refer :attr:`NON_LATIN_DIGITS
-<userinterfaces.transliteration.NON_LATIN_DIGITS>` whether
-there is a localized one:
+ * - latin
+ - localized
+ - Description
+ * - %(counter)d
+ - %(localcounter)s
+ - the current value of the counter
+ * - %(year)d
+ - %(localyear)s
+ - year of the thread being archived
+ * - %(isoyear)d
+ - %(localisoyear)s
+ - ISO year of the thread being archived
+ * - %(isoweek)d
+ - %(localisoweek)s
+ - ISO week number of the thread being archived
+ * - %(semester)d
+ - %(localsemester)s
+ - semester term of the year of the thread being archived
+ * - %(quarter)d
+ - %(localquarter)s
+ - quarter of the year of the thread being archived
+ * - %(month)d
+ - %(localmonth)s
+ - month (as a number 1-12) of the thread being archived
+ * - %(monthname)s
+ -
+ - localized name of the month above
+ * - %(monthnameshort)s
+ -
+ - first three letters of the name above
+ * - %(week)d
+ - %(localweek)s
+ - week number of the thread being archived
-%(localcounter)s the current value of the counter
-%(localyear)s year of the thread being archived
-%(localisoyear)s ISO year of the thread being archived
-%(localisoweek)s ISO week number of the thread being archived
-%(localsemester)s semester term of the year of the thread being archived
-%(localquarter)s quarter of the year of the thread being archived
-%(localmonth)s month (as a number 1-12) of the thread being archived
-%(localweek)s week number of the thread being archived
-
-The ISO calendar starts with the Monday of the week which has at least four
-days in the new Gregorian calendar. If January 1st is between Monday and
-Thursday (including), the first week of that year started the Monday of that
-week, which is in the year before if January 1st is not a Monday. If it's
-between Friday or Sunday (including) the following week is then the first week
-of the year. So up to three days are still counted as the year before.
+The ISO calendar starts with the Monday of the week which has at least
+four days in the new Gregorian calendar. If January 1st is between
+Monday and Thursday (including), the first week of that year started the
+Monday of that week, which is in the year before if January 1st is not a
+Monday. If it's between Friday or Sunday (including) the following week
+is then the first week of the year. So up to three days are still
+counted as the year before.
.. seealso:: Python :python:`datetime.date.isocalendar
<library/datetime.html#datetime.date.isocalendar>`,
@@ -94,18 +118,27 @@
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
- -force override security options
- -locale:LOCALE switch to locale LOCALE
- -namespace:NS only archive pages from a given namespace
- -page:PAGE archive a single PAGE, default ns is a user talk page
- -salt:SALT specify salt
- -keep Preserve thread order in archive even if threads are
- archived later
- -sort Sort archive by timestamp; should not be used with -keep
- -async Run the bot in parallel tasks.
+-help show this help message and exit
+
+-calc:PAGE calculate key for PAGE and exit
+
+-file:FILE load list of pages from FILE
+
+-force override security options
+
+-locale:LOCALE switch to locale LOCALE
+
+-namespace:NS only archive pages from a given namespace
+
+-page:PAGE archive a single PAGE, default ns is a user talk page
+
+-salt:SALT specify salt
+
+-keep Preserve thread order in archive even if threads are
+ archived later
+-sort Sort archive by timestamp; should not be used with `keep`
+
+-async Run the bot in parallel tasks.
.. versionchanged:: 7.6
Localized variables for "archive" template parameter are supported.
diff --git a/scripts/basic.py b/scripts/basic.py
index 5775b2b..4465544 100755
--- a/scripts/basic.py
+++ b/scripts/basic.py
@@ -1,33 +1,33 @@
#!/usr/bin/env python3
-"""
-An incomplete sample script.
+"""An incomplete sample script.
This is not a complete bot; rather, it is a template from which simple
bots can be made. You can rename it to mybot.py, then edit it in
whatever way you want.
-Use global -simulate option for test purposes. No changes to live wiki
-will be done.
+Use :ref:`global<Global Options>` ``-simulate`` option for test purposes.
+No changes to live wiki will be done.
The following parameters are supported:
--always The bot won't ask for confirmation when putting a page
+-always The bot won't ask for confirmation when putting a page
--text: Use this text to be added; otherwise 'Test' is used
+-text: Use this text to be added; otherwise 'Test' is used
--replace: Don't add text but replace it
+-replace: Don't add text but replace it
--top Place additional text on top of the page
+-top Place additional text on top of the page
--summary: Set the action summary message for the edit.
+-summary: Set the action summary message for the edit.
-This sample script is a
-:py:obj:`ConfigParserBot <bot.ConfigParserBot>`. All settings can be
-made either by giving option with the command line or with a settings file
-which is scripts.ini by default. If you don't want the default values you can
-add any option you want to change to that settings file below the [basic]
-section like:
+This sample script is a :class:`ConfigParserBot <bot.ConfigParserBot>`.
+All settings can be made either by giving option with the command line
+or with a settings file which is scripts.ini by default. If you don't
+want the default values you can add any option you want to change to
+that settings file below the [basic] section like:
+
+.. code:: ini
[basic] ; inline comments starts with colon
# This is a commend line. Assignments may be done with '=' or ':'
@@ -44,7 +44,7 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2006-2022
+# (C) Pywikibot team, 2006-2024
#
# Distributed under the terms of the MIT license.
#
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index afb9eb1..02f5562 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -3,33 +3,35 @@
A bot to remove stale protection templates from pages that are not protected.
Very often sysops block the pages for a set time but then they forget to
-remove the warning! This script is useful if you want to remove those useless
-warning left in these pages.
+remove the warning! This script is useful if you want to remove those
+useless warning left in these pages.
-These command line parameters can be used to specify which pages to work on:
+These command line parameters can be used to specify which pages to work
+on:
¶ms;
Furthermore, the following command line parameters are supported:
-protectedpages Check all the blocked pages; useful when you have not
- categories or when you have problems with them. (add the
- namespace after ":" where you want to check - default checks
- all protected pages.)
+ categories or when you have problems with them. (add
+ the namespace after ":" where you want to check -
+ default checks all protected pages.)
-moveprotected Same as -protectedpages, for moveprotected pages
-This script is a :py:obj:`ConfigParserBot <bot.ConfigParserBot>`.
-The following options can be set within a settings file which is scripts.ini
-by default::
+This script is a :class:`ConfigParserBot <bot.ConfigParserBot>`. The
+following options can be set within a settings file which is scripts.ini
+by default:
--always Doesn't ask every time whether the bot should make the change.
- Do it always.
+-always Doesn't ask every time whether the bot should make the
+ change. Do it always.
--show When the bot can't delete the template from the page (wrong
- regex or something like that) it will ask you if it should
- show the page on your browser.
- (attention: pages included may give false positives!)
+-show When the bot can't delete the template from the page
+ (wrong regex or something like that) it will ask you if
+ it should show the page on your browser.
+
+ .. attention:: Pages included may give false positives!
-move The bot will check if the page is blocked also for the move
option, not only for edit
diff --git a/scripts/category.py b/scripts/category.py
index a430341..83ff20b 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -10,11 +10,13 @@
*add*
mass-add a category to a list of pages.
*remove*
- remove category tag from all pages in a category. If a pagegenerators
- option is given, the intersection with category pages is processed.
+ remove category tag from all pages in a category. If a
+ pagegenerators option is given, the intersection with category pages
+ is processed.
*move*
- move all pages in a category to another category. If a pagegenerators
- option is given, the intersection with category pages is processed.
+ move all pages in a category to another category. If a
+ pagegenerators option is given, the intersection with category pages
+ is processed.
*tidy*
tidy up a category by moving its pages into subcategories.
*tree*
@@ -28,97 +30,105 @@
and option can be one of these
-Options for "add" action:
+Options for *add* action:
- -person - Sort persons by their last name.
- -create - If a page doesn't exist, do not skip it, create it instead.
- -redirect - Follow redirects.
+-person Sort persons by their last name.
+-create If a page doesn't exist, do not skip it, create it instead.
+-redirect Follow redirects.
-Options for "listify" action:
+Options for *listify* action:
- -append - This appends the list to the current page that is already
- existing (appending to the bottom by default).
- -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.
- -talkpages - This outputs the links to talk pages of the pages to be
- listified in addition to the pages themselves.
- -prefix:# - You may specify a list prefix like "#" for a numbered list or
- any other prefix. Default is a bullet list with prefix "*".
+-append This appends the list to the current page that is already
+ existing (appending to the bottom by default).
+-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.
+-talkpages This outputs the links to talk pages of the pages to be
+ listified in addition to the pages themselves.
+-prefix:# You may specify a list prefix like "#" for a numbered list
+ or any other prefix. Default is a bullet list with prefix
+ "*".
-Options for "remove" action:
+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.
+-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:
+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.
- -nowb - Don't update the Wikibase repository.
- -allowsplit - If that option is not set, it only moves the talk and main
- page together.
- -mvtogether - Only move the pages/subcategories of a category, if the
- target page (and talk page, if -allowsplit is not set)
- doesn't exist.
- -keepsortkey - Use sortKey of the old category also for the new category.
- If not specified, sortKey is removed.
- An alternative method to keep sortKey is to use -inplace
- option.
+-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.
+-nowb Don't update the Wikibase repository.
+-allowsplit If that option is not set, it only moves the talk and main
+ page together.
+-mvtogether Only move the pages/subcategories of a category, if the
+ target page (and talk page, if ``-allowsplit`` is not set)
+ doesn't exist.
+-keepsortkey Use sortKey of the old category also for the new category.
+ If not specified, sortKey is removed. An alternative
+ method to keep sortKey is to use ``-inplace`` option.
-Options for "listify" and "tidy" actions:
+Options for *listify* and *tidy* actions:
- -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
+-namespaces, -namespace, -ns
+ Filter the arcitles in the specified namespaces. Separate
+ multiple namespace numbers or names with commas. Examples:
+ :samp:`-ns:0,2,4`, :samp:`-ns:Help,MediaWiki`
-Options for "clean" action:
+Options for *clean* action:
- -always
+-always The bot won't ask for confirmation when putting a page.
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
- Also, the category to make a list of in the listify option.
- -to: - The category to move to (for the move option).
- - Also, the name of the list to make in the listify option.
+-rebuild Reset the database.
- -batch - Don't prompt to delete emptied categories (do it
- automatically).
- -summary: - Pick a custom edit summary for the bot.
- -inplace - Use this flag to change categories in place rather than
- rearranging them.
- -recurse[:<depth>]
- - Recurse through subcategories of the category to
- optional depth.
- -pagesonly - While removing pages from a category, keep the subpage links
- and do not remove them.
- -match - Only work on pages whose titles match the given regex (for
- move and remove actions).
- -depth: - The max depth limit beyond which no subcategories will be
- listed.
+-from: The category to move from (for the move option). Also, the
+ category to remove from in the remove option. Also, the
+ category to make a list of in the listify option.
+
+-to: The category to move to (for the move option). Also, the
+ name of the list to make in the listify option.
+
+-batch Don't prompt to delete emptied categories (do it
+ automatically).
+
+-summary: Pick a custom edit summary for the bot.
+
+-inplace Use this flag to change categories in place rather than
+ rearranging them.
+
+-recurse[:<depth>] Recurse through subcategories of the category to
+ optional depth.
+
+-pagesonly While removing pages from a category, keep the subpage
+ links and do not remove them.
+
+-match Only work on pages whose titles match the given regex (for
+ move and remove actions).
+
+-depth: The max depth limit beyond which no subcategories will be
+ isted.
.. note:: If the category names have spaces in them you may need to use
a special syntax in your shell so that the names aren't treated as
separate parameters. For instance, in BASH, use single quotes, e.g.
``-from:'Polar bears'``.
-If action is "add", "move" or "remove, the following additional options are
-supported:
+If action is "add", "move" or "remove, the following additional options
+are supported:
¶ms;
For the actions tidy and tree, the bot will store the category structure
-locally in category.dump. This saves time and server load, but if it uses
-these data later, they may be outdated; use the -rebuild parameter in this
-case.
+locally in category.dump. This saves time and server load, but if it
+uses these data later, they may be outdated; use the -rebuild parameter
+in this case.
For example, to create a new category from a list of persons, type:
@@ -132,7 +142,7 @@
This will move all pages in the category US to the category United States.
-A pagegenerators option can be given with ``move`` and ``remove`` action:
+A pagegenerators option can be given with *move* and *remove* action:
pwb category -site:wikipedia:en remove -from:Hydraulics -cat:Pneumatics
diff --git a/scripts/category_graph.py b/scripts/category_graph.py
index 829abb7..fd46d30 100755
--- a/scripts/category_graph.py
+++ b/scripts/category_graph.py
@@ -10,15 +10,18 @@
actions:
--from [FROM] Category name to scan, default is main category, "?" to ask.
+-from [FROM] Category name to scan, default is main category, "?" to ask.
optional arguments:
--to TO base file name to save, "?" to ask
--style STYLE graphviz style definitions in dot format (see below)
--depth DEPTH maximal hierarchy depth. 2 by default
--downsize K font size divider for subcategories. 4 by default
- Use 1 for the same font size
+-to TO base file name to save, "?" to ask
+
+-style STYLE graphviz style definitions in dot format (see below)
+
+-depth DEPTH maximal hierarchy depth. 2 by default
+
+-downsize K font size divider for subcategories. 4 by default Use 1
+ for the same font size
.. seealso:: https://graphviz.org/doc/info/attrs.html
for graphviz style definitions.
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 9536a96..b71a559 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -1,29 +1,31 @@
#!/usr/bin/env python3
-"""
-With this tool you can add the template {{commonscat}} to categories.
+"""With this tool you can add the template {{commonscat}} to categories.
-The tool works by following the interwiki links. If the template is present on
-another language page, the bot will use it.
+The tool works by following the interwiki links. If the template is
+present on another language page, the bot will use it.
-You could probably use it at articles as well, but this isn't tested.
+.. warning::
+ You could probably use it at articles as well, but this isn't tested.
The following parameters are supported:
--checkcurrent Work on all category pages that use the primary commonscat
- template.
+-checkcurrent Work on all category pages that use the primary commonscat
+ template.
-This script is a :py:obj:`ConfigParserBot <bot.ConfigParserBot>`.
-The following options can be set within a settings file which is scripts.ini
-by default::
+This script is a :class:`ConfigParserBot <bot.ConfigParserBot>`. The
+following options can be set within a settings file which is scripts.ini
+by default:
--always Don't prompt you for each replacement. Warning message
- has not to be confirmed. ATTENTION: Use this with care!
+-always Don't prompt you for each replacement. Warning message
+ has not to be confirmed.
--summary:XYZ Set the action summary message for the edit to XYZ,
- otherwise it uses messages from add_text.py as default.
+ .. attention:: Use this with care!
-This bot uses pagegenerators to get a list of pages. The following options are
-supported:
+-summary:XYZ Set the action summary message for the edit to XYZ,
+ otherwise it uses messages from add_text.py as default.
+
+This bot uses pagegenerators to get a list of pages. The following
+options are supported:
¶ms;
diff --git a/scripts/create_isbn_edition.py b/scripts/create_isbn_edition.py
index 53a4b36..427b7e1 100755
--- a/scripts/create_isbn_edition.py
+++ b/scripts/create_isbn_edition.py
@@ -1,46 +1,47 @@
#!/usr/bin/env python3
r"""Pywikibot script to load ISBN related data into Wikidata.
-Pywikibot script to get ISBN data from a digital library,
-and create or amend the related Wikidata item for edition
-(with the P212=ISBN number as unique external ID).
+Pywikibot script to get ISBN data from a digital library, and create or
+amend the related Wikidata item for edition (with the
+:samp:`P212={ISBN number}` as unique external ID).
Use digital libraries to get ISBN data in JSON format, and integrate the
results into Wikidata.
Then the resulting item number can be used e.g. to generate Wikipedia
-references using template Cite_Q.
+references using template ``Cite_Q``.
-Parameters:
-
+**Parameters**:
All parameters are optional:
- P1: digital library (default goob "-")
+ .. code:: text
- bnf Catalogue General (France)
- bol Bol.com
- dnb Deutsche National Library
- goob Google Books
- kb National Library of the Netherlands
- loc Library of Congress US
- mcues Ministerio de Cultura (Spain)
- openl OpenLibrary.org
- porbase urn.porbase.org Portugal
- sbn Servizio Bibliotecario Nazionale
- wiki wikipedia.org
- worldcat WorldCat
+ *P1:* digital library (default goob "-")
- P2: ISO 639-1 language code
- Default LANG; e.g. en, nl, fr, de, es, it, etc.
+ bnf Catalogue General (France)
+ bol Bol.com
+ dnb Deutsche National Library
+ goob Google Books
+ kb National Library of the Netherlands
+ loc Library of Congress US
+ mcues Ministerio de Cultura (Spain)
+ openl OpenLibrary.org
+ porbase urn.porbase.org Portugal
+ sbn Servizio Bibliotecario Nazionale
+ wiki wikipedia.org
+ worldcat WorldCat
- P3 P4...: P/Q pairs to add additional claims (repeated)
- e.g. P921 Q107643461 (main subject: database
- management linked to P2163 Fast ID)
+ *P2:* ISO 639-1 language code. Default LANG; e.g. en, nl,
+ fr, de, es, it, etc.
- stdin: ISBN numbers (International standard book number)
+ *P3 P4...:* P/Q pairs to add additional claims (repeated) e.g.
+ P921 Q107643461 (main subject: database management
+ linked to P2163 Fast ID)
- Free text (e.g. Wikipedia references list, or publication list)
- is accepted. Identification is done via an ISBN regex expression.
+ *stdin:* ISBN numbers (International standard book number)
+
+ Free text (e.g. Wikipedia references list, or publication list)
+ is accepted. Identification is done via an ISBN regex expression.
**Functionality:**
* The ISBN number is used as a primary key (P212 where no duplicates
@@ -52,21 +53,20 @@
(ambiguous items are skipped)
* Book title and subtitle are separated with '.', ':', or '-'
* This script can be run incrementally with the same parameters
- Caveat: Take into account the Wikidata Query database
- replication delay. Wait for minimum 5 minutes to avoid creating
- duplicate objects.
+ Caveat: Take into account the Wikidata Query database replication
+ delay. Wait for minimum 5 minutes to avoid creating duplicate
+ objects.
**Data quality:**
* Use https://query.wikidata.org/querybuilder/ to identify P212
- duplicates. Merge duplicate items before running the script
- again.
+ duplicates. Merge duplicate items before running the script again.
* The following properties should only be used for written works
- P5331: OCLC work ID (editions should only have P243)
- P8383: Goodreads-identificatiecode for work (editions should
- only have P2969)
-Examples:
+ * P5331: OCLC work ID (editions should only have P243)
+ * P8383: Goodreads-identificatiecode for work (editions should
+ only have P2969)
+**Examples:**
Default library (Google Books), language (LANG), no additional
statements:
@@ -76,47 +76,54 @@
pwb create_isbn_edition.py wiki en P921 Q107643461 978-0-596-10089-6
-Standard ISBN properties:
+**Standard ISBN properties:**
+ ::
- P31:Q3331189: instance of edition
- P50: author
- P123: publisher
- P212: canonical ISBN number (lookup via Wikidata Query)
- P407: language of work (Qnumber linked to ISO 639-1 language code)
- P577: date of publication (year)
- P1476: book title
- P1680: subtitle
+ P31:Q3331189: instance of edition
+ P50: author
+ P123: publisher
+ P212: canonical ISBN number (lookup via Wikidata Query)
+ P407: language of work
+ (Qnumber linked to ISO 639-1 language code)
+ P577: date of publication (year)
+ P1476: book title
+ P1680: subtitle
-Other ISBN properties:
+**Other ISBN properties:**
+ ::
- P291: place of publication
- P921: main subject (inverse lookup from external Fast ID P2163)
- P629: work for edition
- P747: edition of work
- P1104: number of pages
+ P291: place of publication
+ P921: main subject (inverse lookup from external Fast ID P2163)
+ P629: work for edition
+ P747: edition of work
+ P1104: number of pages
-Qualifiers:
+**Qualifiers:**
+ ::
- P1545: (author) sequence number
+ P1545: (author) sequence number
-External identifiers:
+**External identifiers:**
+ ::
- P213: ISNI ID
- P243: OCLC ID
- P496: ORCID iD
- P675: Google Books-identificatiecode
- P1036: Dewey Decimal Classification
- P2163: Fast ID (inverse lookup via Wikidata Query) -> P921: main subject
- P2969: Goodreads-identificatiecode
+ P213: ISNI ID
+ P243: OCLC ID
+ P496: ORCID iD
+ P675: Google Books-identificatiecode
+ P1036: Dewey Decimal Classification
+ P2163: Fast ID (inverse lookup via Wikidata Query)
+ -> P921: main subject
+ P2969: Goodreads-identificatiecode
- (only for written works)
- P5331: OCLC work ID (editions should only have P243)
- P8383: Goodreads-identificatiecode for work (editions should only
- have P2969)
+ (only for written works)
+ P5331: OCLC work ID (editions should only have P243)
+ P8383: Goodreads-identificatiecode for work
+ (editions should only have P2969)
**Author:**
- Geert Van Pamel, 2022-08-04,
- GNU General Public License v3.0, User:Geertivp
+ Geert Van Pamel (User:Geertivp), 2022-08-04,
+
+ Licensed under MIT amd GNU General Public License v3.0
**Documentation:**
* :wiki:`ISBN`
@@ -146,61 +153,68 @@
* https://www.wikidata.org/wiki/Wikidata:Pywikibot\_-_Python_3_Tutorial/Setti…
**Prerequisites:**
- pywikibot
+ In addition to Pywikibot the following ISBN lib package is mandatory;
+ install it with:
- Install the following ISBN lib packages:
- https://pypi.org/search/?q=isbnlib_
+ .. code:: shell
- pip install isbnlib (mandatory)
+ pip install isbnlib
- (optional)
+ The following ISBN lib package are optional; install them with:
+
+ .. code:: shell
+
pip install isbnlib-bol
pip install isbnlib-bnf
pip install isbnlib-dnb
pip install isbnlib-kb
pip install isbnlib-loc
pip install isbnlib-worldcat2
- etc.
**Restrictions:**
- * Better use the ISO 639-1 language code parameter as a default
- The language code is not always available from the digital library.
- * SPARQL queries run on a replicated database
- Possible important replication delay; wait 5 minutes before retry
- -- otherwise risk for creating duplicates.
+ * Better use the ISO 639-1 language code parameter as a default. The
+ language code is not always available from the digital library.
+ * SPARQL queries run on a replicated database.
+
+ .. important::
+ Replication delay: wait 5 minutes before retry, otherwise there
+ is a risk for creating duplicates.
**Algorithm:**
- # Get parameters
- # Validate parameters
- # Get ISBN data
- # Convert ISBN data
- # Get additional data
- # Register ISBN data into Wikidata (create or amend items or claims)
+ #. Get parameters
+ #. Validate parameters
+ #. Get ISBN data
+ #. Convert ISBN data
+ #. Get additional data
+ #. Register ISBN data into Wikidata (create or amend items or claims)
-Environment:
-
+**Environment:**
The python script can run on the following platforms:
- Linux client
- Google Chromebook (Linux container)
- Toolforge Portal
- PAWS
+ * Linux client
+ * Google Chromebook (Linux container)
+ * Toolforge Portal
+ * PAWS
LANG: ISO 639-1 language code
-Applications:
+**Applications:**
+ Generate a book reference. Example for (wp.en):
- Generate a book reference
- Example: {{Cite Q|Q63413107}} (wp.en)
- See also:
- https://meta.wikimedia.org/wiki/WikiCite
- https://www.wikidata.org/wiki/Q21831105 (WikiCite)
- https://www.wikidata.org/wiki/Q22321052 (Cite_Q)
- https://www.mediawiki.org/wiki/Global_templates
- https://www.wikidata.org/wiki/Wikidata:WikiProject_Source_MetaData
- https://phabricator.wikimedia.org/tag/wikicite/
- https://meta.wikimedia.org/wiki/WikiCite/Shared_Citations
+ .. code:: wikitext
+
+ {{Cite Q|Q63413107}}
+
+ .. seealso::
+
+ - https://meta.wikimedia.org/wiki/WikiCite
+ - https://www.wikidata.org/wiki/Q21831105 (WikiCite)
+ - https://www.wikidata.org/wiki/Q22321052 (Cite_Q)
+ - https://www.mediawiki.org/wiki/Global_templates
+ - https://www.wikidata.org/wiki/Wikidata:WikiProject_Source_MetaData
+ - https://phabricator.wikimedia.org/tag/wikicite/
+ - https://meta.wikimedia.org/wiki/WikiCite/Shared_Citations
**Wikidata Query:**
* List of editions about musicians: https://w.wiki/5aaz
@@ -218,7 +232,7 @@
* https://zenodo.org/record/55004#.YvwO4hTP1D8
**Other systems:**
- * `wiki:`bibliographic_database`
+ * wiki:`bibliographic_database`
* https://www.titelbank.nl/pls/ttb/f?p=103:4012:::NO::P4012_TTEL_ID:3496019&c…
.. versionadded:: 7.7
diff --git a/scripts/delete.py b/scripts/delete.py
index d9b334e..977e3e5 100755
--- a/scripts/delete.py
+++ b/scripts/delete.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
-"""
-This script can be used to delete and undelete pages en masse.
+"""This script can be used to delete and undelete pages en masse.
Of course, you will need an admin account on the relevant wiki.
@@ -10,31 +9,33 @@
Furthermore, the following command line parameters are supported:
--always Don't prompt to delete pages, just do it.
+-always Don't prompt to delete pages, just do it.
--summary:XYZ Set the summary message text for the edit to XYZ.
+-summary:XYZ Set the summary message text for the edit to XYZ.
--undelete Actually undelete pages instead of deleting.
- Obviously makes sense only with -page and -file.
+-undelete Actually undelete pages instead of deleting. Obviously
+ makes sense only with -page and -file.
--isorphan Alert if there are pages that link to page to be
- deleted (check 'What links here').
- By default it is active and only the summary per namespace
- is be given.
- If given as -isorphan:n, n pages per namespace will be shown,
- If given as -isorphan:0, only the summary per namespace will
- be shown,
- If given as -isorphan:n, with n < 0, the option is disabled.
- This option is disregarded if -always is set.
+-isorphan Alert if there are pages that link to page to be deleted
+ (check 'What links here'). By default it is active and
+ only the summary per namespace is be given. If given as
+ ``-isorphan:n``, n pages per namespace will be shown. If
+ given as ``-isorphan:0``, only the summary per namespace
+ will be shown. If given as ``-isorphan:n``, with n < 0,
+ the option is disabled. This option is disregarded if
+ ``-always`` is set.
--orphansonly: Specified namespaces. Separate multiple namespace
- numbers or names with commas.
- Examples:
+-orphansonly: Specified namespaces. Separate multiple namespace numbers
+ or names with commas. Examples:
+
+ .. code:: shell
-orphansonly:0,2,4
-orphansonly:Help,MediaWiki
- Note that Main ns can be indicated either with a 0 or a ',':
+ Note that Main ns can be indicated either with a 0 or a ',':
+
+ .. code:: shell
-orphansonly:0,1
-orphansonly:,Talk
diff --git a/scripts/djvutext.py b/scripts/djvutext.py
index eda0d92..6e8d305 100755
--- a/scripts/djvutext.py
+++ b/scripts/djvutext.py
@@ -1,38 +1,44 @@
#!/usr/bin/env python3
-"""
-This bot uploads text from djvu files onto pages in the "Page" namespace.
+"""This bot uploads text from djvu files onto pages in the "Page" namespace.
-It is intended to be used for Wikisource.
+.. note:: It is intended to be used for Wikisource.
The following parameters are supported:
- -index:... name of the index page (without the Index: prefix)
- -djvu:... path to the djvu file, it shall be:
- - path to a file name
- - dir where a djvu file name as index is located
- optional, by default is current dir '.'
- -pages:<start>-<end>,...<start>-<end>,<start>-<end>
- Page range to upload;
- optional, start=1, end=djvu file number of images.
- Page ranges can be specified as:
- A-B -> pages A until B
- A- -> pages A until number of images
- A -> just page A
- -B -> pages 1 until B
+-index: name of the index page (without the Index: prefix)
-This script is a :py:obj:`ConfigParserBot <bot.ConfigParserBot>`.
-The following options can be set within a settings file which is scripts.ini
+-djvu: path to the djvu file, it shall be:
+
+ .. hlist::
+
+ * path to a file name
+ * dir where a djvu file name as index is located optional,
+ by default is current dir '.'
+
+-pages:<start>-<end>,...<start>-<end>,<start>-<end> Page range to
+ upload; optional, :samp:`start=1`,
+ :samp:`end={djvu file number of images}`. Page ranges can be
+ specified as::
+
+ A-B -> pages A until B
+ A- -> pages A until number of images
+ A -> just page A
+ -B -> pages 1 until B
+
+This script is a :class:`ConfigParserBot <bot.ConfigParserBot>`. The
+following options can be set within a settings file which is scripts.ini
by default:
- -summary: custom edit summary.
- Use quotes if edit summary contains spaces.
- -force overwrites existing text
- optional, default False
- -always do not bother asking to confirm any of the changes.
+-summary: [str] Custom edit summary. Use quotes if edit summary
+ contains spaces.
+
+-force Overwrites existing text optional, default False.
+
+-always Do not bother asking to confirm any of the changes.
"""
#
-# (C) Pywikibot team, 2008-2022
+# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
#
diff --git a/scripts/listpages.py b/scripts/listpages.py
index fcb1735..0ae87e6 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -9,9 +9,10 @@
-format Defines the output format.
- Can be a custom string according to python string.format() notation
- or can be selected by a number from following list
+ Can be a custom string according to python string.format()
+ notation or can be selected by a number from following list
(1 is default format):
+
1 - '{num:4d} {page.title}'
--> 10 PageTitle
@@ -38,10 +39,11 @@
num is the sequential number of the listed page.
- An empty format is equal to -notitle and just shows the total
- amount of pages.
+ An empty format is equal to ``-notitle`` and just shows the
+ total amount of pages.
--outputlang Language for translation of namespaces.
+-outputlang
+ Language for translation of namespaces.
-notitle Page title is not printed.
@@ -50,47 +52,55 @@
-tofile Save Page titles to a single file. File name can be set
with -tofile:filename or -tofile:dir_name/filename.
--save Save Page content to a file named as page.title(as_filename=True).
- Directory can be set with -save:dir_name
- If no dir is specified, current directory will be used.
+-save Save Page content to a file named as
+ :code:`page.title(as_filename=True)`. Directory can be set
+ with ``-save:dir_name``. If no dir is specified, current
+ directory will be used.
--encode File encoding can be specified with '-encode:name' (name must be
- a valid python encoding: utf-8, etc.).
- If not specified, it defaults to config.textfile_encoding.
+-encode File encoding can be specified with '-encode:name' (name
+ must be a valid python encoding: utf-8, etc.). If not
+ specified, it defaults to :code:`config.textfile_encoding`.
--put: Save the list to the defined page of the wiki. By default it does
- not overwrite an existing page.
+-put: [str] Save the list to the defined page of the wiki. By
+ default it does not overwrite an existing page.
--overwrite Overwrite the page if it exists. Can only by applied with -put.
+-overwrite Overwrite the page if it exists. Can only by applied with
+ -put.
--summary: The summary text when the page is written. If it's one word just
- containing letters, dashes and underscores it uses that as a
- translation key.
+-summary: [str] The summary text when the page is written. If it's one
+ word just containing letters, dashes and underscores it uses
+ that as a translation key.
Custom format can be applied to the following items extrapolated from a
page object:
- site: obtained from page._link._site.
+*site*
+ Obtained from :code:`page._link._site`.
- title: obtained from page._link._title.
+*title*
+ Obtained from :code:`page._link._title`.
- loc_title: obtained from page._link.canonical_title().
+*loc_title*
+ Obtained from :code:`page._link.canonical_title()`.
- can_title: obtained from page._link.ns_title().
- based either the canonical namespace name or on the namespace name
- in the language specified by the -trans param;
- a default value '******' will be used if no ns is found.
+*can_title*
+ Obtained from :code:`page._link.ns_title()`. Based either the
+ canonical namespace name or on the namespace name in the language
+ specified by the ``-trans`` param; a default value ``******`` will
+ be used if no *ns* is found.
- onsite: obtained from pywikibot.Site(outputlang, self.site.family).
+*onsite*
+ Obtained from :code:`pywikibot.Site(outputlang, self.site.family)`.
- trs_title: obtained from page._link.ns_title(onsite=onsite).
- If selected format requires trs_title, outputlang must be set.
+*trs_title*
+ Obtained from :code:`page._link.ns_title(onsite=onsite)`. If
+ selected, format requires *trs_title*, ``-outputlang`` must be set.
¶ms;
"""
#
-# (C) Pywikibot team, 2008-2022
+# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
#
diff --git a/scripts/reflinks.py b/scripts/reflinks.py
index 50c2397..95b719e 100755
--- a/scripts/reflinks.py
+++ b/scripts/reflinks.py
@@ -1,42 +1,45 @@
#!/usr/bin/env python3
-"""
-Fetch and add titles for bare links in references.
+"""Fetch and add titles for bare links in references.
This bot will search for references which are only made of a link
-without title (i.e. <ref>[https://www.google.fr/]</ref> or
-<ref>https://www.google.fr/</ref>) and will fetch the html title from
-the link to use it as the title of the wiki link in the reference, i.e.
-<ref>[https://www.google.fr/search?q=test test - Google Search]</ref>
+without title (i.e. ``<ref>[https://www.google.fr/]</ref>`` or
+``<ref>https://www.google.fr/</ref>``) and will fetch the html title
+from the link to use it as the title of the wiki link in the reference,
+i.e.
+
+.. code:: wikitext
+
+ <ref>[https://www.google.fr/search?q=test test - Google Search]</ref>
The bot checks every 20 edits a special stop page. If the page has been
edited, it stops.
-As it uses it, you need to configure noreferences.py for your wiki, or it
+As it uses it, you need to configure reflinks.py for your wiki, or it
will not work.
pdfinfo is needed for parsing pdf titles.
The following parameters are supported:
--xml:dump.xml Should be used instead of a simple page fetching method
- from pagegenerators.py for performance and load issues
+-xml:dump.xml Should be used instead of a simple page fetching method
+ from pagegenerators.py for performance and load issues
--xmlstart Page to start with when using an XML dump
+-xmlstart Page to start with when using an XML dump
-This script is a :py:obj:`ConfigParserBot <bot.ConfigParserBot>`.
-The following options can be set within a settings file which is scripts.ini
-by default::
+This script is a :class:`ConfigParserBot <bot.ConfigParserBot>`. The
+following options can be set within a settings file which is scripts.ini
+by default:
--always Doesn't ask every time whether the bot should make the change.
- Do it always.
+-always Doesn't ask every time whether the bot should make the
+ change. Do it always.
--limit:n Stops after n edits
+-limit:n [int] Stops after n edits
--ignorepdf Do not handle PDF files (handy if you use Windows and
- can't get pdfinfo)
+-ignorepdf Do not handle PDF files (handy if you use Windows and
+ can't get pdfinfo)
--summary Use a custom edit summary. Otherwise it uses the
- default one from translatewiki
+-summary [str] Use a custom edit summary. Otherwise it uses the
+ default one from translatewiki
The following generators and filters are supported:
diff --git a/scripts/revertbot.py b/scripts/revertbot.py
index 6a86c45..94b1136 100755
--- a/scripts/revertbot.py
+++ b/scripts/revertbot.py
@@ -1,21 +1,23 @@
#!/usr/bin/env python3
-r"""
-This script can be used for reverting certain edits.
+r"""This script can be used for reverting certain edits.
The following command line parameters are supported:
--username Edits of which user need to be reverted.
- Default is bot's username (site.username())
+-username Edits of which user need to be reverted. Default is bot's
+ username (:code:`site.username()`).
--rollback Rollback edits instead of reverting them.
- Note that in rollback, no diff would be shown.
+-rollback Rollback edits instead of reverting them.
--limit:num Use the last num contributions to be checked for revert.
- Default is 500.
+ .. note:: No diff would be shown in this mode.
+
+-limit:num [int] Use the last num contributions to be checked for
+ revert. Default is 500.
Users who want to customize the behaviour should subclass the `BaseRevertBot`
and override its `callback` method. Here is a sample:
+.. code:: python
+
class myRevertBot(BaseRevertBot):
'''Example revert bot.'''
@@ -35,7 +37,7 @@
"""
#
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
#
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index aa885e1..a1bff9e 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -1,21 +1,22 @@
#!/usr/bin/env python3
-"""
-This bot appends some text to all unused images and notifies uploaders.
+"""This bot appends some text to all unused images and notifies uploaders.
Parameters:
--limit Specify number of pages to work on with "-limit:n" where
- n is the maximum number of articles to work on.
- If not used, all pages are used.
+-limit:n [int] Specify number of pages to work on where *n* is
+ the maximum number of articles to work on. If not used,
+ all pages are processe.
-always Don't be asked every time.
-This script is a :py:obj:`ConfigParserBot <bot.ConfigParserBot>`.
-The following options can be set within a settings file which is scripts.ini
-by default::
+This script is a :class:`ConfigParserBot <bot.ConfigParserBot>`. The
+following options can be set within a settings file which is scripts.ini
+by default:
-nouserwarning Do not warn uploader about orphaned file.
--filetemplate: Use a custom template on unused file pages.
--usertemplate: Use a custom template to warn the uploader.
+
+-filetemplate: [str] Use a custom template on unused file pages.
+
+-usertemplate: [str] Use a custom template to warn the uploader.
"""
#
# (C) Pywikibot team, 2007-2024
diff --git a/scripts/upload.py b/scripts/upload.py
index 1fc092a..10152bd 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -1,58 +1,71 @@
#!/usr/bin/env python3
-"""
-Script to upload images to Wikipedia.
+"""Script to upload images to Wikipedia.
The following parameters are supported:
- -keep Keep the filename as is
- -filename: Target filename without the namespace prefix
- -prefix: Add specified prefix to every filename.
- -noverify Do not ask for verification of the upload description if one
- is given
- -abortonwarn: Abort upload on the specified warning type. If no warning type
- is specified, aborts on any warning.
- -ignorewarn: Ignores specified upload warnings. If no warning type is
- specified, ignores all warnings. Use with caution
- -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:
+-keep Keep the filename as is
- No suffix: Bytes
- 'k': Kilobytes (1000 B)
- 'M': Megabytes (1000000 B)
- 'Ki': Kibibytes (1024 B)
- 'Mi': Mebibytes (1024x1024 B)
+-filename: Target filename without the namespace prefix
- The suffixes are case insensitive.
- -async Make potentially large file operations asynchronous on the
- server side when possible.
- -always Don't ask the user anything. This will imply -keep and
- -noverify and require that either -abortonwarn or -ignorewarn
- is defined for all. It will also require a valid file name and
- description. It'll only overwrite files if -ignorewarn includes
- the 'exists' warning.
- -recursive When the filename is a directory it also uploads the files from
- the subdirectories.
- -summary: Pick a custom edit summary for the bot.
- -descfile: Specify a filename where the description is stored
+-prefix: Add specified prefix to every filename.
-It is possible to combine -abortonwarn and -ignorewarn so that if the specific
-warning is given it won't apply the general one but more specific one. So if it
-should ignore specific warnings and abort on the rest it's possible by defining
-no warning for -abortonwarn and the specific warnings for -ignorewarn. The
-order does not matter. If both are unspecific or a warning is specified by
-both, it'll prefer aborting.
+-noverify Do not ask for verification of the upload description if
+ one is given
+
+-abortonwarn: Abort upload on the specified warning type. If no warning
+ type is specified, aborts on any warning.
+
+-ignorewarn: Ignores specified upload warnings. If no warning type is
+ specified, ignores all warnings. Use with caution
+
+-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)
+
+ The suffixes are case insensitive.
+
+-async Make potentially large file operations asynchronous on
+ the server side when possible.
+
+-always Don't ask the user anything. This will imply -keep and
+ ``-noverify`` and require that either ``-abortonwarn`` or
+ ``-ignorewarn`` is defined for all. It will also require
+ a valid file name and description. It'll only overwrite
+ files if ``-ignorewarn`` includes the 'exists' warning.
+
+-recursive When the filename is a directory it also uploads the
+ files from the subdirectories.
+
+-summary: Pick a custom edit summary for the bot.
+
+-descfile: Specify a filename where the description is stored
+
+It is possible to combine ``-abortonwarn`` and ``-ignorewarn`` so that
+if the specific warning is given it won't apply the general one but more
+specific one. So if it should ignore specific warnings and abort on the
+rest it's possible by defining no warning for -abortonwarn and the
+specific warnings for ``-ignorewarn``. The order does not matter. If
+both are unspecific or a warning is specified by both, it'll prefer
+aborting.
If any other arguments are given, the first is either URL, filename or
-directory to upload, and the rest is a proposed description to go with the
-upload. If none of these are given, the user is asked for the directory, file
-or URL to upload. The bot will then upload the image to the wiki.
+directory to upload, and the rest is a proposed description to go with
+the upload. If none of these are given, the user is asked for the
+directory, file or URL to upload. The bot will then upload the image to
+the wiki.
The script will ask for the location of an image(s), if not given as a
parameter, and for a description.
"""
#
-# (C) Pywikibot team, 2003-2022
+# (C) Pywikibot team, 2003-2024
#
# Distributed under the terms of the MIT license.
#
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1081972?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I0cfc01994264c17815f4e838759af3118a8decfb
Gerrit-Change-Number: 1081972
Gerrit-PatchSet: 8
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1081917?usp=email )
Change subject: [doc] Update scripts description for add_text.py and clean_sandbox.py
......................................................................
[doc] Update scripts description for add_text.py and clean_sandbox.py
Add type hints to options
Change-Id: I63e21dd1ad91dd2b03f7f061c5af5885519a56b5
---
M docs/conf.py
M scripts/add_text.py
M scripts/clean_sandbox.py
3 files changed, 44 insertions(+), 28 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index 5d151ce..f18f61c 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -534,7 +534,7 @@
from scripts.cosmetic_changes import warning
# these scripts are skipped for fixing options lists
- skipscripts = {'add_text'}
+ skipscripts = {'add_text', 'clean_sandbox'}
if what != 'module':
return
@@ -590,6 +590,19 @@
length = 0
+TYPE_PATTERN = re.compile(r'( +)\[(float|int|str)\]')
+
+
+def pywikibot_option_types_fixups(app, what, name, obj, options, lines):
+ """Convert option types enclosed in square brackets to italic style."""
+ if what != 'module' or 'scripts.' not in name:
+ return
+
+ for index, line in enumerate(lines):
+ if line.startswith('-'):
+ lines[index] = TYPE_PATTERN.sub(r'\1*(\2)*', line)
+
+
def pywikibot_family_classproperty_getattr(obj, name, *defargs):
"""Custom getattr() to get classproperty instances."""
from sphinx.util.inspect import safe_getattr
@@ -618,6 +631,7 @@
"""Implicit Sphinx extension hook."""
app.connect('autodoc-process-docstring', pywikibot_docstring_fixups)
app.connect('autodoc-process-docstring', pywikibot_script_docstring_fixups)
+ app.connect('autodoc-process-docstring', pywikibot_option_types_fixups)
app.add_autodoc_attrgetter(type, pywikibot_family_classproperty_getattr)
diff --git a/scripts/add_text.py b/scripts/add_text.py
index c5d66f9..216ca02 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -6,11 +6,11 @@
Use the following command line parameters to specify what to add:
--text Text to append. "\n" are interpreted as newlines.
+-text [str] Text to append. "\n" are interpreted as newlines.
--textfile Path to a file with text to append
+-textfile [str] Path to a file with text to append
--summary Change summary to use
+-summary [str] Change summary to use
-up Append text to the top of the page rather than the bottom
@@ -28,7 +28,7 @@
-talk, -talkpage
Put the text onto the talk page instead
--excepturl Skip pages with a url that matches this regular expression
+-excepturl [str] Skip pages with a url that matches this regular expression
-noreorder Place the text beneath the categories and interwiki
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index 7f23e6a..f9f32f9 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
-"""
-This bot resets a (user) sandbox with predefined text.
+"""This bot resets a (user) sandbox with predefined text.
This script understands the following command-line arguments:
@@ -8,39 +7,42 @@
Furthermore, the following command line parameters are supported:
- -hours:# Use this parameter if to make the script repeat itself
- after # hours. Hours can be defined as a decimal. 0.01
- hours are 36 seconds; 0.1 are 6 minutes.
+-hours [float] Use this parameter if to make the script repeat
+ itself after the given hours. Hours can be defined as a
+ decimal. 0.01 hours are 36 seconds; 0.1 are 6 minutes.
- -delay:# Use this parameter for a wait time after the last edit
- was made. If no parameter is given it takes it from
- hours and limits it between 5 and 15 minutes.
- The minimum delay time is 5 minutes.
+-delay [int] Use this parameter for a wait time after the last edit
+ was made. If no parameter is given it takes it from hours and
+ limits it between 5 and 15 minutes. The minimum delay time is
+ 5 minutes.
- -text The text that substitutes in the sandbox, you can use this
- when you haven't configured clean_sandbox for your wiki.
+-text [str] The text that substitutes in the sandbox, you can use
+ this when you haven't configured clean_sandbox for your wiki.
- -textfile As an alternative to -text, you can use this to provide
- a file containing the text to be used.
+-textfile [str] As an alternative to -text, you can use this to provide
+ a file containing the text to be used.
- -summary Summary of the edit made by the bot. Overrides the default
- from i18n.
+-summary [str] Summary of the edit made by the bot. Overrides the
+ default from i18n.
This script is a :py:obj:`ConfigParserBot <bot.ConfigParserBot>`.
All local parameters can be given inside a scripts.ini file. Options
passed to the script are priorized over options read from ini file.
+For example:
+
+.. code:: ini
+
+ [clean_sandbox]
+ # the parameter section for clean_sandbox script
+ summary = Bot: Cleaning sandbox
+ text = {{subst:Clean Sandbox}}
+ hours: 0.5
+ delay: 7
+
.. seealso:: :python:`Supported .ini File Structure
<library/configparser.html#supported-ini-file-structure>`
-For example:
-
- [clean_sandbox]
- # the parameter section for clean_sandbox script
- summary = Bot: Cleaning sandbox
- text = {{subst:Clean Sandbox}}
- hours: 0.5
- delay: 7
"""
#
# (C) Pywikibot team, 2006-2024
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1081917?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I63e21dd1ad91dd2b03f7f061c5af5885519a56b5
Gerrit-Change-Number: 1081917
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot