jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/398024 )
Change subject: [compat] Remove compat module
......................................................................
[compat] Remove compat module
core branch is now 12 years old and decommission of compat was closed
four years ago. The compat module was created in 2012 and older
catlib and userlib where merged into that folder in 2014.
The framework is not using this compatibility modul anymore and bot
operators got a future warning for their private scripts when the
module is used.
The README-conversion.txt as well as the maintenance/compat2core.py
script was updated years ago not to use this framework part anymore.
There are core framework equivalent parts for userlib, catlib and the
query module and the behaviour of the old parts was never tested.
Anyway the compat implementation of User, Categrory and query is
very different from the core implementation and it is time to take
the next step.
- drop compat library module
- remove references from docs
- remove compat folder from pwb sys path
- update docs
Bug: T183085
Change-Id: I32cd9ca2d1ef32a25f741fe46160317cb649c4ef
---
M HISTORY.rst
M pwb.py
M pywikibot/CONTENT.rst
M pywikibot/DIRECTORIES.rst
D pywikibot/compat/__init__.py
D pywikibot/compat/catlib.py
D pywikibot/compat/query.py
D pywikibot/compat/userlib.py
M scripts/maintenance/compat2core.py
9 files changed, 7 insertions(+), 125 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index d20bf13..e7f4b00 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,7 @@
Current release
---------------
+* compat module has been removed (T183085)
* Category.copyTo and Category.copyAndKeep methods have been removed
* Use site.userinfo getter instead of site._userinfo within api (T243794)
* Fix endprefix parameter in Category.articles() (T247201)
diff --git a/pwb.py b/pwb.py
index 945694f..28eb5b9 100755
--- a/pwb.py
+++ b/pwb.py
@@ -14,7 +14,7 @@
python pwb.py -lang:de bot_tests -v
"""
-# (C) Pywikibot team, 2012-2019
+# (C) Pywikibot team, 2012-2020
#
# Distributed under the terms of the MIT license.
#
@@ -145,9 +145,8 @@
absolute_path = abspath(os.path.dirname(sys.argv[0]))
rewrite_path = absolute_path
-sys.path = [sys.path[0], rewrite_path,
- os.path.join(rewrite_path, 'pywikibot', 'compat'),
- ] + sys.path[1:]
+if rewrite_path not in sys.path[:2]:
+ sys.path.insert(1, rewrite_path)
try:
import requests
diff --git a/pywikibot/CONTENT.rst b/pywikibot/CONTENT.rst
index 7d56f9d..aa13f59 100644
--- a/pywikibot/CONTENT.rst
+++ b/pywikibot/CONTENT.rst
@@ -87,19 +87,6 @@
+----------------------------+------------------------------------------------------+
- | compat | Package to provide compatibility with compat scripts.|
- | | (should never be used) |
- +============================+======================================================+
- | catlib.py | Library routines written especially to handle |
- | | category pages and recurse over category contents. |
- +----------------------------+------------------------------------------------------+
- | query.py | API query library |
- +----------------------------+------------------------------------------------------+
- | userlib.py | Library to work with users, their pages and talk page|
- +----------------------------+------------------------------------------------------+
-
-
- +----------------------------+------------------------------------------------------+
| data | Module providing layers of data access to wiki |
+============================+======================================================+
| api.py | Interface to Mediawiki's api.php |
diff --git a/pywikibot/DIRECTORIES.rst b/pywikibot/DIRECTORIES.rst
index d6fff39..3e1fe86 100644
--- a/pywikibot/DIRECTORIES.rst
+++ b/pywikibot/DIRECTORIES.rst
@@ -8,8 +8,6 @@
+---------------------------+------------------------------------------------------+
| pywikibot/comms | Communication layer |
+---------------------------+------------------------------------------------------+
- | pywikibot/compat | Deprecated package for use with compat scripts |
- +---------------------------+------------------------------------------------------+
| pywikibot/data | Module with several layers for data access to wiki |
+---------------------------+------------------------------------------------------+
| pywikibot/families | wiki-specific information and settings |
diff --git a/pywikibot/compat/__init__.py b/pywikibot/compat/__init__.py
deleted file mode 100644
index eaf5879..0000000
--- a/pywikibot/compat/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-
-IT IS DEPRECATED. DO NOT USE IT.
-"""
diff --git a/pywikibot/compat/catlib.py b/pywikibot/compat/catlib.py
deleted file mode 100644
index b7fb4e9..0000000
--- a/pywikibot/compat/catlib.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-
-IT IS DEPRECATED. DO NOT USE IT.
-
-Do not use this module anymore; use pywikibot.Category class
-or Page.change_category method instead.
-"""
-#
-# (C) Pywikibot team, 2008-2020
-#
-# Distributed under the terms of the MIT license.
-#
-from __future__ import absolute_import, division, unicode_literals
-
-from pywikibot import Category
-from pywikibot.tools import ModuleDeprecationWrapper
-
-
-def change_category(article, oldCat, newCat, comment=None, sortKey=None,
- inPlace=True):
- """Change the category of the article."""
- return article.change_category(oldCat, newCat, comment, sortKey, inPlace)
-
-
-__all__ = ('Category', 'change_category',)
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper._add_deprecated_attr('Category',
- replacement_name='pywikibot.Category',
- since='20141209', future_warning=True)
-wrapper._add_deprecated_attr('change_category',
- replacement_name='Page.change_category',
- since='20141209', future_warning=True)
diff --git a/pywikibot/compat/query.py b/pywikibot/compat/query.py
deleted file mode 100644
index 967db30..0000000
--- a/pywikibot/compat/query.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-
-IT IS DEPRECATED. DO NOT USE IT.
-
-Do not use this module anymore; use pywikibot.data.api.Request
-or Page/APISite highlevel methods instead.
-"""
-#
-# (C) Pywikibot team, 2008-2020
-#
-# Distributed under the terms of the MIT license.
-#
-from __future__ import absolute_import, division, unicode_literals
-
-from pywikibot.data import api
-from pywikibot.tools import deprecated, deprecated_args, remove_last_args
-
-
-@deprecated('pywikibot.data.api.Request', since='20120603',
- future_warning=True)
-@deprecated_args(useAPI=None, retryCount=None, encodeTitle=None)
-@remove_last_args(['back_response'])
-def GetData(request, site=None):
- """
- Query the server with the given request dict.
-
- DEPRECATED: Use pywikibot.data.api.Request instead.
- """
- if site:
- request['site'] = site
-
- req = api.Request(**request)
- return req.submit()
-
-
-__all__ = (GetData, )
diff --git a/pywikibot/compat/userlib.py b/pywikibot/compat/userlib.py
deleted file mode 100644
index c664d3c..0000000
--- a/pywikibot/compat/userlib.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-WARNING: THIS MODULE EXISTS SOLELY TO PROVIDE COMPAT BACKWARDS-COMPATIBILITY.
-
-IT IS DEPRECATED. DO NOT USE IT.
-
-Do not use this module anymore; use pywikibot.User instead.
-"""
-#
-# (C) Pywikibot team, 2008-2020
-#
-# Distributed under the terms of the MIT license.
-#
-from __future__ import absolute_import, division, unicode_literals
-
-from pywikibot.page import User
-from pywikibot.tools import ModuleDeprecationWrapper
-
-__all__ = ('User',)
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper._add_deprecated_attr('User',
- replacement_name='pywikibot.User',
- since='20141209', future_warning=True)
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index 5198780..29b3129 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -26,8 +26,8 @@
python pwb.py compat2core <scriptname> -warnonly
"""
#
-# (C) xqt, 2014-2018
-# (C) Pywikibot team, 2014-2018
+# (C) xqt, 2014-2020
+# (C) Pywikibot team, 2014-2020
#
# Distributed under the terms of the MIT license.
#
@@ -112,7 +112,7 @@
'"wikipedia" library has been changed to "pywikibot". Please find the\n'
'right way to import your object.'),
('from pywikibot.compat import',
- 'compat module has been dropped. Please refer README-conversion.txt for\n'
+ 'compat module has been removed. Please refer README-conversion.txt for\n'
'core implementation.'),
('query.GetData(',
'query.GetData() should be replaced by pywikibot.data.api.Request or\n'
--
To view, visit https://gerrit.wikimedia.org/r/398024
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I32cd9ca2d1ef32a25f741fe46160317cb649c4ef
Gerrit-Change-Number: 398024
Gerrit-PatchSet: 9
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Fantasticfears <fantasticfears(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/582522 )
Change subject: Site.page_restrictions(): Do not raise NoPage
......................................................................
Site.page_restrictions(): Do not raise NoPage
Nonexistent pages can be protected, so treat all pages the same.
Bug: T214286
Change-Id: I2bcb85a294ea3ce9709cc9d7700abea87e3f841c
---
M pywikibot/site/__init__.py
1 file changed, 0 insertions(+), 2 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index bd0a87f..f9a4f64 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -3148,8 +3148,6 @@
def page_restrictions(self, page):
"""Return a dictionary reflecting page protections."""
- if not page.exists():
- raise NoPage(page)
if not hasattr(page, '_protection'):
self.loadpageinfo(page)
return page._protection
--
To view, visit https://gerrit.wikimedia.org/r/582522
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2bcb85a294ea3ce9709cc9d7700abea87e3f841c
Gerrit-Change-Number: 582522
Gerrit-PatchSet: 2
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/582491 )
Change subject: [tests] flatten require_modules tests decorator
......................................................................
[tests] flatten require_modules tests decorator
Change-Id: I4c9f658a31cc4479c0532259612ef155c2b7b965
---
M tests/aspects.py
1 file changed, 12 insertions(+), 13 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py
index 8f301d2..d8a34a1 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -359,20 +359,19 @@
__import__(required_module, globals(), locals(), [], 0)
except ImportError:
missing += [required_module]
- if missing:
- skip_decorator = unittest.skip('{0} not installed'.format(
- ', '.join(missing)))
- if (inspect.isclass(obj) and issubclass(obj, TestCaseBase)
- and 'nose' in sys.modules.keys()):
- # There is a known bug in nosetests which causes setUpClass()
- # to be called even if the unittest class is skipped.
- # Here, we decorate setUpClass() as a patch to skip it
- # because of the missing modules too.
- # Upstream report: https://github.com/nose-devs/nose/issues/946
- obj.setUpClass = classmethod(skip_decorator(lambda cls: None))
- return skip_decorator(obj)
- else:
+ if not missing:
return obj
+ skip_decorator = unittest.skip('{0} not installed'.format(
+ ', '.join(missing)))
+ if (inspect.isclass(obj) and issubclass(obj, TestCaseBase)
+ and 'nose' in sys.modules.keys()):
+ # There is a known bug in nosetests which causes setUpClass()
+ # to be called even if the unittest class is skipped.
+ # Here, we decorate setUpClass() as a patch to skip it
+ # because of the missing modules too.
+ # Upstream report: https://github.com/nose-devs/nose/issues/946
+ obj.setUpClass = classmethod(skip_decorator(lambda cls: None))
+ return skip_decorator(obj)
return test_requirement
--
To view, visit https://gerrit.wikimedia.org/r/582491
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4c9f658a31cc4479c0532259612ef155c2b7b965
Gerrit-Change-Number: 582491
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/582112 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: If3c3e6a3048b688035080eb6f9421f72084c7e1f
---
M HISTORY.rst
1 file changed, 3 insertions(+), 0 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 703b581..b583603 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,9 @@
Current release
---------------
+* Use site.userinfo getter instead of site._userinfo within api (T243794)
+* Fix endprefix parameter in Category.articles() (T247201)
+* Fix search for changed claims when saving entity (T246359)
* backports.py has been removed (T244664)
* Site.has_api method has been removed (T106121)
* Bugfixes and improvements
--
To view, visit https://gerrit.wikimedia.org/r/582112
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If3c3e6a3048b688035080eb6f9421f72084c7e1f
Gerrit-Change-Number: 582112
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/582040 )
Change subject: [doc] Provide a link to the manual for construction in user-fixes.py
......................................................................
[doc] Provide a link to the manual for construction in user-fixes.py
Bug: T147418
Change-Id: I7cdcdae4d2e2e56d70ae26ff1d89780dc9a70204
---
M user-fixes.py.sample
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/user-fixes.py.sample b/user-fixes.py.sample
index 0007844..eaa1068 100644
--- a/user-fixes.py.sample
+++ b/user-fixes.py.sample
@@ -3,6 +3,8 @@
#
# This is only an example. Don't use it.
#
+# Refer the manual for its construction at:
+# https://www.mediawiki.org/wiki/Manual:Pywikibot/fixes.py#Construction_of_a_…
from __future__ import unicode_literals
fixes['example'] = {
--
To view, visit https://gerrit.wikimedia.org/r/582040
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7cdcdae4d2e2e56d70ae26ff1d89780dc9a70204
Gerrit-Change-Number: 582040
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/582027 )
Change subject: [tests] Skip some failing tests due to upstream issues
......................................................................
[tests] Skip some failing tests due to upstream issues
Bug: T130381
Bug: T243669
Bug: T245989
Change-Id: Id28fa202cc9e664a576e4c1da07cad9f20225957
---
M tests/generate_family_file_tests.py
M tests/site_tests.py
2 files changed, 12 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/generate_family_file_tests.py b/tests/generate_family_file_tests.py
index e233563..6297e2d 100644
--- a/tests/generate_family_file_tests.py
+++ b/tests/generate_family_file_tests.py
@@ -68,10 +68,12 @@
with self.subTest(test='Test whether default is loaded'):
self.assertIn(self.site.lang, gen.wikis)
- with self.subTest(test='Test element counts'):
- if self.site.lang not in gen.prefixes:
- gen.prefixes += [self.site.lang]
- self.assertCountEqual(gen.prefixes, gen.wikis)
+ # Subtest fails on musicbrainz (T130381) and wsbeta (T243669)
+ if self.site.family.name not in ('wsbeta', 'musicbrainz'):
+ with self.subTest(test='Test element counts'):
+ if self.site.lang not in gen.prefixes:
+ gen.prefixes += [self.site.lang]
+ self.assertCountEqual(gen.prefixes, gen.wikis)
# test creating Site from url
# only test Sites for downloaded wikis (T241413)
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 0dd079f..a36ed2c 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1599,13 +1599,16 @@
self.assertIsInstance(change, dict)
for change in mysite.recentchanges(anon=False, total=5):
self.assertIsInstance(change, dict)
- for change in mysite.recentchanges(redirect=True, total=5):
- self.assertIsInstance(change, dict)
- self.assertIn('redirect', change)
for change in mysite.recentchanges(redirect=False, total=5):
self.assertIsInstance(change, dict)
self.assertNotIn('redirect', change)
+ # Subtest timeouts on Wikidata due to upstream issue, see T245989
+ if mysite.sitename != 'wikidata:wikidata':
+ for change in mysite.recentchanges(redirect=True, total=5):
+ self.assertIsInstance(change, dict)
+ self.assertIn('redirect', change)
+
def test_tag_filter(self):
"""Test the site.recentchanges() with tag filter."""
mysite = self.site
--
To view, visit https://gerrit.wikimedia.org/r/582027
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id28fa202cc9e664a576e4c1da07cad9f20225957
Gerrit-Change-Number: 582027
Gerrit-PatchSet: 5
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)