jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[scripts] Recover interwiki.py

Bug: T278675
Change-Id: I24e93a4cad87064e58fb6e326ef3a40fa0d3daf1
---
M docs/scripts/scripts.rst
M scripts/README.rst
R scripts/interwiki.py
M scripts/interwikidata.py
M tests/pwb_tests.py
M tox.ini
6 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/docs/scripts/scripts.rst b/docs/scripts/scripts.rst
index 291246f..1fa7a03 100644
--- a/docs/scripts/scripts.rst
+++ b/docs/scripts/scripts.rst
@@ -106,6 +106,11 @@

.. automodule:: scripts.imagetransfer

+scripts.interwiki script
+------------------------
+
+.. automodule:: scripts.interwiki
+
scripts.interwikidata script
----------------------------

diff --git a/scripts/README.rst b/scripts/README.rst
index 36f1217..9f54ffe 100644
--- a/scripts/README.rst
+++ b/scripts/README.rst
@@ -61,6 +61,9 @@
| | images, and let the user choose among them for |
| | images to upload. |
+------------------------+---------------------------------------------------------+
+ | interwiki.py | A robot to check interwiki links on all pages (or |
+ | | a range of pages) of a wiki. |
+ +------------------------+---------------------------------------------------------+
| interwikidata.py | Script to handle interwiki links based on Wikibase. |
+------------------------+---------------------------------------------------------+
| listpages.py | listpages: report number of pages found |
@@ -190,9 +193,6 @@
| imageuncat.py | Adds uncat template to images without categories at |
| | Commons |
+------------------------+---------------------------------------------------------+
- | interwiki.py | A robot to check interwiki links on all pages (or |
- | | a range of pages) of a wiki. |
- +------------------------+---------------------------------------------------------+
| isbn.py | Bot to convert all ISBN-10 codes to the ISBN-13 |
| | format. |
+------------------------+---------------------------------------------------------+
diff --git a/scripts/archive/interwiki.py b/scripts/interwiki.py
similarity index 99%
rename from scripts/archive/interwiki.py
rename to scripts/interwiki.py
index bd70ad0..c46ef2d 100755
--- a/scripts/archive/interwiki.py
+++ b/scripts/interwiki.py
@@ -328,7 +328,7 @@

"""
#
-# (C) Pywikibot team, 2003-2020
+# (C) Pywikibot team, 2003-2021
#
# Distributed under the terms of the MIT license.
#
@@ -363,11 +363,12 @@
"""An attempt to save a page with changed interwiki has failed."""


-class LinkMustBeRemoved(SaveError): # noqa: D205,D400
+class LinkMustBeRemoved(SaveError):

- """
- An interwiki link has to be removed, but this can't be done because of user
- preferences or because the user chose not to change the page.
+ """An interwiki link has to be removed manually.
+
+ An interwiki link has to be removed, but this can't be done because
+ of user preferences or because the user chose not to change the page.
"""


@@ -375,8 +376,6 @@

"""User chose not to work on this page and its linked pages any more."""

- pass
-

# A list of template names in different languages.
# Pages which contain these shouldn't be changed.
diff --git a/scripts/interwikidata.py b/scripts/interwikidata.py
index 073ca0d..22f118c 100755
--- a/scripts/interwikidata.py
+++ b/scripts/interwikidata.py
@@ -61,8 +61,8 @@
})
super().__init__(**kwargs)
if not self.site.has_data_repository:
- raise ValueError('{site} does not have a data repository.'
- .format(site=self.site))
+ raise ValueError('{site} does not have a data repository, use '
+ 'interwiki.py instead.'.format(site=self.site))
self.repo = self.site.data_repository()
if not self.opt.summary:
self.opt.summary = pywikibot.i18n.twtranslate(
diff --git a/tests/pwb_tests.py b/tests/pwb_tests.py
index 2a59374..f542a67 100644
--- a/tests/pwb_tests.py
+++ b/tests/pwb_tests.py
@@ -112,7 +112,7 @@
'',
'The most similar scripts are:',
'1 - interwikidata',
- '2 - illustrate_wikidata',
+ '2 - interwiki',
]
stderr = io.StringIO(
execute_pwb(['inter_wikidata'], data_in='q')['stderr'])
diff --git a/tox.ini b/tox.ini
index 04b4e0c..13cc35a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -157,6 +157,7 @@
scripts/cosmetic_changes.py : N816
scripts/fixing_redirects.py : N803, N806
scripts/harvest_template.py : N802, N816
+ scripts/interwiki.py : N802, N803, N806, N815, N816
scripts/imagetransfer.py : N803, N806, N816
scripts/maintenance/make_i18n_dict.py : T001
scripts/misspelling.py : N802, N806

To view, visit change 675765. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I24e93a4cad87064e58fb6e326ef3a40fa0d3daf1
Gerrit-Change-Number: 675765
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged