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

Change subject: [4.0] Deprecate tools.StringTypes and remove it from _wbtypes.py
......................................................................

[4.0] Deprecate tools.StringTypes and remove it from _wbtypes.py

Change-Id: I461059bfc84b59379e1b40f79a0b89d149adb2bc
---
M pywikibot/_wbtypes.py
M pywikibot/tools/__init__.py
2 files changed, 7 insertions(+), 9 deletions(-)

Approvals:
  Matěj Suchánek: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/_wbtypes.py b/pywikibot/_wbtypes.py
index 15e5639..e074829 100644
--- a/pywikibot/_wbtypes.py
+++ b/pywikibot/_wbtypes.py
@@ -1,18 +1,14 @@
 # -*- coding: utf-8 -*-
 """Wikibase data type classes."""
 #
-# (C) Pywikibot team, 2013-2018
+# (C) Pywikibot team, 2013-2020
 #
 # Distributed under the terms of the MIT license.
 #
-from __future__ import absolute_import, division, unicode_literals
-
 import json

-from pywikibot.tools import StringTypes

-
-class WbRepresentation(object):
+class WbRepresentation:

     """Abstract class for Wikibase representations."""

@@ -35,7 +31,7 @@

     def __repr__(self):
         assert isinstance(self._items, tuple)
-        assert all(isinstance(item, StringTypes) for item in self._items)
+        assert all(isinstance(item, str) for item in self._items)

         values = ((attr, getattr(self, attr)) for attr in self._items)
         attrs = ', '.join('{0}={1}'.format(attr, value)
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 0fe224e..253b315 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -35,7 +35,6 @@

 PYTHON_VERSION = sys.version_info[:3]
 PY2 = (PYTHON_VERSION[0] == 2)
-StringTypes = (str, bytes)

 try:
     import bz2
@@ -467,7 +466,7 @@
         return '.'.join(str(v) for v in self.version) + self.suffix

     def _cmp(self, other):
-        if isinstance(other, StringTypes):
+        if isinstance(other, str):
             other = MediaWikiVersion(other)

         if self.version > other.version:
@@ -1840,5 +1839,8 @@
                              since='20200712', future_warning=True)
 wrapper._add_deprecated_attr('UnicodeType', str,
                              since='20200813', future_warning=True)
+wrapper._add_deprecated_attr('StringTypes', (str, bytes),
+                             replacement_name='(str, bytes)',
+                             since='20200813', future_warning=True)
 wrapper._add_deprecated_attr('signature', inspect.signature,
                              since='20200813', future_warning=True)

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/620009
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: I461059bfc84b59379e1b40f79a0b89d149adb2bc
Gerrit-Change-Number: 620009
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to