jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1239530?usp=email )
Change subject: isort: Remove preleading r in module docstrings because isort
fails with it.
......................................................................
isort: Remove preleading r in module docstrings because isort fails with it.
Change-Id: I84bd055e591e37ec57166799a67477b3044391f7
---
M pyproject.toml
M scripts/add_text.py
M scripts/category_graph.py
M scripts/coordinate_import.py
M scripts/data_ingestion.py
M scripts/harvest_template.py
M scripts/listpages.py
M scripts/maintenance/cache.py
M scripts/nowcommons.py
M scripts/pagefromfile.py
M scripts/replace.py
M scripts/revertbot.py
M scripts/template.py
M scripts/transferbot.py
14 files changed, 75 insertions(+), 79 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pyproject.toml b/pyproject.toml
index 8269afc..b7cf995 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -199,7 +199,7 @@
[tool.ruff.lint]
select = ["C4", "D", "Q", "RSE"]
-ignore = ["D105", "D211", "D213", "D214", "D401", "D404", "D406", "D407",
"D412", "D413", "D416", "D417"]
+ignore = ["D105", "D211", "D213", "D214", "D301", "D401", "D404", "D406",
"D407", "D412", "D413", "D416", "D417"]
[tool.ruff.lint.per-file-ignores]
"pywikibot/families/*" = ["D102"]
diff --git a/scripts/add_text.py b/scripts/add_text.py
index bc7993a..2f0bce1 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -4,7 +4,7 @@
#
# Distributed under the terms of the MIT license.
#
-r"""Append text to the top or bottom of a page.
+"""Append text to the top or bottom of a page.
By default this adds the text to the bottom above the categories and
interwiki.
@@ -56,18 +56,17 @@
.. code-block:: batch
python pwb.py add_text -cat:catname -summary:"Bot: Adding a template"
- -text:"{{Something}}" -except:"\{\{([Tt]emplate:|)[Ss]omething" -up
+ -text:"{{Something}}" -except:"\\{\\{([Tt]emplate:|)[Ss]omething" -up
Command used on it.wikipedia to put the template in the page without any
category:
.. code-block:: batch
- python pwb.py add_text -except:"\{\{([Tt]emplate:|)[Cc]ategorizzare"
+ python pwb.py add_text -except:"\\{\\{([Tt]emplate:|)[Cc]ategorizzare"
-text:"{{Categorizzare}}" -excepturl:"class='catlinks'>" -uncat
-summary:"Bot: Aggiungo template Categorizzare"
"""
-
from __future__ import annotations
import re
diff --git a/scripts/category_graph.py b/scripts/category_graph.py
index 0ae3a38..e602360 100755
--- a/scripts/category_graph.py
+++ b/scripts/category_graph.py
@@ -4,7 +4,7 @@
#
# Distributed under the terms of the MIT license.
#
-r"""Visualizes category hierarchy.
+"""Visualizes category hierarchy.
Generates graphical representation in formats dot, svg and html5
of category hierarchy.
@@ -43,14 +43,13 @@
Extended example with style settings:
- pwb.py category_graph -from Life -downsize 1.5 \
- -style 'graph[rankdir=BT ranksep=0.5] node[shape=circle style=filled \
+ pwb.py category_graph -from Life -downsize 1.5 \\
+ -style 'graph[rankdir=BT ranksep=0.5] node[shape=circle style=filled \\
fillcolor=green] edge[style=dashed penwidth=3]'
.. versionadded:: 8.0
"""
-
from __future__ import annotations
import argparse
diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py
index e69f3d9..aae923c 100755
--- a/scripts/coordinate_import.py
+++ b/scripts/coordinate_import.py
@@ -4,11 +4,11 @@
#
# Distributed under the terms of MIT license.
#
-r"""Coordinate importing script.
+"""Coordinate importing script.
Usage:
- python pwb.py coordinate_import -site:wikipedia:en \
+ python pwb.py coordinate_import -site:wikipedia:en \\
-cat:Category:Coordinates_not_on_Wikidata
This will work on all pages in the category "coordinates not on Wikidata"
@@ -21,7 +21,7 @@
You can use any typical pagegenerator to provide with a list of pages:
- python pwb.py coordinate_import -site:wikipedia:it -namespace:0 \
+ python pwb.py coordinate_import -site:wikipedia:it -namespace:0 \\
-transcludes:Infobox_stazione_ferroviaria
You can also run over a set of items on the repo without coordinates and
@@ -30,7 +30,7 @@
Example:
- python pwb.py coordinate_import -site:wikidata:wikidata -namespace:0 \
+ python pwb.py coordinate_import -site:wikidata:wikidata -namespace:0 \\
-querypage:Deadendpages
diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py
index dd83550..53d0a9b 100755
--- a/scripts/data_ingestion.py
+++ b/scripts/data_ingestion.py
@@ -1,5 +1,10 @@
#!/usr/bin/env python3
-r"""A generic bot to do data ingestion (batch uploas) of photos or other files.
+#
+# (C) Pywikibot team, 2012-2026
+#
+# Distributed under the terms of the MIT license.
+#
+"""A generic bot to do data ingestion (batch uploas) of photos or other files.
In addition it installs related metadata. The uploading is primarily from a url
to a wiki-site.
@@ -88,11 +93,6 @@
.. warning:: Put it in one line, otherwise it won't work correctly.
""" # noqa: E501,W505
-#
-# (C) Pywikibot team, 2012-2025
-#
-# Distributed under the terms of the MIT license.
-#
from __future__ import annotations
import base64
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index a97dd56..52a88f3 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -4,18 +4,18 @@
#
# Distributed under the terms of MIT license.
#
-r"""Template harvesting script.
+"""Template harvesting script.
Usage (see below for explanations and examples):
- python pwb.py harvest_template -transcludes:"..." \
- [default optional arguments] template_parameter PID \
- [local optional arguments] \
+ python pwb.py harvest_template -transcludes:"..." \\
+ [default optional arguments] template_parameter PID \\
+ [local optional arguments] \\
[template_parameter PID [local optional arguments]]
- python pwb.py harvest_template [generators] -template:"..." \
- [default optional arguments] template_parameter PID \
- [local optional arguments] \
+ python pwb.py harvest_template [generators] -template:"..." \\
+ [default optional arguments] template_parameter PID \\
+ [local optional arguments] \\
[template_parameter PID [local optional arguments]]
This will work on all pages that transclude the template in the article
@@ -57,27 +57,27 @@
parameter of "Infobox person" on English Wikipedia as Wikidata property
"P18" (image):
- python pwb.py harvest_template -site:wikipedia:en -namespace:0 \
+ python pwb.py harvest_template -site:wikipedia:en -namespace:0 \\
-template:"Infobox person" image P18
The following command will behave the same as the previous example and
also try to import [[links]] from "birth_place" parameter of the same
template as Wikidata property "P19" (place of birth):
- python pwb.py harvest_template -site:wikipedia:en -namespace:0 \
+ python pwb.py harvest_template -site:wikipedia:en -namespace:0 \\
-template:"Infobox person" image P18 birth_place P19
The following command will import both "birth_place" and "death_place"
params with -islink modifier, ie. the bot will try to import values,
even if it doesn't find a [[link]]:
- python pwb.py harvest_template -site:wikipedia:en -namespace:0 \
+ python pwb.py harvest_template -site:wikipedia:en -namespace:0 \\
-template:"Infobox person" -islink birth_place P19 death_place P20
The following command will do the same but only "birth_place" can be
imported without a link:
- python pwb.py harvest_template -site:wikipedia:en -namespace:0 \
+ python pwb.py harvest_template -site:wikipedia:en -namespace:0 \\
-template:"Infobox person" birth_place P19 -islink death_place P20
The following command will import an occupation from "occupation"
@@ -85,7 +85,7 @@
"P106" (occupation). The page won't be skipped if the item already has
that property but there is not the new value:
- python pwb.py harvest_template -site:wikipedia:en -namespace:0 \
+ python pwb.py harvest_template -site:wikipedia:en -namespace:0 \\
-template:"Infobox person" occupation P106 -exists:p
The following command will import band members from the "current_members"
@@ -93,7 +93,7 @@
property "P527" (has part). This will only extract multiple band members
if each is linked, and will not add duplicate claims for the same member:
- python pwb.py harvest_template -site:wikipedia:en -namespace:0 \
+ python pwb.py harvest_template -site:wikipedia:en -namespace:0 \\
-template:"Infobox musical artist" current_members P527 -exists:p -multi
The following command will import the category's main topic from the
@@ -103,7 +103,7 @@
property "P910" (topic's main category) unless a claim of that property
is already there:
- python pwb.py harvest_template -site:wikipedia:en -namespace:14 \
+ python pwb.py harvest_template -site:wikipedia:en -namespace:14 \\
-template:"Cat main" 1 P301 -inverse:P910 -islink
diff --git a/scripts/listpages.py b/scripts/listpages.py
index c03c209..f8b4c2b 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -1,5 +1,10 @@
#!/usr/bin/env python3
-r"""Print a list of pages, as defined by page generator parameters.
+#
+# (C) Pywikibot team, 2008-2026
+#
+# Distributed under the terms of the MIT license.
+#
+"""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.
@@ -100,11 +105,6 @@
¶ms;
"""
-#
-# (C) Pywikibot team, 2008-2025
-#
-# Distributed under the terms of the MIT license.
-#
from __future__ import annotations
import os
diff --git a/scripts/maintenance/cache.py b/scripts/maintenance/cache.py
index 9cc42af..23c0876 100755
--- a/scripts/maintenance/cache.py
+++ b/scripts/maintenance/cache.py
@@ -1,5 +1,10 @@
#!/usr/bin/env python3
-r"""This script runs commands on each entry in the API caches.
+#
+# (C) Pywikibot team, 2014-2026
+#
+# Distributed under the terms of the MIT license.
+#
+"""This script runs commands on each entry in the API caches.
Syntax:
@@ -62,11 +67,6 @@
uniquedesc(entry)
"""
-#
-# (C) Pywikibot team, 2014-2024
-#
-# Distributed under the terms of the MIT license.
-#
from __future__ import annotations
import datetime
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index cab5ff4..e1a3571 100755
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -1,5 +1,10 @@
#!/usr/bin/env python3
-r"""Script to delete files that are also present on Wikimedia Commons.
+#
+# (C) Pywikibot team, 2006-2026
+#
+# Distributed under the terms of the MIT license.
+#
+"""Script to delete files that are also present on Wikimedia Commons.
Do not run this script on Wikimedia Commons itself. It works based on
a given array of templates defined below.
@@ -41,11 +46,6 @@
:py:obj:`ConfigParserBot <bot.ConfigParserBot>`. All options
can be set within a settings file which is scripts.ini by default.
"""
-#
-# (C) Pywikibot team, 2006-2024
-#
-# Distributed under the terms of the MIT license.
-#
from __future__ import annotations
import sys
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index 8b03c1d..7371568 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -4,7 +4,7 @@
#
# Distributed under the terms of the MIT license.
#
-r"""Bot to upload pages from a text file.
+"""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
diff --git a/scripts/replace.py b/scripts/replace.py
index cf32404..2115063 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -1,5 +1,10 @@
#!/usr/bin/env python3
-r"""This bot will make direct text replacements.
+#
+# (C) Pywikibot team, 2004-2026
+#
+# Distributed under the terms of the MIT license.
+#
+"""This bot will make direct text replacements.
It will retrieve information on which pages might need changes either from
an XML dump or a text file, or only change a single page.
@@ -108,7 +113,7 @@
The First argument is the old text to be replaced, the second
argument is the new text. If the ``-regex`` argument is given, the
first argument will be regarded as a regular expression, and the
- second argument might contain expressions like ``\1`` or ``\g<name>``.
+ second argument might contain expressions like ``\1`` or ``\\g<name>``.
The second parameter can also be specified as empty string, usually
``""``. It is possible to introduce more than one pair of
replacement parameters.
@@ -142,7 +147,7 @@
If you want to do more than one replacement at a time, use this:
- python pwb.py replace -xml:foobar.xml "Errror" "Error" "Faail" "Fail" \
+ python pwb.py replace -xml:foobar.xml "Errror" "Error" "Faail" "Fail" \\
-namespace:0
If you have a page called 'John Doe' and want to fix the format of ISBNs,
@@ -160,11 +165,6 @@
.. Please type "python pwb.py replace -help | more" if you can't read
the top of the help.
"""
-#
-# (C) Pywikibot team, 2004-2025
-#
-# Distributed under the terms of the MIT license.
-#
from __future__ import annotations
import re
diff --git a/scripts/revertbot.py b/scripts/revertbot.py
index 6930058..0982614 100755
--- a/scripts/revertbot.py
+++ b/scripts/revertbot.py
@@ -40,7 +40,6 @@
return bool(pattern.search(text))
return False
"""
-
from __future__ import annotations
from collections.abc import Container
diff --git a/scripts/template.py b/scripts/template.py
index 06587c7..143b0fc 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -1,5 +1,10 @@
#!/usr/bin/env python3
-r"""Very simple script to replace a template with another one.
+#
+# (C) Pywikibot team, 2003-2026
+#
+# Distributed under the terms of the MIT license.
+#
+"""Very simple script to replace a template with another one.
It also converts the old MediaWiki boilerplate format to the new format.
@@ -80,18 +85,18 @@
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 \
+ python pwb.py template -putthrottle:30 -namespace:0 lived -subst -always \\
-summary:"BOT: Substituting {{lived}}, see [[WP:SUBST]]."
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" \
+ 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."
This next example substitutes templates test1, test2, and space test on
@@ -99,11 +104,6 @@
python pwb.py template test1 test2 "space test" -subst -ns:3 -always
"""
-#
-# (C) Pywikibot team, 2003-2024
-#
-# Distributed under the terms of the MIT license.
-#
from __future__ import annotations
import re
diff --git a/scripts/transferbot.py b/scripts/transferbot.py
index adef285..d4720c5 100755
--- a/scripts/transferbot.py
+++ b/scripts/transferbot.py
@@ -4,7 +4,7 @@
#
# Distributed under the terms of the MIT license.
#
-r"""This script transfers pages from a source wiki to a target wiki.
+"""This script transfers pages from a source wiki to a target wiki.
It also copies edit history to a subpage.
@@ -34,21 +34,20 @@
Transfer all pages in category "Query service" from the English Wikipedia to
the Arabic Wiktionary, adding "Wiktionary:Import enwp/" as prefix:
- python pwb.py transferbot -site:wikipedia:en -cat:"Query service" \
+ python pwb.py transferbot -site:wikipedia:en -cat:"Query service" \\
-tofamily:wiktionary -tolang:ar -prefix:"Wiktionary:Import enwp/"
Copy the template "Query service" from the English Wikipedia to the
Arabic Wiktionary:
- python pwb.py transferbot -site:wikipedia:en -tofamily:wiktionary \
+ python pwb.py transferbot -site:wikipedia:en -tofamily:wiktionary \\
-tolang:ar -page:"Template:Query service"
Copy 10 wanted templates of German Wikipedia from English Wikipedia to German:
- python pwb.py transferbot -site:wikipedia:en -tolang:de \
+ python pwb.py transferbot -site:wikipedia:en -tolang:de \\
-wantedtemplates:10 -target
"""
-
from __future__ import annotations
import pywikibot
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1239530?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: I84bd055e591e37ec57166799a67477b3044391f7
Gerrit-Change-Number: 1239530
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]