Switch to using six (#1189)

With the Python 2.7 deadline fast approaching, modernize the codebase
making use of the modernize module to switch to using six, as well as
other upcoming features, such as absolute imports . Stop using 2to3
for Travis, yay!
This commit is contained in:
Steve Kowalik
2019-08-05 14:06:19 +10:00
committed by GitHub
parent f1ae7200ba
commit dc2f2ad8cb
182 changed files with 850 additions and 629 deletions
+8 -6
View File
@@ -31,11 +31,13 @@
# #
################################################################################
import urllib
from __future__ import absolute_import
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
import github.GithubObject
import Consts
from . import Consts
import six
class Label(github.GithubObject.CompletableGithubObject):
@@ -96,9 +98,9 @@ class Label(github.GithubObject.CompletableGithubObject):
:param description: string
:rtype: None
"""
assert isinstance(name, (str, unicode)), name
assert isinstance(color, (str, unicode)), color
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
assert isinstance(name, (str, six.text_type)), name
assert isinstance(color, (str, six.text_type)), color
assert description is github.GithubObject.NotSet or isinstance(description, (str, six.text_type)), description
post_parameters = {
"name": name,
"color": color,
@@ -115,7 +117,7 @@ class Label(github.GithubObject.CompletableGithubObject):
@property
def _identity(self):
return urllib.quote(self.name)
return six.moves.urllib.parse.quote(self.name)
def _initAttributes(self):
self._color = github.GithubObject.NotSet