jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/651909 )

Change subject: [cleanup] Remove PY2 variable
......................................................................

[cleanup] Remove PY2 variable

After Python 2 has been dropped the PY2 variable is no longer needed.
Show a FutureWarning if it is imported.

Change-Id: I25741ae208f8f29aa760f6d4b5ae021dc293f077
---
M pywikibot/tools/__init__.py
1 file changed, 10 insertions(+), 3 deletions(-)

Approvals:
  Mpaa: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 9346cf7..16233cb 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -35,9 +35,6 @@
 from pywikibot.logging import debug
 from pywikibot.tools._unidata import _first_upper_exception

-PYTHON_VERSION = sys.version_info[:3]
-PY2 = (PYTHON_VERSION[0] == 2)
-
 try:
     import bz2
 except ImportError as bz2_import_error:
@@ -54,6 +51,8 @@
     lzma = lzma_import_error


+PYTHON_VERSION = sys.version_info[:3]
+
 _logger = 'tools'


@@ -1824,7 +1823,15 @@
     return '{} ({}):'.format(message, option_msg)


+def _py2():
+    """Function for deprecated PY2 variable used by wrapper below."""
+    return (PYTHON_VERSION[0] == 2)
+
+
 wrapper = ModuleDeprecationWrapper(__name__)
 wrapper._add_deprecated_attr('FrozenDict', _FrozenDict,
                              replacement_name='tools.frozenmap',
                              since='20201109', future_warning=True)
+wrapper._add_deprecated_attr('PY2', _py2(),
+                             replacement_name='sys.version_info[0] == 2',
+                             since='20201224', future_warning=True)

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/651909
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I25741ae208f8f29aa760f6d4b5ae021dc293f077
Gerrit-Change-Number: 651909
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Mpaa <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: DannyS712 <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to