jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[script] recover several scripts

- restore commonscat.py
- restore patrol.py
- restore watchlist.py

https://www.mediawiki.org/wiki/Topic:Vlmedx92b2ex4jtx

Bug: T279250
Bug: T279251
Change-Id: I2258c3ac83fe7b51b5e8a7ae1aea8391685b92ad
---
M docs/scripts/scripts.rst
M requirements.txt
M scripts/README.rst
R scripts/commonscat.py
R scripts/patrol.py
R scripts/watchlist.py
M setup.py
M tests/__init__.py
R tests/patrolbot_tests.py
R tests/reflinks_tests.py
M tests/script_tests.py
M tox.ini
12 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/docs/scripts/scripts.rst b/docs/scripts/scripts.rst
index 56028be..5e79910 100644
--- a/docs/scripts/scripts.rst
+++ b/docs/scripts/scripts.rst
@@ -63,6 +63,11 @@

.. automodule:: scripts.commons_information

+commonscat script
+-----------------
+
+.. automodule:: scripts.commonscat
+
coordinate\_import script
-------------------------

@@ -148,6 +153,11 @@

.. automodule:: scripts.parser_function_count

+patrol script
+-------------
+
+.. automodule:: scripts.patrol
+
protect script
--------------

@@ -228,6 +238,11 @@

.. automodule:: scripts.version

+watchlist script
+----------------
+
+.. automodule:: scripts.watchlist
+
weblinkchecker script
---------------------

diff --git a/requirements.txt b/requirements.txt
index a3338c8..1bf0a27 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -42,7 +42,7 @@
google >= 1.7
sseclient >= 0.0.18,!=0.0.23,!=0.0.24

-# textlib.py
+# textlib.py, commons_information and patrol.py
mwparserfromhell>=0.5.0

# The mysql generator in pagegenerators depends on PyMySQL
diff --git a/scripts/README.rst b/scripts/README.rst
index 9f54ffe..bd3511d 100644
--- a/scripts/README.rst
+++ b/scripts/README.rst
@@ -40,6 +40,10 @@
+------------------------+---------------------------------------------------------+
| clean_sandbox.py | This bot makes the cleaned of the page of tests. |
+------------------------+---------------------------------------------------------+
+ | commonscat.py | Adds {{commonscat}} to Wikipedia categories (or |
+ | | articles), if other language wikipedia already has such |
+ | | a template |
+ +------------------------+---------------------------------------------------------+
| commons_information.py | Insert a language template into the description field |
+------------------------+---------------------------------------------------------+
| coordinate_import.py | Coordinate importing script. |
@@ -132,6 +136,8 @@
| version.py | Outputs Pywikibot's revision number, Python's version |
| | and OS used. |
+------------------------+---------------------------------------------------------+
+ | watchlists.py | Information retrieved by watchlist.py will be stored |
+ +------------------------+---------------------------------------------------------+
| weblinkchecker.py | Check if external links are still working. |
+------------------------+---------------------------------------------------------+
| welcome.py | Script to welcome new users. |
@@ -156,10 +162,6 @@
| commons_link.py | This robot include commons template to linking Commons |
| | and your wiki project. |
+------------------------+---------------------------------------------------------+
- | commonscat.py | Adds {{commonscat}} to Wikipedia categories (or |
- | | articles), if other language wikipedia already has such |
- | | a template |
- +------------------------+---------------------------------------------------------+
| create_categories.py | Program to batch create categories. |
+------------------------+---------------------------------------------------------+
| data_ingestion.py | A generic bot to do batch uploading to Commons. |
@@ -234,8 +236,6 @@
+------------------------+---------------------------------------------------------+
| unlink.py | This bot unlinks a page on every page that links to it. |
+------------------------+---------------------------------------------------------+
- | watchlists.py | Information retrieved by watchlist.py will be stored |
- +------------------------+---------------------------------------------------------+
| wikisourcetext.py | This bot applies to Wikisource sites to upload text. |
+------------------------+---------------------------------------------------------+

diff --git a/scripts/archive/commonscat.py b/scripts/commonscat.py
similarity index 99%
rename from scripts/archive/commonscat.py
rename to scripts/commonscat.py
index 4af2458..97d1db8 100755
--- a/scripts/archive/commonscat.py
+++ b/scripts/commonscat.py
@@ -408,7 +408,7 @@
# fallback to interwiki pages
return self.findCommonscatLink(page)

- def getCommonscatLink(self, wikipediaPage=None):
+ def getCommonscatLink(self, wikipediaPage=None): # noqa N802, N803
"""Find CommonsCat template on page.

@rtype: tuple of (<templatename>, <target>, <linktext>, <note>)
diff --git a/scripts/archive/patrol.py b/scripts/patrol.py
similarity index 100%
rename from scripts/archive/patrol.py
rename to scripts/patrol.py
diff --git a/scripts/archive/watchlist.py b/scripts/watchlist.py
similarity index 98%
rename from scripts/archive/watchlist.py
rename to scripts/watchlist.py
index 8738154..25eb96a 100755
--- a/scripts/archive/watchlist.py
+++ b/scripts/watchlist.py
@@ -61,7 +61,7 @@
'for all wikis.'.format(wl_count_all))


-def isWatched(pageName, site=None):
+def isWatched(pageName, site=None): # noqa N802, N803
"""Check whether a page is being watched."""
watchlist = get(site)
return pageName in watchlist
diff --git a/setup.py b/setup.py
index 58d111e..6b34da3 100644
--- a/setup.py
+++ b/setup.py
@@ -93,6 +93,8 @@

# ------- setup extra_requires for scripts ------- #
script_deps = {
+ 'commons_information.py': extra_deps['mwparserfromhell'],
+ 'patrol.py': extra_deps['mwparserfromhell'],
'weblinkchecker.py': ['memento_client!=0.6.0,>=0.5.1'],
}

diff --git a/tests/__init__.py b/tests/__init__.py
index 2602c96..5cccc06 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -145,9 +145,11 @@
'generate_user_files',
'interwikidata',
'l10n',
+ 'patrolbot',
'protectbot',
'pwb',
'redirect_bot',
+ 'reflinks',
'replacebot',
'script',
'template_bot',
diff --git a/tests/archive/patrolbot_tests.py b/tests/patrolbot_tests.py
similarity index 100%
rename from tests/archive/patrolbot_tests.py
rename to tests/patrolbot_tests.py
diff --git a/tests/archive/reflinks_tests.py b/tests/reflinks_tests.py
similarity index 99%
rename from tests/archive/reflinks_tests.py
rename to tests/reflinks_tests.py
index 5bdca2e..2c91431 100644
--- a/tests/archive/reflinks_tests.py
+++ b/tests/reflinks_tests.py
@@ -54,7 +54,7 @@
self.assertPageTitlesEqual(pages, ('Fake page', 'Talk:Fake page'),
site=self.get_site())

- def test_namespace_None(self):
+ def test_namespace_none(self):
"""Test namespaces=None processes all namespaces."""
gen = XmlDumpPageGenerator(
filename=join_xml_data_path('dummy-reflinks.xml'),
diff --git a/tests/script_tests.py b/tests/script_tests.py
index b07c1a7..c2a6dd7 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -22,6 +22,7 @@
# These dependencies are not always the package name which is in setup.py.
# Here, the name given to the module which will be imported is required.
script_deps = {
+ 'patrol': ['mwparserfromhell'],
'weblinkchecker': ['memento_client'],
}

@@ -82,9 +83,11 @@
'revertbot',
'noreferences',
'parser_function_count',
+ 'patrol',
'shell',
'unusedfiles',
'upload',
+ 'watchlist',
'welcome',
]

diff --git a/tox.ini b/tox.ini
index 032eb03..d68e21d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -154,6 +154,7 @@
scripts/category_redirect.py : N802, N803, N806
scripts/checkimages.py : N801, N802, N803, N806, N816
scripts/clean_sandbox.py : N816
+ scripts/commonscat.py : N802, N806, N816
scripts/cosmetic_changes.py : N816
scripts/fixing_redirects.py : N803, N806
scripts/harvest_template.py : N802, N816

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2258c3ac83fe7b51b5e8a7ae1aea8391685b92ad
Gerrit-Change-Number: 676855
Gerrit-PatchSet: 2
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