jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332482?usp=email )
Change subject: [docs] Remove sphinx.ext.napoleon due to RemovedInSphinx11Warning ...................................................................... [docs] Remove sphinx.ext.napoleon due to RemovedInSphinx11Warning See: https://github.com/sphinx-doc/sphinx/issues/14270 Bug: T436451 Change-Id: I46ce583b62d07c7c9fda0f6974c7616f2f47a564 --- M CODE_OF_CONDUCT.rst M docs/conf.py M pywikibot/time.py M scripts/add_text.py M scripts/category_graph.py M scripts/delete.py M scripts/harvest_template.py M scripts/image.py M scripts/maintenance/cache.py M scripts/nowcommons.py M scripts/protect.py M scripts/replace.py M scripts/template.py M scripts/templatecount.py M scripts/transferbot.py M scripts/transwikiimport.py M scripts/unlink.py M scripts/weblinkchecker.py M scripts/welcome.py 19 files changed, 237 insertions(+), 246 deletions(-) Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst index 370b7a0..bff0cfc 100644 --- a/CODE_OF_CONDUCT.rst +++ b/CODE_OF_CONDUCT.rst @@ -1,5 +1,5 @@ Code of Conduct =============== -The development of this software is covered by a -`Code of Conduct <https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct>`_. +The development of this software is covered by a `MediaWiki Code of Conduct +<https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct>`_. diff --git a/docs/conf.py b/docs/conf.py index df97871..840c406 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -58,7 +58,6 @@ 'sphinx.ext.autosummary', 'sphinx.ext.extlinks', 'sphinx.ext.linkcode', - 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', 'sphinx_copybutton', 'sphinx_tabs.tabs', @@ -473,16 +472,9 @@ # autosectionlabel_prefix_document = True suppress_warnings = [ 'autosectionlabel.*', - 'sphinx.ext.napoleon.RemovedInSphinx11Warning', ] toc_object_entries_show_parents = 'hide' -# Napoleon settings -napoleon_use_admonition_for_examples = True -napoleon_use_admonition_for_notes = True -napoleon_use_admonition_for_references = True -napoleon_custom_sections = ['Advice', 'Hints', 'Rights'] - python_use_unqualified_type_names = True modindex_common_prefix = ['pywikibot.scripts.'] diff --git a/pywikibot/time.py b/pywikibot/time.py index 0b19319..942626b 100644 --- a/pywikibot/time.py +++ b/pywikibot/time.py @@ -267,8 +267,7 @@ the *strict* parameter was added which discards missing element tolerance. - Example - ------- + **Example:** >>> Timestamp.fromtimestampformat('20220705082234') Timestamp(2022, 7, 5, 8, 22, 34) diff --git a/scripts/add_text.py b/scripts/add_text.py index 28a1d33..add8687 100755 --- a/scripts/add_text.py +++ b/scripts/add_text.py @@ -41,31 +41,30 @@ ¶ms; -Examples --------- +.. admonition:: Examples -Append 'hello world' to the bottom of the sandbox: + Append 'hello world' to the bottom of the sandbox: -.. code-block:: batch + .. code-block:: batch - python pwb.py add_text -page:Wikipedia:Sandbox - -summary:"Bot: pywikibot practice" -text:"hello world" + python pwb.py add_text -page:Wikipedia:Sandbox + -summary:"Bot: pywikibot practice" -text:"hello world" -Add a template to the top of the pages with 'category:catname': + Add a template to the top of the pages with 'category:catname': -.. code-block:: batch + .. code-block:: batch - python pwb.py add_text -cat:catname -summary:"Bot: Adding a template" - -text:"{{Something}}" -except:"\\{\\{([Tt]emplate:|)[Ss]omething" -up + python pwb.py add_text -cat:catname -summary:"Bot: Adding a template" + -text:"{{Something}}" -except:"\\{\\{([Tt]emplate:|)[Ss]omething" -up -Command used on it.wikipedia to put the template in the page without any -category: + Command used on it.wikipedia to put the template in the page without + any category: -.. code-block:: batch + .. code-block:: batch - python pwb.py add_text -except:"\\{\\{([Tt]emplate:|)[Cc]ategorizzare" - -text:"{{Categorizzare}}" -excepturl:"class='catlinks'>" -uncat - -summary:"Bot: Aggiungo template Categorizzare" + 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 diff --git a/scripts/category_graph.py b/scripts/category_graph.py index 69cea23..75b224d 100755 --- a/scripts/category_graph.py +++ b/scripts/category_graph.py @@ -34,19 +34,21 @@ .. seealso:: https://graphviz.org/doc/info/attrs.html for graphviz style definitions. -Example -------- +.. admonition:: Examples -Visualizes main category: + Visualizes main category: - pwb.py -v category_graph -from + .. code-block:: bash -Extended example with style settings: + pwb.py -v category_graph -from - 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]' + Extended example with style settings: + .. code-block:: bash + + 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]' .. version-added:: 8.0 """ diff --git a/scripts/delete.py b/scripts/delete.py index 4056eb3..e6fd86a 100755 --- a/scripts/delete.py +++ b/scripts/delete.py @@ -45,12 +45,11 @@ -orphansonly:0,1 -orphansonly:,Talk -Usage: +**Usage:** python pwb.py delete [-category categoryName] -Examples --------- +**Examples:** Delete everything in the category "To delete" without prompting: diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py index b977370..2226c83 100755 --- a/scripts/harvest_template.py +++ b/scripts/harvest_template.py @@ -50,62 +50,61 @@ -inverse Import this property as the inverse claim. -Examples --------- +.. admonition:: Examples -The following command will try to import existing images from "image" -parameter of "Infobox person" on English Wikipedia as Wikidata property -"P18" (image): + The following command will try to import existing images from "image" + parameter of "Infobox person" on English Wikipedia as Wikidata + property "P18" (image): - python pwb.py harvest_template -site:wikipedia:en -namespace:0 \\ - -template:"Infobox person" image P18 + 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): + 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 \\ - -template:"Infobox person" image P18 birth_place P19 + 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]]: + 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 \\ - -template:"Infobox person" -islink birth_place P19 death_place P20 + 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: + 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 \\ - -template:"Infobox person" birth_place P19 -islink death_place P20 + 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" -parameter of "Infobox person" on English Wikipedia as Wikidata property -"P106" (occupation). The page won't be skipped if the item already has -that property but there is not the new value: + The following command will import an occupation from "occupation" + parameter of "Infobox person" on English Wikipedia as Wikidata + property "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 \\ - -template:"Infobox person" occupation P106 -exists:p + 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" -parameter of "Infobox musical artist" on English Wikipedia as Wikidata -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: + The following command will import band members from the + "current_members" parameter of "Infobox musical artist" on English + Wikipedia as Wikidata 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 \\ - -template:"Infobox musical artist" current_members P527 -exists:p -multi + 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 -first anonymous parameter of "Cat main" on English Wikipedia as Wikidata -property "P301" (category's main topic) and whenever a new value is -imported, the inverse claim is imported to the topic item as Wikidata -property "P910" (topic's main category) unless a claim of that property -is already there: + The following command will import the category's main topic from the + first anonymous parameter of "Cat main" on English Wikipedia as + Wikidata property "P301" (category's main topic) and whenever a new + value is imported, the inverse claim is imported to the topic item as + Wikidata 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 \\ - -template:"Cat main" 1 P301 -inverse:P910 -islink - + python pwb.py harvest_template -site:wikipedia:en -namespace:14 \\ + -template:"Cat main" 1 P301 -inverse:P910 -islink .. note:: This script is a :py:obj:`ConfigParserBot <bot.ConfigParserBot>`. All options diff --git a/scripts/image.py b/scripts/image.py index d34157c..743ec8c 100755 --- a/scripts/image.py +++ b/scripts/image.py @@ -29,18 +29,18 @@ image galleries. However, it can also make more mistakes. This only works with image replacement, not image removal. -Examples --------- +.. admonition:: 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 + 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 + python pwb.py image Flag.jpg Flag.svg + """ from __future__ import annotations diff --git a/scripts/maintenance/cache.py b/scripts/maintenance/cache.py index 40435cc..b97ad6f 100755 --- a/scripts/maintenance/cache.py +++ b/scripts/maintenance/cache.py @@ -26,29 +26,29 @@ -o Output command which is output when the filter evaluated to True. If it returns None it won't output anything. -Examples --------- +.. admonition:: Examples - Print the filename of any entry with 'wikidata' in the key: + Print the filename of any entry with 'wikidata' in the key: - -c "wikidata" in entry._uniquedescriptionstr() + -c "wikidata" in entry._uniquedescriptionstr() - Customised output if the site code is 'ar': + Customised output if the site code is 'ar': - -c entry.site.code == "ar" - -o uniquedesc(entry) + -c entry.site.code == "ar" + -o uniquedesc(entry) - Or the state of the login: + Or the state of the login: - -c entry.site._loginstatus == LoginStatus.NOT_ATTEMPTED - -o uniquedesc(entry) + -c entry.site._loginstatus == LoginStatus.NOT_ATTEMPTED + -o uniquedesc(entry) - If the function only uses one parameter for the entry it can be omitted: + If the function only uses one parameter for the entry it can be + omitted: - -c has_password - -o uniquedesc + -c has_password + -o uniquedesc -Available filter commands: +Available filter commands:: has_password(entry) is_logout(entry) @@ -58,12 +58,12 @@ older_than_one_day(entry) recent(entry) -There are helper functions which can be part of a command: +There are helper functions which can be part of a command:: older_than(entry, interval) newer_than(entry, interval) -Available output commands: +Available output commands:: uniquedesc(entry) """ diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py index 6c4a0a7..13bbf6c 100755 --- a/scripts/nowcommons.py +++ b/scripts/nowcommons.py @@ -18,33 +18,34 @@ This script understands various command-line arguments: - -always run automatically, do not ask any questions. All files - that qualify for deletion are deleted. Reduced screen - output. +-always run automatically, do not ask any questions. All files + that qualify for deletion are deleted. Reduced screen + output. - -replace replace links if the files are equal and the file names - differ +-replace replace links if the files are equal and the file names + differ - -replacealways replace links if the files are equal and the file names - differ without asking for confirmation +-replacealways replace links if the files are equal and the file names + differ without asking for confirmation - -replaceloose Do loose replacements. This will replace all occurrences - of the name of the file (and not just explicit file - syntax). This should work to catch all instances of the - file, including where it is used as a template parameter - or in galleries. However, it can also make more mistakes. +-replaceloose Do loose replacements. This will replace all occurrences + of the name of the file (and not just explicit file + syntax). This should work to catch all instances of the + file, including where it is used as a template parameter + or in galleries. However, it can also make more mistakes. - -replaceonly Use this if you do not have a local sysop rights, but do - wish to replace links from the NowCommons template. +-replaceonly Use this if you do not have a local sysop rights, but do + wish to replace links from the NowCommons template. -Example -------- +.. admonition:: Example - python pwb.py nowcommons -replaceonly -replaceloose -replacealways -replace + :: + + pwb.py nowcommons -replaceonly -replaceloose -replacealways -replace .. 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. + :class:`ConfigParserBot <bot.ConfigParserBot>`. All options can be + set within a settings file which is scripts.ini by default. """ from __future__ import annotations diff --git a/scripts/protect.py b/scripts/protect.py index 33ee83a..3a59c02 100755 --- a/scripts/protect.py +++ b/scripts/protect.py @@ -45,20 +45,21 @@ relative and absolute, is acceptable. See: :api:`Protect#Parameters` -Usage: +**Usage:** python pwb.py protect <OPTIONS> -Examples --------- +**Examples:** Protect everything in the category 'To protect' prompting: python pwb.py protect -cat:"To protect" -Unprotect all pages listed in text file 'unprotect.txt' without prompting: +Unprotect all pages listed in text file 'unprotect.txt' without +prompting: python pwb.py protect -file:unprotect.txt -unprotect -always + """ from __future__ import annotations diff --git a/scripts/replace.py b/scripts/replace.py index c36c44b..d3ebded 100755 --- a/scripts/replace.py +++ b/scripts/replace.py @@ -130,36 +130,34 @@ for all replace options and arguments following this delimiter and enables empty strings. -Examples --------- +.. admonition:: **Examples** -If you want to change templates from the old syntax, e.g. -``{{msg:Stub}}``, to the new syntax, e.g. ``{{Stub}}``, download an XML -dump file (pages-articles) from https://dumps.wikimedia.org, then use -this command: + If you want to change templates from the old syntax, e.g. + ``{{msg:Stub}}``, to the new syntax, e.g. ``{{Stub}}``, download an + XML dump file (pages-articles) from https://dumps.wikimedia.org, then + use this command: - python pwb.py replace -xml -regex "{{msg:(.*?)}}" "{{\1}}" + python pwb.py replace -xml -regex "{{msg:(.*?)}}" "{{\1}}" -If you have a dump called ``foobar.xml`` and want to fix typos in -articles, e.g. Errror -> Error, use this: + If you have a dump called ``foobar.xml`` and want to fix typos in + articles, e.g. Errror -> Error, use this: - python pwb.py replace -xml:foobar.xml "Errror" "Error" -namespace:0 + python pwb.py replace -xml:foobar.xml "Errror" "Error" -namespace:0 -If you want to do more than one replacement at a time, use this: + 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 + 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, -use: + If you have a page called 'John Doe' and want to fix the format of + ISBNs, use: - python pwb.py replace -page:John_Doe -fix:isbn + python pwb.py replace -page:John_Doe -fix:isbn -This command will change 'referer' to 'referrer', but not in pages which -talk about HTTP, where the typo has become part of the standard: + This command will change 'referer' to 'referrer', but not in pages + which talk about HTTP, where the typo has become part of the standard: - python pwb.py replace referer referrer -file:typos.txt -excepttext:HTTP - + python pwb.py replace referer referrer -file:typos.txt -excepttext:HTTP .. seealso:: :mod:`scripts.template` to modify or remove templates. .. Please type "python pwb.py replace -help | more" if you can't read diff --git a/scripts/template.py b/scripts/template.py index 2ceb6ba..7d7db88 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -62,47 +62,48 @@ new name. If you want to address a template which has spaces, put quotation marks around it, or use underscores. -Examples --------- +.. admonition:: 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" + python pwb.py template "Cities in Washington" "Cities in Washington \\ + state" -Move the page [[Template:Cities in Washington]] manually afterwards. + 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 - python pwb.py template test -subst -namespace:2 -namespace:3 + .. note:: -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:: -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]]." - 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:: -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." - 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 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 - python pwb.py template test1 test2 "space test" -subst -ns:3 -always """ from __future__ import annotations diff --git a/scripts/templatecount.py b/scripts/templatecount.py index c1ae563..2119083 100755 --- a/scripts/templatecount.py +++ b/scripts/templatecount.py @@ -24,16 +24,17 @@ -namespace: Filters the search to a given namespace. If this is specified multiple times it will search all given namespaces -Examples --------- +.. admonition:: Examples -Counts how many times {{ref}} and {{note}} are transcluded in articles: + Counts how many times {{ref}} and {{note}} are transcluded in + articles: - python pwb.py templatecount -count -namespace:0 ref note + python pwb.py templatecount -count -namespace:0 ref note -Lists all the category pages that transclude {{cfd}} and {{cfdu}}: + Lists all the category pages that transclude {{cfd}} and {{cfdu}}: - python pwb.py templatecount -list -namespace:14 cfd cfdu + python pwb.py templatecount -list -namespace:14 cfd cfdu + """ from __future__ import annotations diff --git a/scripts/transferbot.py b/scripts/transferbot.py index d4720c5..4b5da94 100755 --- a/scripts/transferbot.py +++ b/scripts/transferbot.py @@ -28,25 +28,27 @@ ¶ms; -Examples --------- +.. admonition:: Examples -Transfer all pages in category "Query service" from the English Wikipedia to -the Arabic Wiktionary, adding "Wiktionary:Import enwp/" as prefix: + 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" \\ - -tofamily:wiktionary -tolang:ar -prefix:"Wiktionary:Import enwp/" + 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: + Copy the template "Query service" from the English Wikipedia to the + Arabic Wiktionary: - python pwb.py transferbot -site:wikipedia:en -tofamily:wiktionary \\ - -tolang:ar -page:"Template:Query service" + 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: + Copy 10 wanted templates of German Wikipedia from English Wikipedia + to German: - python pwb.py transferbot -site:wikipedia:en -tolang:de \\ - -wantedtemplates:10 -target + python pwb.py transferbot -site:wikipedia:en -tolang:de \\ + -wantedtemplates:10 -target + """ from __future__ import annotations diff --git a/scripts/transwikiimport.py b/scripts/transwikiimport.py index dcaf149..a224b07 100755 --- a/scripts/transwikiimport.py +++ b/scripts/transwikiimport.py @@ -42,39 +42,38 @@ ¶ms; -Examples --------- + +**Examples:** Transfer all pages in category "Query service" from the English Wikipedia to the home Wikipedia, adding "Wikipedia:Import enwp/" as prefix: - python pwb.py transwikiimport -interwikisource:en -cat:"Query service" \ --prefix:"Wikipedia:Import enwp/" -fullhistory -assignknownusers + python pwb.py transwikiimport -interwikisource:en -cat:"Query service" \ + -prefix:"Wikipedia:Import enwp/" -fullhistory -assignknownusers Copy the template "Query service" from the English Wikipedia to the home Wiktionary: - python pwb.py transferbot -interwikisource:w:en \ --page:"Template:Query service" -fullhistory -assignknownusers + python pwb.py transwikiimport -interwikisource:w:en \ + -page:"Template:Query service" -fullhistory -assignknownusers Copy 10 wanted templates of the home Wikipedia from English Wikipedia to the home Wikipedia: - python pwb.py transferbot -interwikisource:en -wantedtemplates:10 \ --target -fullhistory -assignknownusers + python pwb.py transwikiimport -interwikisource:en -wantedtemplates:10 \ + -target -fullhistory -assignknownusers -Advice ------- +**Advice:** The module gives access to all parameters of the API (and special page) -and is compatible to the :mod:`scripts.transferbot` script. -However for most scenarios the parameters ``-overwrite``, ``-target`` and +and is compatible to the :mod:`scripts.transferbot` script. However for +most scenarios the parameters ``-overwrite``, ``-target`` and ``-includealltemplates`` should be avoided; by default they are set to -False. +``False``. -The correspondingnamespace is used only if the namespaces on both wikis +The corresponding namespace is used only if the namespaces on both wikis do not correspond one with another. Correspondingnamespace and rootpage are mutually exclusive. @@ -87,26 +86,26 @@ The list of pages to be imported can be generated outside of Pywikibot: - for i in {1..10} ; do python3 pwb.py transwikiimport \ --interwikisource:mul -page:"Page:How to become famous.djvu/$i" \ --fullhistory -assignknownusers ; done + for i in {1..10} ; do python3 pwb.py transwikiimport \ + -interwikisource:mul -page:"Page:How to become famous.djvu/$i" \ + -fullhistory -assignknownusers ; done -*The pages *``Page:How to become famous.djvu/1``*, +The pages *``Page:How to become famous.djvu/1``*, *``Page:How to become famous.djvu/2``* .. *``Page:How to become famous.djvu/10``* will be copied from wikisource (mul) to the home-wikisource, all versions will be imported and the -usernames will be identified (existing pages will be skipped).* +usernames will be identified (existing pages will be skipped). Or generated using the usual pywikibot generators: - python3 pwb.py transwikiimport -interwikisource:mul \ --prefixindex:"Page:How to become famous.djvu" -fullhistory \ --assignknownusers -summary:"Book copied from oldwiki." + python3 pwb.py transwikiimport -interwikisource:mul \ + -prefixindex:"Page:How to become famous.djvu" -fullhistory \ + -assignknownusers -summary:"Book copied from oldwiki." -*All pages like *``Page:How to become famous.djvu``*... will be copied +All pages like *``Page:How to become famous.djvu``*... will be copied from wikisource (mul) to the home-wikisource, all versions will be imported and the usernames will be identified (existing pages will be -skipped).* +skipped). The global option ``-simulate`` disables the import and the bot prints the names of the pages that would be imported. Since the import of pages @@ -120,21 +119,19 @@ This option is quite *dangerous*. If the title of an existing page on home wiki clashes with the title of one of the linked pages it would be -*overwritten*. The histories would be merged. (If the imported version is -newer.) Even if ``-overwrite`` is not set the linked page *can be +*overwritten*. The histories would be merged. (If the imported version +is newer.) Even if ``-overwrite`` is not set the linked page *can be overwritten*. -Hints ------ +**Hints:** The list of wikis that can be used as an interwiki source is defined in the variable ``$wgImportSources``. It can be viewed on the ``Special:Import`` page. -Rights ------- +**Rights:** For transwikiimport script and even to access the ``Special:Import`` page the appropriate flag on the account must be set, usually diff --git a/scripts/unlink.py b/scripts/unlink.py index 03ef40c..20aa535 100755 --- a/scripts/unlink.py +++ b/scripts/unlink.py @@ -16,13 +16,12 @@ Any other parameter will be regarded as the title of the page that should be unlinked. -Example -------- +.. admonition:: Example -Removes links to the page [[Foo bar]] in articles and image -descriptions: + Removes links to the page [[Foo bar]] in articles and image + descriptions: - python pwb.py unlink "Foo bar" -namespace:0 -namespace:6 + python pwb.py unlink "Foo bar" -namespace:0 -namespace:6 .. version-changed:: 6.0 diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py index bb4edfc..49e0815 100755 --- a/scripts/weblinkchecker.py +++ b/scripts/weblinkchecker.py @@ -82,30 +82,30 @@ weblink_dead_days sets the timespan (default: one week) after which a dead link will be reported -Examples --------- +.. admonition:: Examples -Loads all wiki pages in alphabetical order using the Special:Allpages -feature: + Loads all wiki pages in alphabetical order using the + ``Special:Allpages`` feature: - python pwb.py weblinkchecker -start:! + python pwb.py weblinkchecker -start:! -Loads all wiki pages using the Special:Allpages feature, starting at -"Example page": + Loads all wiki pages using the Special:Allpages feature, starting at + "Example page": - python pwb.py weblinkchecker -start:Example_page + python pwb.py weblinkchecker -start:Example_page -Loads all wiki pages that link to www.example.org: + Loads all wiki pages that link to www.example.org: - python pwb.py weblinkchecker -weblink:www.example.org + python pwb.py weblinkchecker -weblink:www.example.org -Only checks links found in the wiki page "Example page": + Only checks links found in the wiki page "Example page": - python pwb.py weblinkchecker Example page + python pwb.py weblinkchecker Example page -Loads all wiki pages where dead links were found during a prior run: + Loads all wiki pages where dead links were found during a prior run: - python pwb.py weblinkchecker -repeat + python pwb.py weblinkchecker -repeat + """ from __future__ import annotations diff --git a/scripts/welcome.py b/scripts/welcome.py index 057ddef..75d57c2 100755 --- a/scripts/welcome.py +++ b/scripts/welcome.py @@ -91,8 +91,9 @@ -quiet Prevents users without contributions are displayed + GUIDE ------ +^^^^^ **Report, Bad and white list guide** @@ -161,7 +162,7 @@ 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 -- To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332482?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: I46ce583b62d07c7c9fda0f6974c7616f2f47a564 Gerrit-Change-Number: 1332482 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]
