jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/985369 )
Change subject: [cleanup] remove code deprecated in 6.x ......................................................................
[cleanup] remove code deprecated in 6.x
Change-Id: I17246e4c3d28336dea7a5b0b219b35be1010f78b --- M pywikibot/exceptions.py M pywikibot/tools/__init__.py M ROADMAP.rst M pywikibot/site/_namespace.py M tests/basesite_tests.py M pywikibot/tools/itertools.py M pywikibot/config.py M pywikibot/site/_basesite.py M tests/site_tests.py 9 files changed, 14 insertions(+), 96 deletions(-)
Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst index 67539ce..0f5d08a 100644 --- a/ROADMAP.rst +++ b/ROADMAP.rst @@ -86,9 +86,3 @@ * 7.0.0: baserevid parameter of editSource(), editQualifier(), removeClaims(), removeSources(), remove_qualifiers() DataSite methods will be removed * 7.0.0: Values of APISite.allpages() parameter filterredir other than True, False and None are deprecated * 7.0.0: The i18n identifier 'cosmetic_changes-append' will be removed in favour of 'pywikibot-cosmetic-changes' - -Will be removed in Pywikibot 9 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -* 6.2.0: Error messages with '%' style is deprecated in favour for str.format() style -* 6.0.0: config.register_family_file() is deprecated diff --git a/pywikibot/config.py b/pywikibot/config.py index 57971db..a64f21c 100644 --- a/pywikibot/config.py +++ b/pywikibot/config.py @@ -65,7 +65,6 @@ removesuffix, ) from pywikibot.logging import error, info, warning -from pywikibot.tools import deprecated
_DabComDict = DefaultDict[str, Dict[str, str]] @@ -423,16 +422,6 @@ family_files = {}
-@deprecated('family_files[family_name] = file_path', since='6.0.0') -def register_family_file(family_name: str, file_path: str) -> None: - """Register a single family class file. - - Parameter file_path may be a path or an url. - family.AutoFamily function is used when the url is given. - """ - family_files[family_name] = file_path - - def register_families_folder(folder_path: str, not_exists_ok: bool = False) -> None: """Register all family class files contained in a directory. diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py index d827e17..998c2c8 100644 --- a/pywikibot/exceptions.py +++ b/pywikibot/exceptions.py @@ -180,7 +180,7 @@ from typing import Any
import pywikibot -from pywikibot.tools import ModuleDeprecationWrapper, issue_deprecation_warning +from pywikibot.tools import ModuleDeprecationWrapper from pywikibot.tools._deprecate import _NotImplementedWarning
@@ -310,13 +310,6 @@
if re.search(r'{\w+}', self.message): msg = self.message.format_map(self.__dict__) - elif re.search(r'%(\w+)s', self.message): - issue_deprecation_warning("'%' style messages are deprecated, " - 'please use str.format() style instead', - since='6.2.0') - msg = self.message % self.__dict__ - elif '%s' in self.message: - msg = self.message % page else: msg = self.message.format(page)
diff --git a/pywikibot/site/_basesite.py b/pywikibot/site/_basesite.py index 5f59dbd..813cf91 100644 --- a/pywikibot/site/_basesite.py +++ b/pywikibot/site/_basesite.py @@ -24,7 +24,6 @@ from pywikibot.throttle import Throttle from pywikibot.tools import ( ComparableMixin, - SelfCallString, cached, deprecated, first_upper, @@ -216,7 +215,7 @@ @property def sitename(self): """String representing this Site's name and code.""" - return SelfCallString(self.__str__()) + return self.__str__()
def __repr__(self) -> str: """Return internal representation.""" diff --git a/pywikibot/site/_namespace.py b/pywikibot/site/_namespace.py index 11b1e54..cbab431 100644 --- a/pywikibot/site/_namespace.py +++ b/pywikibot/site/_namespace.py @@ -12,7 +12,7 @@ from typing import Union
from pywikibot.backports import Iterable as IterableType -from pywikibot.tools import ComparableMixin, SelfCallMixin, classproperty +from pywikibot.tools import ComparableMixin, classproperty
NamespaceIDType = Union[int, str, 'Namespace'] @@ -323,7 +323,7 @@ return False
-class NamespacesDict(Mapping, SelfCallMixin): +class NamespacesDict(Mapping):
""" An immutable dictionary containing the Namespace instances. diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py index ccf1bb8..caa8763 100644 --- a/pywikibot/tools/__init__.py +++ b/pywikibot/tools/__init__.py @@ -91,9 +91,6 @@ 'normalize_username', 'Version', 'MediaWikiVersion', - 'SelfCallMixin', - 'SelfCallDict', - 'SelfCallString', 'open_archive', 'merge_unique_dicts', 'file_mode_checker', @@ -547,44 +544,6 @@ return self._dev_version < other._dev_version
-class SelfCallMixin: - - """ - Return self when called. - - When '_own_desc' is defined it'll also issue a deprecation warning - using issue_deprecation_warning('Calling ' + _own_desc, 'it directly'). - - .. versionadded:: 3.0 - .. deprecated:: 6.2 - """ - - def __call__(self): - """Do nothing and just return itself.""" - issue_deprecation_warning('Referencing this attribute like a function', - 'it directly', since='6.2') - - return self - - -class SelfCallDict(SelfCallMixin, dict): - - """Dict with SelfCallMixin. - - .. versionadded:: 3.0 - .. deprecated:: 6.2 - """ - - -class SelfCallString(SelfCallMixin, str): - - """String with SelfCallMixin. - - .. versionadded:: 3.0 - .. deprecated:: 6.2 - """ - - def open_archive(filename: str, mode: str = 'rb', use_extension: bool = True): """ Open a file and uncompress it if needed. diff --git a/pywikibot/tools/itertools.py b/pywikibot/tools/itertools.py index e3679bb..4a17c43 100644 --- a/pywikibot/tools/itertools.py +++ b/pywikibot/tools/itertools.py @@ -122,15 +122,12 @@ ``genlist`` was renamed to ``iterables``; consecutive iterables are to be used as iterables parameters or '*' to unpack a list
- .. deprecated:: 6.4 - ``allow_duplicates`` as positional argument, - ``iterables`` as list or tuple type - .. versionchanged:: 7.0 Reimplemented without threads which is up to 10'000 times faster
.. versionchanged:: 9.0 Iterable elements may consist of lists or tuples + ``allow_duplicates`` is a keyword-only argument
:param iterables: page generators :param allow_duplicates: optional keyword argument to allow duplicates diff --git a/tests/basesite_tests.py b/tests/basesite_tests.py index 20cb979..29971bb 100755 --- a/tests/basesite_tests.py +++ b/tests/basesite_tests.py @@ -11,7 +11,6 @@
import pywikibot from pywikibot.exceptions import Error -from pywikibot.tools import suppress_warnings from tests.aspects import DefaultSiteTestCase, TestCase, unittest
@@ -93,12 +92,6 @@ self.assertIsInstance(mysite.linktrail(), str) self.assertIsInstance(mysite.redirect(), str)
- # sitename attribute could also be referenced like a function - - with suppress_warnings(WARN_SELF_CALL, category=FutureWarning): - self.assertEqual(mysite.sitename(), '{}:{}' - .format(self.family, code)) - try: dabcat = mysite.disambcategory() except Error as e: diff --git a/tests/site_tests.py b/tests/site_tests.py index 840b5b2..5ba71e4 100755 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -26,7 +26,6 @@ ) from tests.aspects import ( AlteredDefaultSiteTestCase, - DefaultDrySiteTestCase, DefaultSiteTestCase, DeprecationTestCase, TestCase, @@ -55,20 +54,6 @@ self.assertOneDeprecation()
-class TestSiteDryDeprecatedFunctions(DefaultDrySiteTestCase, - DeprecationTestCase): - - """Test cases for Site deprecated methods without a user.""" - - def test_namespaces_callable(self): - """Test that namespaces is callable and returns itself.""" - site = self.get_site() - self.assertIs(site.namespaces(), site.namespaces) - self.assertOneDeprecationParts( - 'Referencing this attribute like a function', - 'it directly') - - class TestSiteObject(DefaultSiteTestCase):
"""Test cases for Site methods."""
pywikibot-commits@lists.wikimedia.org