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
+9 -7
View File
@@ -41,6 +41,7 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.PaginatedList
@@ -48,7 +49,8 @@ import github.Repository
import github.NamedUser
import github.Organization
import Consts
from . import Consts
import six
class Team(github.GithubObject.CompletableGithubObject):
@@ -179,7 +181,7 @@ class Team(github.GithubObject.CompletableGithubObject):
"""
assert isinstance(member, github.NamedUser.NamedUser), member
assert role is github.GithubObject.NotSet or isinstance(
role, (str, unicode)), role
role, (str, six.text_type)), role
if role is not github.GithubObject.NotSet:
assert role in ['member', 'maintainer']
put_parameters = {
@@ -243,10 +245,10 @@ class Team(github.GithubObject.CompletableGithubObject):
:param privacy: string
:rtype: None
"""
assert isinstance(name, (str, unicode)), name
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
assert privacy is github.GithubObject.NotSet or isinstance(privacy, (str, unicode)), privacy
assert isinstance(name, (str, six.text_type)), name
assert description is github.GithubObject.NotSet or isinstance(description, (str, six.text_type)), description
assert permission is github.GithubObject.NotSet or isinstance(permission, (str, six.text_type)), permission
assert privacy is github.GithubObject.NotSet or isinstance(privacy, (str, six.text_type)), privacy
post_parameters = {
"name": name,
}
@@ -269,7 +271,7 @@ class Team(github.GithubObject.CompletableGithubObject):
:param role: string
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
assert role is github.GithubObject.NotSet or isinstance(role, (str, unicode)), role
assert role is github.GithubObject.NotSet or isinstance(role, (str, six.text_type)), role
url_parameters = dict()
if role is not github.GithubObject.NotSet:
assert role in ['member', 'maintainer', 'all']