jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[cleanup] Remove deprecated module parts

- remove pywikibot.__release__ in favour of pywikibot.__version__
- remove pywikibot.showHelp() in favour of pywikibot.show_help()
- pywikibot.unicode2html() and pywikibot.page.unicode2html() were removed
in favour of pywikibot.tools.chars.string2html()
- page.UnicodeToAsciiHtml() was removed in favour of
tools.chars.string_to_ascii_html
- remove cosmetic_changes CANCEL_ALL, CANCEL_PAGE, CANCEL_METHOD, CANCEL_MATCH
constants in favour of CANCEL.ALL, CANCEL.PAGE, CANCEL.METHOD, CANCEL.MATCH
enum.
- remove deprecated data.api.APIError, data.api.UploadWarning,
data.api.APIMWException in favour of exceptions.APIError,
exceptions.UploadError and exceptions.APIMWError
- WikiaFamily is removed and was replaced by FandomFamily
- i18n.TranslationError is removed and was replaced by
exceptions.TranslationError
- interwiki_graph.GraphImpossible and OAuthImpossible exceptions were
removed in favour of ImportError
- page.PageInUse exception was removed in favour of exceptions.PageInUseError
- specialbots.EditReplacement was removed in favour of
exceptions.EditReplacementError
- version.ParseError was removed in favour of exceptions.VersionParseError

Change-Id: If28331efd8763d96ba0098db52421ac9c915f3b8
---
M pywikibot/__init__.py
M pywikibot/cosmetic_changes.py
M pywikibot/data/api.py
M pywikibot/family.py
M pywikibot/i18n.py
M pywikibot/interwiki_graph.py
M pywikibot/login.py
M pywikibot/page/__init__.py
M pywikibot/site/__init__.py
M pywikibot/specialbots/__init__.py
M pywikibot/specialbots/_unlink.py
M pywikibot/version.py
12 files changed, 3 insertions(+), 132 deletions(-)

diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index e0e55e4..8218fae 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -67,9 +67,6 @@
warning,
)
from pywikibot.site import APISite, BaseSite, DataSite
-from pywikibot.tools import (
- ModuleDeprecationWrapper as _ModuleDeprecationWrapper,
-)
from pywikibot.tools import classproperty
from pywikibot.tools import deprecate_arg as _deprecate_arg
from pywikibot.tools import normalize_username
@@ -1390,13 +1387,3 @@
_putthread = threading.Thread(target=async_manager,
name='Put-Thread', # for debugging purposes
daemon=True)
-
-wrapper = _ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr('__release__', __version__,
- replacement_name='pywikibot.__version__',
- since='20200707')
-wrapper.add_deprecated_attr('showHelp', show_help,
- since='20200705')
-wrapper.add_deprecated_attr(
- 'unicode2html', replacement_name='pywikibot.tools.chars.string2html',
- since='6.2.0')
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 7585269..b8d77b3 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -74,7 +74,6 @@
first_lower,
first_upper,
issue_deprecation_warning,
- ModuleDeprecationWrapper,
)
from pywikibot.tools.chars import url2string

@@ -1125,23 +1124,3 @@
def fix_ISBN(self, text: str) -> str:
"""Hyphenate ISBN numbers."""
return _reformat_ISBNs(text, strict=self.ignore != CANCEL.MATCH)
-
-
-_CANCEL_ALL = CANCEL.ALL
-_CANCEL_PAGE = CANCEL.PAGE
-_CANCEL_METHOD = CANCEL.METHOD
-_CANCEL_MATCH = CANCEL.MATCH
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr('CANCEL_ALL', _CANCEL_ALL,
- replacement_name='CANCEL.ALL',
- since='20210528')
-wrapper.add_deprecated_attr('CANCEL_PAGE', _CANCEL_PAGE,
- replacement_name='CANCEL.PAGE',
- since='20210528')
-wrapper.add_deprecated_attr('CANCEL_METHOD', _CANCEL_METHOD,
- replacement_name='CANCEL.METHOD',
- since='20210528')
-wrapper.add_deprecated_attr('CANCEL_MATCH', _CANCEL_MATCH,
- replacement_name='CANCEL.MATCH',
- since='20210528')
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c386849..021e1c3 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -42,7 +42,7 @@
from pywikibot.family import SubdomainFamily
from pywikibot.login import LoginStatus
from pywikibot.textlib import removeHTMLParts
-from pywikibot.tools import PYTHON_VERSION, ModuleDeprecationWrapper, itergroup
+from pywikibot.tools import PYTHON_VERSION, itergroup
from pywikibot.tools.formatter import color_format


@@ -3168,15 +3168,3 @@
page._lintinfo.pop('pageid')
page._lintinfo.pop('title')
page._lintinfo.pop('ns')
-
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr(
- 'APIError', replacement_name='pywikibot.exceptions.APIError',
- since='20210423')
-wrapper.add_deprecated_attr(
- 'UploadWarning', replacement_name='pywikibot.exceptions.UploadError',
- since='20210423')
-wrapper.add_deprecated_attr(
- 'APIMWException', replacement_name='pywikibot.exceptions.APIMWError',
- since='20210423')
diff --git a/pywikibot/family.py b/pywikibot/family.py
index adc19a4..198f00f 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -21,7 +21,7 @@
from pywikibot import config
from pywikibot.backports import Dict, List, Tuple
from pywikibot.exceptions import FamilyMaintenanceWarning, UnknownFamilyError
-from pywikibot.tools import classproperty, deprecated, ModuleDeprecationWrapper
+from pywikibot.tools import classproperty, deprecated


logger = logging.getLogger('pywiki.wiki.family')
@@ -1247,8 +1247,3 @@

AutoFamily = type('AutoFamily', (SingleSiteFamily,), locals())
return AutoFamily()
-
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr('WikiaFamily', replacement=FandomFamily,
- since='20190420')
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 2ae3f32..2dffea9 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -43,7 +43,6 @@
Sequence,
)
from pywikibot.plural import plural_rule
-from pywikibot.tools import ModuleDeprecationWrapper

STR_OR_SITE_TYPE = Union[str, 'pywikibot.site.BaseSite']

@@ -827,10 +826,3 @@
'Unable to load messages package {} for bundle {}'
.format(_messages_package_name, twtitle))
return pywikibot.input(prompt, password)
-
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr(
- 'TranslationError',
- replacement_name='pywikibot.exceptions.TranslationError',
- since='20210423')
diff --git a/pywikibot/interwiki_graph.py b/pywikibot/interwiki_graph.py
index 2cefcec..8d8e50d 100644
--- a/pywikibot/interwiki_graph.py
+++ b/pywikibot/interwiki_graph.py
@@ -12,7 +12,6 @@
import pywikibot
from pywikibot import config
from pywikibot.backports import Dict, List, Set
-from pywikibot.tools import ModuleDeprecationWrapper

FOUND_IN_TYPE = Dict['pywikibot.page.Page', List['pywikibot.page.Page']]

@@ -232,12 +231,3 @@
if extension:
filename += '.{}'.format(extension)
return filename
-
-
-GraphImpossible = ImportError
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr(
- 'GraphImpossible',
- replacement_name='ImportError',
- since='20210423')
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 6037795..5b61959 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -20,7 +20,6 @@
from pywikibot.exceptions import APIError, NoUsernameError
from pywikibot.tools import (
file_mode_checker,
- ModuleDeprecationWrapper,
normalize_username,
)

@@ -467,12 +466,3 @@
except Exception as e:
pywikibot.error(e)
return None
-
-
-OAuthImpossible = ImportError
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr(
- 'OAuthImpossible',
- replacement_name='ImportError',
- since='20210423')
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index b8bf88b..f3d82bc 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -73,7 +73,6 @@
first_upper,
is_ip_address,
issue_deprecation_warning,
- ModuleDeprecationWrapper,
)


@@ -5818,14 +5817,3 @@
)

return pywikibot.tools.chars.url2string(title, encodings)
-
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr(
- 'UnicodeToAsciiHtml',
- replacement_name='pywikibot.tools.chars.string_to_ascii_html',
- since='6.2.0')
-wrapper.add_deprecated_attr(
- 'unicode2html',
- replacement_name='pywikibot.tools.chars.string2html',
- since='6.2.0')
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index e2d5314..a009065 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -11,17 +11,8 @@
from pywikibot.site._obsoletesites import ClosedSite, RemovedSite
from pywikibot.site._siteinfo import Siteinfo
from pywikibot.site._tokenwallet import TokenWallet
-from pywikibot.tools import ModuleDeprecationWrapper


__all__ = ('APISite', 'BaseSite', 'ClosedSite', 'DataSite', 'RemovedSite',
'Namespace', 'NamespacesDict', 'PageInUse', 'Siteinfo',
'TokenWallet')
-
-_logger = 'wiki.site'
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr(
- 'PageInUse',
- replacement_name='pywikibot.exceptions.PageInUseError',
- since='20210423')
diff --git a/pywikibot/specialbots/__init__.py b/pywikibot/specialbots/__init__.py
index bca9bc2..0af9098 100644
--- a/pywikibot/specialbots/__init__.py
+++ b/pywikibot/specialbots/__init__.py
@@ -7,21 +7,11 @@
#
from pywikibot.specialbots._unlink import BaseUnlinkBot, InteractiveUnlink
from pywikibot.specialbots._upload import UploadRobot
-from pywikibot.tools import ModuleDeprecationWrapper, suppress_warnings


-with suppress_warnings(category=FutureWarning):
- from pywikibot.specialbots._unlink import EditReplacement
-
__all__ = (
'BaseUnlinkBot',
'EditReplacement',
'InteractiveUnlink',
'UploadRobot',
)
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr(
- 'EditReplacement',
- replacement_name='pywikibot.exceptions.EditReplacementError',
- since='20210423')
diff --git a/pywikibot/specialbots/_unlink.py b/pywikibot/specialbots/_unlink.py
index 56a6d93..a1a6157 100644
--- a/pywikibot/specialbots/_unlink.py
+++ b/pywikibot/specialbots/_unlink.py
@@ -19,7 +19,6 @@
from pywikibot.editor import TextEditor
from pywikibot.bot_choice import UnhandledAnswer
from pywikibot.textlib import replace_links
-from pywikibot.tools import ModuleDeprecationWrapper


class EditReplacementError(ChoiceException, UnhandledAnswer):
@@ -93,12 +92,3 @@
break

self.put_current(text)
-
-
-EditReplacement = EditReplacementError
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr(
- 'EditReplacement',
- replacement_name='EditReplacementError',
- since='20210423')
diff --git a/pywikibot/version.py b/pywikibot/version.py
index 3bc2e86..b66bf4f 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -25,7 +25,7 @@
from pywikibot.backports import cache
from pywikibot.comms.http import fetch
from pywikibot.exceptions import VersionParseError
-from pywikibot.tools import ModuleDeprecationWrapper, deprecated
+from pywikibot.tools import deprecated


_logger = 'version'
@@ -499,12 +499,3 @@
del data[name]

return data
-
-
-ParseError = VersionParseError
-
-wrapper = ModuleDeprecationWrapper(__name__)
-wrapper.add_deprecated_attr(
- 'ParseError',
- replacement_name='pywikibot.exceptions.VersionParseError',
- since='20210423')

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: If28331efd8763d96ba0098db52421ac9c915f3b8
Gerrit-Change-Number: 729213
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged