jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/921249 )
Change subject: [doc] Adjust continued command line ......................................................................
[doc] Adjust continued command line
Change-Id: I98c000bff075a5b620e8b07b2a6f0399ae9b695e --- M scripts/category_graph.py M scripts/add_text.py M scripts/transferbot.py M scripts/template.py M scripts/coordinate_import.py M scripts/harvest_template.py M scripts/replace.py 7 files changed, 58 insertions(+), 53 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/add_text.py b/scripts/add_text.py index db8e52f..643537d 100755 --- a/scripts/add_text.py +++ b/scripts/add_text.py @@ -41,22 +41,22 @@ 1. Append 'hello world' to the bottom of the sandbox:
python pwb.py add_text -page:Wikipedia:Sandbox \ - -summary:"Bot: pywikibot practice" -text:"hello world" +-summary:"Bot: pywikibot practice" -text:"hello world"
2. Add a template to the top of the pages with 'category:catname':
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
3. Command used on it.wikipedia to put the template in the page without any category:
python pwb.py add_text -except:"{{([Tt]emplate:|)[Cc]ategorizzare" \ - -text:"{{Categorizzare}}" -excepturl:"class='catlinks'>" -uncat \ - -summary:"Bot: Aggiungo template Categorizzare" +-text:"{{Categorizzare}}" -excepturl:"class='catlinks'>" -uncat \ +-summary:"Bot: Aggiungo template Categorizzare" """ # -# (C) Pywikibot team, 2007-2022 +# (C) Pywikibot team, 2007-2023 # # Distributed under the terms of the MIT license. # diff --git a/scripts/category_graph.py b/scripts/category_graph.py index d2b17c8..fd97b8c 100755 --- a/scripts/category_graph.py +++ b/scripts/category_graph.py @@ -23,15 +23,16 @@ .. seealso:: https://graphviz.org/doc/info/attrs.html for graphviz style definitions.
-Example:: +Example +-------
pwb.py -v category_graph -from
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 fillcolor=green] edge[style=dashed penwidth=3]' +-style 'graph[rankdir=BT ranksep=0.5] node[shape=circle style=filled \ +fillcolor=green] edge[style=dashed penwidth=3]'
.. versionadded:: 8.0 """ diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py index 392c671..22de794 100755 --- a/scripts/coordinate_import.py +++ b/scripts/coordinate_import.py @@ -5,7 +5,7 @@ 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. @@ -17,16 +17,17 @@
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 + python pwb.py coordinate_import -lang:it -family:wikipedia -namespace:0 \ +-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 explicitly provide the repo as the site using -site argument. + Example:
- python pwb.py coordinate_import -site:wikidata:wikidata \ - -namespace:0 -querypage:Deadendpages + python pwb.py coordinate_import -site:wikidata:wikidata -namespace:0 \ +-querypage:Deadendpages
The following command line parameters are supported: @@ -43,7 +44,7 @@ ¶ms; """ # -# (C) Pywikibot team, 2013-2022 +# (C) Pywikibot team, 2013-2023 # # Distributed under the terms of MIT License. # diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py index 6acabdc..0fa7597 100755 --- a/scripts/harvest_template.py +++ b/scripts/harvest_template.py @@ -4,14 +4,13 @@
Usage (see below for explanations and examples):
- 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] \ - [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] [template_parameter PID [local optional arguments]]
This will work on all pages that transclude the template in the article namespace @@ -53,27 +52,27 @@ "P18" (image):
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \ - -template:"Infobox person" image P18 +-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 -lang:en -family:wikipedia -namespace:0 \ - -template:"Infobox person" image P18 birth_place P19 +-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 -lang:en -family:wikipedia -namespace:0 \ - -template:"Infobox person" -islink birth_place P19 death_place P20 +-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 -lang:en -family:wikipedia -namespace:0 \ - -template:"Infobox person" birth_place P19 -islink death_place P20 +-template:"Infobox person" birth_place P19 -islink death_place P20
The following command will import an occupation from "occupation" parameter of "Infobox person" on English Wikipedia as Wikidata property "P106" @@ -81,7 +80,7 @@ property but there is not the new value:
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \ - -template:"Infobox person" occupation P106 -exists:p +-template:"Infobox person" occupation P106 -exists:p
The following command will import band members from the "current_members" parameter of "Infobox musical artist" on English Wikipedia as Wikidata @@ -89,8 +88,7 @@ if each is linked, and will not add duplicate claims for the same member:
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \ - -template:"Infobox musical artist" current_members P527 -exists:p \ - -multi +-template:"Infobox musical artist" current_members P527 -exists:p -multi
The following command will import the category's main topic from the first anonymous parameter of "Cat main" on English Wikipedia as Wikidata property @@ -99,7 +97,8 @@ (topic's main category) unless a claim of that property is already there:
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:14 \ - -template:"Cat main" 1 P301 -inverse:P910 -islink +-template:"Cat main" 1 P301 -inverse:P910 -islink +
.. note:: This script is a :py:obj:`ConfigParserBot <bot.ConfigParserBot>`. All options @@ -108,7 +107,7 @@ the -inverse option. """ # -# (C) Pywikibot team, 2013-2022 +# (C) Pywikibot team, 2013-2023 # # Distributed under the terms of MIT License. # diff --git a/scripts/replace.py b/scripts/replace.py index 2a19090..557e7b4 100755 --- a/scripts/replace.py +++ b/scripts/replace.py @@ -127,7 +127,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" \ - -namespace:0 +-namespace:0
If you have a page called 'John Doe' and want to fix the format of ISBNs, use:
@@ -142,7 +142,7 @@ the top of the help. """ # -# (C) Pywikibot team, 2004-2022 +# (C) Pywikibot team, 2004-2023 # # Distributed under the terms of the MIT license. # diff --git a/scripts/template.py b/scripts/template.py index f8a1081..118c3f4 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -75,37 +75,33 @@
python pwb.py template test -subst -namespace:2 -namespace:3
-Note that -namespace: is a global Pywikibot parameter - +.. 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:
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:
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):
python pwb.py template test1 test2 "space test" -subst -ns:3 -always - """ # -# (C) Pywikibot team, 2003-2022 +# (C) Pywikibot team, 2003-2023 # # Distributed under the terms of the MIT license. # diff --git a/scripts/transferbot.py b/scripts/transferbot.py index 726c007..67791e6 100755 --- a/scripts/transferbot.py +++ b/scripts/transferbot.py @@ -31,22 +31,21 @@ the Arabic Wiktionary, adding "Wiktionary:Import enwp/" as prefix:
python pwb.py transferbot -family:wikipedia -lang:en -cat:"Query service" \ - -tofamily:wiktionary -tolang:ar -prefix:"Wiktionary:Import enwp/" +-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 -family:wikipedia -lang:en \ - -tofamily:wiktionary -tolang:ar -page:"Template:Query service" + python pwb.py transferbot -family:wikipedia -lang: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 -family:wikipedia -lang:en \ - -tolang:de -wantedtemplates:10 -target - + python pwb.py transferbot -family:wikipedia -lang:en -tolang:de \ +-wantedtemplates:10 -target """ # -# (C) Pywikibot team, 2014-2022 +# (C) Pywikibot team, 2014-2023 # # Distributed under the terms of the MIT license. #