diff --git a/.travis.yml b/.travis.yml index 103c78cc..fcea1c27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python python: - - "2.7" - "3.5" - "3.6" - "3.7" @@ -26,4 +25,4 @@ deploy: on: tags: true repo: PyGithub/PyGithub - python: "2.7" + python: "3.5" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c5f5467..5fead8c0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -91,8 +91,6 @@ Please check your code with [pep8 Python style guide checker](http://pypi.python ## Build documentation locally -Note: only Python 2 is supported as of now - ``` pip install -r requirements.txt sphinx-build doc build diff --git a/DEPLOY.md b/DEPLOY.md index 8417c555..acab27fe 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -13,6 +13,6 @@ Next version number? (previous: 'XXX') 3. Now the push will be on hold until you press Enter. Manually inpect the changelog (`doc/changes.rst`) to make changes if necessary. Once you are sure, go back and press Enter. -4. Once the travis job (Python2.7) is done, the new version should be uploaded to PyPI. +4. Once the travis job (Python 3.5) is done, the new version should be uploaded to PyPI. 5. Update the Github [release](https://github.com/PyGithub/PyGithub/releases) page with the same release note from `doc/changes.rst`. (needed for some web spiders for changelog parsing) diff --git a/README.md b/README.md index c9ea62df..2d9dcef1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![codecov](https://codecov.io/gh/PyGithub/PyGithub/branch/master/graph/badge.svg)](https://codecov.io/gh/PyGithub/PyGithub) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -PyGitHub is a Python (2 and 3) library to access the [GitHub API v3] and [Github Enterprise API v3]. +PyGitHub is a Python library to access the [GitHub API v3] and [Github Enterprise API v3]. This library enables you to manage [GitHub] resources such as repositories, user profiles, and organizations in your Python applications. [GitHub API v3]: https://developer.github.com/v3 diff --git a/doc/examples/Webhook.rst b/doc/examples/Webhook.rst index b64317a4..44b0d491 100644 --- a/doc/examples/Webhook.rst +++ b/doc/examples/Webhook.rst @@ -16,8 +16,6 @@ on working with Webhooks. A list of all applicable event types for Webhooks can .. code-block:: python - from __future__ import print_function - from wsgiref.simple_server import make_server from pyramid.config import Configurator from pyramid.view import view_config, view_defaults diff --git a/doc/introduction.rst b/doc/introduction.rst index ea4dccae..2516295e 100644 --- a/doc/introduction.rst +++ b/doc/introduction.rst @@ -1,7 +1,7 @@ Introduction ============ -PyGithub is a Python (2 and 3) library to use the `Github API v3 `__. +PyGithub is a Python library to use the `Github API v3 `__. With it, you can manage your `Github `__ resources (repositories, user profiles, organizations, etc.) from Python scripts. Should you have any question, any remark, or if you find a bug, diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index 9538157f..5bdf88cc 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -40,12 +40,8 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime -import six - import github.Authorization import github.Event import github.Gist @@ -377,9 +373,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param email: string :rtype: None """ - assert all( - isinstance(element, (str, six.text_type)) for element in emails - ), emails + assert all(isinstance(element, str) for element in emails), emails post_parameters = emails headers, data = self._requester.requestJsonAndCheck( "POST", "/user/emails", input=post_parameters @@ -451,22 +445,20 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.Authorization.Authorization` """ assert scopes is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in scopes + isinstance(element, str) for element in scopes ), scopes - assert note is github.GithubObject.NotSet or isinstance( - note, (str, six.text_type) - ), note + assert note is github.GithubObject.NotSet or isinstance(note, str), note assert note_url is github.GithubObject.NotSet or isinstance( - note_url, (str, six.text_type) + note_url, str ), note_url assert client_id is github.GithubObject.NotSet or isinstance( - client_id, (str, six.text_type) + client_id, str ), client_id assert client_secret is github.GithubObject.NotSet or isinstance( - client_secret, (str, six.text_type) + client_secret, str ), client_secret assert onetime_password is None or isinstance( - onetime_password, (str, six.text_type) + onetime_password, str ), onetime_password post_parameters = dict() if scopes is not github.GithubObject.NotSet: @@ -516,15 +508,14 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): """ assert isinstance(public, bool), public assert all( - isinstance(element, github.InputFileContent) - for element in six.itervalues(files) + isinstance(element, github.InputFileContent) for element in files.values() ), files assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description post_parameters = { "public": public, - "files": {key: value._identity for key, value in six.iteritems(files)}, + "files": {key: value._identity for key, value in files.items()}, } if description is not github.GithubObject.NotSet: post_parameters["description"] = description @@ -540,8 +531,8 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param key: string :rtype: :class:`github.UserKey.UserKey` """ - assert isinstance(title, (str, six.text_type)), title - assert isinstance(key, (str, six.text_type)), key + assert isinstance(title, str), title + assert isinstance(key, str), key post_parameters = { "title": title, "key": key, @@ -586,12 +577,12 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param allow_rebase_merge: bool :rtype: :class:`github.Repository.Repository` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description assert homepage is github.GithubObject.NotSet or isinstance( - homepage, (str, six.text_type) + homepage, str ), homepage assert private is github.GithubObject.NotSet or isinstance( private, bool @@ -612,10 +603,10 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): auto_init, bool ), auto_init assert license_template is github.GithubObject.NotSet or isinstance( - license_template, (str, six.text_type) + license_template, str ), license_template assert gitignore_template is github.GithubObject.NotSet or isinstance( - gitignore_template, (str, six.text_type) + gitignore_template, str ), gitignore_template assert allow_squash_merge is github.GithubObject.NotSet or isinstance( allow_squash_merge, bool @@ -683,27 +674,19 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param bio: string :rtype: None """ - assert name is github.GithubObject.NotSet or isinstance( - name, (str, six.text_type) - ), name - assert email is github.GithubObject.NotSet or isinstance( - email, (str, six.text_type) - ), email - assert blog is github.GithubObject.NotSet or isinstance( - blog, (str, six.text_type) - ), blog + assert name is github.GithubObject.NotSet or isinstance(name, str), name + assert email is github.GithubObject.NotSet or isinstance(email, str), email + assert blog is github.GithubObject.NotSet or isinstance(blog, str), blog assert company is github.GithubObject.NotSet or isinstance( - company, (str, six.text_type) + company, str ), company assert location is github.GithubObject.NotSet or isinstance( - location, (str, six.text_type) + location, str ), location assert hireable is github.GithubObject.NotSet or isinstance( hireable, bool ), hireable - assert bio is github.GithubObject.NotSet or isinstance( - bio, (str, six.text_type) - ), bio + assert bio is github.GithubObject.NotSet or isinstance(bio, str), bio post_parameters = dict() if name is not github.GithubObject.NotSet: post_parameters["name"] = name @@ -730,7 +713,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.Authorization.Authorization` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", "/authorizations/" + str(id) ) @@ -818,20 +801,14 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param since: datetime.datetime :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue` """ - assert filter is github.GithubObject.NotSet or isinstance( - filter, (str, six.text_type) - ), filter - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state + assert filter is github.GithubObject.NotSet or isinstance(filter, str), filter + assert state is github.GithubObject.NotSet or isinstance(state, str), state assert labels is github.GithubObject.NotSet or all( isinstance(element, github.Label.Label) for element in labels ), labels - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction assert since is github.GithubObject.NotSet or isinstance( since, datetime.datetime @@ -873,20 +850,14 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param since: datetime.datetime :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue` """ - assert filter is github.GithubObject.NotSet or isinstance( - filter, (str, six.text_type) - ), filter - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state + assert filter is github.GithubObject.NotSet or isinstance(filter, str), filter + assert state is github.GithubObject.NotSet or isinstance(state, str), state assert labels is github.GithubObject.NotSet or all( isinstance(element, github.Label.Label) for element in labels ), labels - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction assert since is github.GithubObject.NotSet or isinstance( since, datetime.datetime @@ -914,7 +885,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.UserKey.UserKey` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", "/user/keys/" + str(id) ) @@ -935,7 +906,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.Notification.Notification` """ - assert isinstance(id, (str, six.text_type)), id + assert isinstance(id, str), id headers, data = self._requester.requestJsonAndCheck( "GET", "/notifications/threads/" + id ) @@ -1013,7 +984,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param name: string :rtype: :class:`github.Repository.Repository` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name headers, data = self._requester.requestJsonAndCheck( "GET", "/repos/" + self.login + "/" + name ) @@ -1039,19 +1010,15 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ assert visibility is github.GithubObject.NotSet or isinstance( - visibility, (str, six.text_type) + visibility, str ), visibility assert affiliation is github.GithubObject.NotSet or isinstance( - affiliation, (str, six.text_type) + affiliation, str ), affiliation - assert type is github.GithubObject.NotSet or isinstance( - type, (str, six.text_type) - ), type - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert type is github.GithubObject.NotSet or isinstance(type, str), type + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction url_parameters = dict() if visibility is not github.GithubObject.NotSet: @@ -1179,9 +1146,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :param email: string :rtype: None """ - assert all( - isinstance(element, (str, six.text_type)) for element in emails - ), emails + assert all(isinstance(element, str) for element in emails), emails post_parameters = emails headers, data = self._requester.requestJsonAndCheck( "DELETE", "/user/emails", input=post_parameters @@ -1274,7 +1239,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.Migration.Migration` """ assert isinstance(repos, (list, tuple)), repos - assert all(isinstance(repo, (str, six.text_type)) for repo in repos), repos + assert all(isinstance(repo, str) for repo in repos), repos assert lock_repositories is github.GithubObject.NotSet or isinstance( lock_repositories, bool ), lock_repositories diff --git a/github/Authorization.py b/github/Authorization.py index e5b33f3b..3b3c9fbe 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -30,10 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.AuthorizationApplication import github.GithubObject @@ -143,19 +139,17 @@ class Authorization(github.GithubObject.CompletableGithubObject): :rtype: None """ assert scopes is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in scopes + isinstance(element, str) for element in scopes ), scopes assert add_scopes is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in add_scopes + isinstance(element, str) for element in add_scopes ), add_scopes assert remove_scopes is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in remove_scopes + isinstance(element, str) for element in remove_scopes ), remove_scopes - assert note is github.GithubObject.NotSet or isinstance( - note, (str, six.text_type) - ), note + assert note is github.GithubObject.NotSet or isinstance(note, str), note assert note_url is github.GithubObject.NotSet or isinstance( - note_url, (str, six.text_type) + note_url, str ), note_url post_parameters = dict() if scopes is not github.GithubObject.NotSet: diff --git a/github/AuthorizationApplication.py b/github/AuthorizationApplication.py index 92d98f3b..c6b9bc50 100644 --- a/github/AuthorizationApplication.py +++ b/github/AuthorizationApplication.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Branch.py b/github/Branch.py index 60eb310b..6ae8b072 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -33,10 +33,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.BranchProtection import github.Commit import github.GithubObject @@ -147,21 +143,17 @@ class Branch(github.GithubObject.NonCompletableGithubObject): """ assert strict is github.GithubObject.NotSet or isinstance(strict, bool), strict assert contexts is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) - for element in contexts + isinstance(element, str) or isinstance(element, str) for element in contexts ), contexts assert enforce_admins is github.GithubObject.NotSet or isinstance( enforce_admins, bool ), enforce_admins assert dismissal_users is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) + isinstance(element, str) or isinstance(element, str) for element in dismissal_users ), dismissal_users assert dismissal_teams is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) + isinstance(element, str) or isinstance(element, str) for element in dismissal_teams ), dismissal_teams assert dismiss_stale_reviews is github.GithubObject.NotSet or isinstance( @@ -285,9 +277,7 @@ class Branch(github.GithubObject.NonCompletableGithubObject): """ assert strict is github.GithubObject.NotSet or isinstance(strict, bool), strict assert contexts is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) - for element in contexts + isinstance(element, str) or isinstance(element, str) for element in contexts ), contexts post_parameters = {} @@ -340,13 +330,11 @@ class Branch(github.GithubObject.NonCompletableGithubObject): :required_approving_review_count: int """ assert dismissal_users is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) + isinstance(element, str) or isinstance(element, str) for element in dismissal_users ), dismissal_users assert dismissal_teams is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) + isinstance(element, str) or isinstance(element, str) for element in dismissal_teams ), dismissal_teams assert dismiss_stale_reviews is github.GithubObject.NotSet or isinstance( @@ -446,9 +434,7 @@ class Branch(github.GithubObject.NonCompletableGithubObject): :users: list of strings (user names) """ assert all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) - for element in users + isinstance(element, str) or isinstance(element, str) for element in users ), users headers, data = self._requester.requestJsonAndCheck( @@ -461,9 +447,7 @@ class Branch(github.GithubObject.NonCompletableGithubObject): :users: list of strings (user names) """ assert all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) - for element in users + isinstance(element, str) or isinstance(element, str) for element in users ), users headers, data = self._requester.requestJsonAndCheck( @@ -476,9 +460,7 @@ class Branch(github.GithubObject.NonCompletableGithubObject): :users: list of strings (user names) """ assert all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) - for element in users + isinstance(element, str) or isinstance(element, str) for element in users ), users headers, data = self._requester.requestJsonAndCheck( @@ -491,9 +473,7 @@ class Branch(github.GithubObject.NonCompletableGithubObject): :teams: list of strings (team slugs) """ assert all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) - for element in teams + isinstance(element, str) or isinstance(element, str) for element in teams ), teams headers, data = self._requester.requestJsonAndCheck( @@ -506,9 +486,7 @@ class Branch(github.GithubObject.NonCompletableGithubObject): :teams: list of strings (team slugs) """ assert all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) - for element in teams + isinstance(element, str) or isinstance(element, str) for element in teams ), teams headers, data = self._requester.requestJsonAndCheck( @@ -521,9 +499,7 @@ class Branch(github.GithubObject.NonCompletableGithubObject): :teams: list of strings (team slugs) """ assert all( - isinstance(element, (str, six.text_type)) - or isinstance(element, (str, six.text_type)) - for element in teams + isinstance(element, str) or isinstance(element, str) for element in teams ), teams headers, data = self._requester.requestJsonAndCheck( diff --git a/github/BranchProtection.py b/github/BranchProtection.py index e56bef04..9ff7f162 100644 --- a/github/BranchProtection.py +++ b/github/BranchProtection.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NamedUser import github.RequiredPullRequestReviews diff --git a/github/Clones.py b/github/Clones.py index b24e5893..1a2a1fe6 100644 --- a/github/Clones.py +++ b/github/Clones.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Commit.py b/github/Commit.py index 27cac62f..280b897c 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -32,10 +32,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.CommitCombinedStatus import github.CommitComment import github.CommitStats @@ -150,15 +146,11 @@ class Commit(github.GithubObject.CompletableGithubObject): :param position: integer :rtype: :class:`github.CommitComment.CommitComment` """ - assert isinstance(body, (str, six.text_type)), body - assert line is github.GithubObject.NotSet or isinstance( - line, six.integer_types - ), line - assert path is github.GithubObject.NotSet or isinstance( - path, (str, six.text_type) - ), path + assert isinstance(body, str), body + assert line is github.GithubObject.NotSet or isinstance(line, int), line + assert path is github.GithubObject.NotSet or isinstance(path, str), path assert position is github.GithubObject.NotSet or isinstance( - position, six.integer_types + position, int ), position post_parameters = { "body": body, @@ -191,15 +183,15 @@ class Commit(github.GithubObject.CompletableGithubObject): :param context: string :rtype: :class:`github.CommitStatus.CommitStatus` """ - assert isinstance(state, (str, six.text_type)), state + assert isinstance(state, str), state assert target_url is github.GithubObject.NotSet or isinstance( - target_url, (str, six.text_type) + target_url, str ), target_url assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description assert context is github.GithubObject.NotSet or isinstance( - context, (str, six.text_type) + context, str ), context post_parameters = { "state": state, diff --git a/github/CommitCombinedStatus.py b/github/CommitCombinedStatus.py index f23e65ca..c7c02a3c 100644 --- a/github/CommitCombinedStatus.py +++ b/github/CommitCombinedStatus.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.CommitStatus import github.GithubObject import github.Repository diff --git a/github/CommitComment.py b/github/CommitComment.py index 8dbce3b1..e6c98927 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -32,10 +32,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.NamedUser @@ -151,7 +147,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :param body: string :rtype: None """ - assert isinstance(body, (str, six.text_type)), body + assert isinstance(body, str), body post_parameters = { "body": body, } @@ -181,9 +177,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :param reaction_type: string :rtype: :class:`github.Reaction.Reaction` """ - assert isinstance( - reaction_type, (str, six.text_type) - ), "reaction type should be a string" + assert isinstance(reaction_type, str), "reaction type should be a string" assert reaction_type in [ "+1", "-1", diff --git a/github/CommitStats.py b/github/CommitStats.py index 6b345e1a..e98fb210 100644 --- a/github/CommitStats.py +++ b/github/CommitStats.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/CommitStatus.py b/github/CommitStatus.py index 8de27dd4..f6325e93 100644 --- a/github/CommitStatus.py +++ b/github/CommitStatus.py @@ -32,8 +32,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NamedUser diff --git a/github/Comparison.py b/github/Comparison.py index 4b4efdf8..3a0eb4bd 100644 --- a/github/Comparison.py +++ b/github/Comparison.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.Commit import github.File import github.GithubObject diff --git a/github/ContentFile.py b/github/ContentFile.py index 7304f127..9b7d09dd 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -31,8 +31,6 @@ # # ################################################################################ -from __future__ import absolute_import - import base64 import github.GithubObject diff --git a/github/Download.py b/github/Download.py index 7370930d..82871a0e 100644 --- a/github/Download.py +++ b/github/Download.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Event.py b/github/Event.py index fa100d74..a97299a1 100644 --- a/github/Event.py +++ b/github/Event.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NamedUser import github.Organization diff --git a/github/File.py b/github/File.py index 1db06dc7..f040ac75 100644 --- a/github/File.py +++ b/github/File.py @@ -32,8 +32,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Gist.py b/github/Gist.py index a4e682f7..ca0e0a82 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -33,10 +33,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GistComment import github.GistFile import github.GistHistoryState @@ -211,7 +207,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :param body: string :rtype: :class:`github.GistComment.GistComment` """ - assert isinstance(body, (str, six.text_type)), body + assert isinstance(body, str), body post_parameters = { "body": body, } @@ -247,11 +243,11 @@ class Gist(github.GithubObject.CompletableGithubObject): :rtype: None """ assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description assert files is github.GithubObject.NotSet or all( element is None or isinstance(element, github.InputFileContent) - for element in six.itervalues(files) + for element in files.values() ), files post_parameters = dict() if description is not github.GithubObject.NotSet: @@ -259,7 +255,7 @@ class Gist(github.GithubObject.CompletableGithubObject): if files is not github.GithubObject.NotSet: post_parameters["files"] = { key: None if value is None else value._identity - for key, value in six.iteritems(files) + for key, value in files.items() } headers, data = self._requester.requestJsonAndCheck( "PATCH", self.url, input=post_parameters @@ -272,7 +268,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.GistComment.GistComment` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/comments/" + str(id) ) diff --git a/github/GistComment.py b/github/GistComment.py index dcdf10da..ec06caa3 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -30,10 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.NamedUser @@ -107,7 +103,7 @@ class GistComment(github.GithubObject.CompletableGithubObject): :param body: string :rtype: None """ - assert isinstance(body, (str, six.text_type)), body + assert isinstance(body, str), body post_parameters = { "body": body, } diff --git a/github/GistFile.py b/github/GistFile.py index 7d4b656e..c9245116 100644 --- a/github/GistFile.py +++ b/github/GistFile.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/GistHistoryState.py b/github/GistHistoryState.py index 83647f5f..ade2f3dd 100644 --- a/github/GistHistoryState.py +++ b/github/GistHistoryState.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.CommitStats import github.Gist import github.GithubObject diff --git a/github/GitAuthor.py b/github/GitAuthor.py index 1d7220b1..d7f5dc8a 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/GitBlob.py b/github/GitBlob.py index 3b4dc5fe..2db328d9 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/GitCommit.py b/github/GitCommit.py index 6f14a642..7c50847d 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GitAuthor import github.GithubObject import github.GitTree diff --git a/github/GitObject.py b/github/GitObject.py index edc992fc..ce2fd71f 100644 --- a/github/GitObject.py +++ b/github/GitObject.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/GitRef.py b/github/GitRef.py index 2c64ff9c..36238f7d 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -30,10 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.GitObject @@ -84,7 +80,7 @@ class GitRef(github.GithubObject.CompletableGithubObject): :param force: bool :rtype: None """ - assert isinstance(sha, (str, six.text_type)), sha + assert isinstance(sha, str), sha assert force is github.GithubObject.NotSet or isinstance(force, bool), force post_parameters = { "sha": sha, diff --git a/github/GitRelease.py b/github/GitRelease.py index 351f3bd9..712f7243 100644 --- a/github/GitRelease.py +++ b/github/GitRelease.py @@ -35,12 +35,8 @@ # # ################################################################################ -from __future__ import absolute_import - from os.path import basename -import six - import github.GithubObject import github.GitReleaseAsset import github.NamedUser @@ -195,13 +191,13 @@ class GitRelease(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.GitRelease.GitRelease` """ assert tag_name is github.GithubObject.NotSet or isinstance( - tag_name, (str, six.text_type) + tag_name, str ), "tag_name must be a str/unicode object" assert target_commitish is github.GithubObject.NotSet or isinstance( - target_commitish, (str, six.text_type) + target_commitish, str ), "target_commitish must be a str/unicode object" - assert isinstance(name, (str, six.text_type)), name - assert isinstance(message, (str, six.text_type)), message + assert isinstance(name, str), name + assert isinstance(message, str), message assert isinstance(draft, bool), draft assert isinstance(prerelease, bool), prerelease if tag_name is github.GithubObject.NotSet: @@ -235,11 +231,9 @@ class GitRelease(github.GithubObject.CompletableGithubObject): :calls: `POST https:///repos/:owner/:repo/releases/:release_id/assets `_ :rtype: :class:`github.GitReleaseAsset.GitReleaseAsset` """ - assert isinstance(path, (str, six.text_type)), path - assert isinstance(label, (str, six.text_type)), label - assert name is github.GithubObject.NotSet or isinstance( - name, (str, six.text_type) - ), name + assert isinstance(path, str), path + assert isinstance(label, str), label + assert name is github.GithubObject.NotSet or isinstance(name, str), name post_parameters = {"label": label} if name is github.GithubObject.NotSet: diff --git a/github/GitReleaseAsset.py b/github/GitReleaseAsset.py index 158a0421..8d01c4f5 100644 --- a/github/GitReleaseAsset.py +++ b/github/GitReleaseAsset.py @@ -25,10 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject @@ -165,8 +161,8 @@ class GitReleaseAsset(github.GithubObject.CompletableGithubObject): Update asset metadata. :rtype: github.GitReleaseAsset.GitReleaseAsset """ - assert isinstance(name, (str, six.text_type)), name - assert isinstance(label, (str, six.text_type)), label + assert isinstance(name, str), name + assert isinstance(label, str), label post_parameters = {"name": name, "label": label} headers, data = self._requester.requestJsonAndCheck( "PATCH", self.url, input=post_parameters diff --git a/github/GitTag.py b/github/GitTag.py index fe108cb3..b6eeafb3 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GitAuthor import github.GithubObject import github.GitObject diff --git a/github/GitTree.py b/github/GitTree.py index 866d7866..ebb35270 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.GitTreeElement diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py index 937e63ca..cf7d21e8 100644 --- a/github/GitTreeElement.py +++ b/github/GitTreeElement.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/GithubObject.py b/github/GithubObject.py index 0c7b3b54..ea60399b 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -32,13 +32,9 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from operator import itemgetter -import six - from . import Consts, GithubException @@ -151,11 +147,11 @@ class GithubObject(object): @staticmethod def _makeStringAttribute(value): - return GithubObject.__makeSimpleAttribute(value, (str, six.text_type)) + return GithubObject.__makeSimpleAttribute(value, str) @staticmethod def _makeIntAttribute(value): - return GithubObject.__makeSimpleAttribute(value, six.integer_types) + return GithubObject.__makeSimpleAttribute(value, int) @staticmethod def _makeFloatAttribute(value): @@ -172,7 +168,7 @@ class GithubObject(object): @staticmethod def _makeTimestampAttribute(value): return GithubObject.__makeTransformedAttribute( - value, six.integer_types, datetime.datetime.utcfromtimestamp + value, int, datetime.datetime.utcfromtimestamp ) @staticmethod @@ -193,9 +189,7 @@ class GithubObject(object): else: return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ") - return GithubObject.__makeTransformedAttribute( - value, (str, six.text_type), parseDatetime - ) + return GithubObject.__makeTransformedAttribute(value, str, parseDatetime) def _makeClassAttribute(self, klass, value): return GithubObject.__makeTransformedAttribute( @@ -206,7 +200,7 @@ class GithubObject(object): @staticmethod def _makeListOfStringsAttribute(value): - return GithubObject.__makeSimpleListAttribute(value, (str, six.text_type)) + return GithubObject.__makeSimpleListAttribute(value, str) @staticmethod def _makeListOfIntsAttribute(value): @@ -235,8 +229,8 @@ class GithubObject(object): def _makeDictOfStringsToClassesAttribute(self, klass, value): if isinstance(value, dict) and all( - isinstance(key, (str, six.text_type)) and isinstance(element, dict) - for key, element in six.iteritems(value) + isinstance(key, str) and isinstance(element, dict) + for key, element in value.items() ): return _ValuedAttribute( dict( @@ -244,11 +238,11 @@ class GithubObject(object): key, klass(self._requester, self._headers, element, completed=False), ) - for key, element in six.iteritems(value) + for key, element in value.items() ) ) else: - return _BadAttribute(value, {(str, six.text_type): dict}) + return _BadAttribute(value, {str: dict}) @property def etag(self): @@ -274,13 +268,13 @@ class GithubObject(object): for k, v in sorted(items, key=itemgetter(0), reverse=True): if isinstance(v, bytes): v = v.decode("utf-8") - if isinstance(v, six.text_type): - v = u'"{v}"'.format(v=v) + if isinstance(v, str): + v = '"{v}"'.format(v=v) yield u"{k}={v}".format(k=k, v=v) - return u"{class_name}({params})".format( + return "{class_name}({params})".format( class_name=self.__class__.__name__, - params=u", ".join(list(format_params(params))), + params=", ".join(list(format_params(params))), ) diff --git a/github/GitignoreTemplate.py b/github/GitignoreTemplate.py index b3eaefe5..79c708be 100644 --- a/github/GitignoreTemplate.py +++ b/github/GitignoreTemplate.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Hook.py b/github/Hook.py index 423a6029..75c5473c 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -31,10 +31,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.HookResponse @@ -161,16 +157,16 @@ class Hook(github.GithubObject.CompletableGithubObject): :param active: bool :rtype: None """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name assert isinstance(config, dict), config assert events is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in events + isinstance(element, str) for element in events ), events assert add_events is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in add_events + isinstance(element, str) for element in add_events ), add_events assert remove_events is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in remove_events + isinstance(element, str) for element in remove_events ), remove_events assert active is github.GithubObject.NotSet or isinstance(active, bool), active post_parameters = { diff --git a/github/HookDescription.py b/github/HookDescription.py index 6c23613f..6db95c7a 100644 --- a/github/HookDescription.py +++ b/github/HookDescription.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/HookResponse.py b/github/HookResponse.py index 692700c1..72b02375 100644 --- a/github/HookResponse.py +++ b/github/HookResponse.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/InputFileContent.py b/github/InputFileContent.py index 7c2f578b..1c2cc77d 100644 --- a/github/InputFileContent.py +++ b/github/InputFileContent.py @@ -28,10 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject @@ -46,9 +42,9 @@ class InputFileContent(object): :param new_name: string """ - assert isinstance(content, (str, six.text_type)), content + assert isinstance(content, str), content assert new_name is github.GithubObject.NotSet or isinstance( - new_name, (str, six.text_type) + new_name, str ), new_name self.__newName = new_name self.__content = content diff --git a/github/InputGitAuthor.py b/github/InputGitAuthor.py index 30676e05..17b54902 100644 --- a/github/InputGitAuthor.py +++ b/github/InputGitAuthor.py @@ -30,10 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject @@ -49,10 +45,10 @@ class InputGitAuthor(object): :param date: string """ - assert isinstance(name, (str, six.text_type)), name - assert isinstance(email, (str, six.text_type)), email + assert isinstance(name, str), name + assert isinstance(email, str), email assert date is github.GithubObject.NotSet or isinstance( - date, (str, six.text_type) + date, str ), date # @todo Datetime? self.__name = name diff --git a/github/InputGitTreeElement.py b/github/InputGitTreeElement.py index b45de420..14da2745 100644 --- a/github/InputGitTreeElement.py +++ b/github/InputGitTreeElement.py @@ -28,10 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject @@ -56,16 +52,16 @@ class InputGitTreeElement(object): :param sha: string or None """ - assert isinstance(path, (str, six.text_type)), path - assert isinstance(mode, (str, six.text_type)), mode - assert isinstance(type, (str, six.text_type)), type + assert isinstance(path, str), path + assert isinstance(mode, str), mode + assert isinstance(type, str), type assert content is github.GithubObject.NotSet or isinstance( - content, (str, six.text_type) + content, str ), content assert ( sha is github.GithubObject.NotSet or sha is None - or isinstance(sha, (str, six.text_type)) + or isinstance(sha, str) ), sha self.__path = path self.__mode = mode diff --git a/github/Installation.py b/github/Installation.py index fd9e2839..b83049b9 100644 --- a/github/Installation.py +++ b/github/Installation.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.Authorization import github.Event import github.Gist diff --git a/github/InstallationAuthorization.py b/github/InstallationAuthorization.py index b552dbbc..addd2839 100644 --- a/github/InstallationAuthorization.py +++ b/github/InstallationAuthorization.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NamedUser import github.PaginatedList diff --git a/github/Invitation.py b/github/Invitation.py index 0f5269de..5f7f0c01 100644 --- a/github/Invitation.py +++ b/github/Invitation.py @@ -24,8 +24,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Issue.py b/github/Issue.py index bfbdbba4..63266db5 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -43,12 +43,8 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime - -import six -import six.moves.urllib.parse +import urllib.parse import github.GithubObject import github.IssueComment @@ -294,7 +290,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :rtype: None """ assert all( - isinstance(element, (github.NamedUser.NamedUser, str, six.text_type)) + isinstance(element, (github.NamedUser.NamedUser, str)) for element in assignees ), assignees post_parameters = { @@ -317,8 +313,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :rtype: None """ assert all( - isinstance(element, (github.Label.Label, str, six.text_type)) - for element in labels + isinstance(element, (github.Label.Label, str)) for element in labels ), labels post_parameters = [ label.name if isinstance(label, github.Label.Label) else label @@ -334,7 +329,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :param body: string :rtype: :class:`github.IssueComment.IssueComment` """ - assert isinstance(body, (str, six.text_type)), body + assert isinstance(body, str), body post_parameters = { "body": body, } @@ -375,33 +370,26 @@ class Issue(github.GithubObject.CompletableGithubObject): :param labels: list of string :rtype: None """ - assert title is github.GithubObject.NotSet or isinstance( - title, (str, six.text_type) - ), title - assert body is github.GithubObject.NotSet or isinstance( - body, (str, six.text_type) - ), body + assert title is github.GithubObject.NotSet or isinstance(title, str), title + assert body is github.GithubObject.NotSet or isinstance(body, str), body assert ( assignee is github.GithubObject.NotSet or assignee is None or isinstance(assignee, github.NamedUser.NamedUser) - or isinstance(assignee, (str, six.text_type)) + or isinstance(assignee, str) ), assignee assert assignees is github.GithubObject.NotSet or all( - isinstance(element, github.NamedUser.NamedUser) - or isinstance(element, (str, six.text_type)) + isinstance(element, github.NamedUser.NamedUser) or isinstance(element, str) for element in assignees ), assignees - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state + assert state is github.GithubObject.NotSet or isinstance(state, str), state assert ( milestone is github.GithubObject.NotSet or milestone is None or isinstance(milestone, github.Milestone.Milestone) ), milestone assert labels is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in labels + isinstance(element, str) for element in labels ), labels post_parameters = dict() if title is not github.GithubObject.NotSet: @@ -409,7 +397,7 @@ class Issue(github.GithubObject.CompletableGithubObject): if body is not github.GithubObject.NotSet: post_parameters["body"] = body if assignee is not github.GithubObject.NotSet: - if isinstance(assignee, (str, six.text_type)): + if isinstance(assignee, str): post_parameters["assignee"] = assignee else: post_parameters["assignee"] = assignee._identity if assignee else "" @@ -437,7 +425,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :param lock_reason: string :rtype: None """ - assert isinstance(lock_reason, (str, six.text_type)), lock_reason + assert isinstance(lock_reason, str), lock_reason put_parameters = dict() put_parameters["lock_reason"] = lock_reason headers, data = self._requester.requestJsonAndCheck( @@ -462,7 +450,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.IssueComment.IssueComment` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self._parentUrl(self.url) + "/comments/" + str(id) ) @@ -518,7 +506,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :rtype: None """ assert all( - isinstance(element, (github.NamedUser.NamedUser, str, six.text_type)) + isinstance(element, (github.NamedUser.NamedUser, str)) for element in assignees ), assignees post_parameters = { @@ -540,11 +528,11 @@ class Issue(github.GithubObject.CompletableGithubObject): :param label: :class:`github.Label.Label` or string :rtype: None """ - assert isinstance(label, (github.Label.Label, str, six.text_type)), label + assert isinstance(label, (github.Label.Label, str)), label if isinstance(label, github.Label.Label): label = label._identity else: - label = six.moves.urllib.parse.quote(label) + label = urllib.parse.quote(label) headers, data = self._requester.requestJsonAndCheck( "DELETE", self.url + "/labels/" + label ) @@ -556,8 +544,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :rtype: None """ assert all( - isinstance(element, (github.Label.Label, str, six.text_type)) - for element in labels + isinstance(element, (github.Label.Label, str)) for element in labels ), labels post_parameters = [ label.name if isinstance(label, github.Label.Label) else label @@ -586,9 +573,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :param reaction_type: string :rtype: :class:`github.Reaction.Reaction` """ - assert isinstance( - reaction_type, (str, six.text_type) - ), "reaction type should be a string" + assert isinstance(reaction_type, str), "reaction type should be a string" assert reaction_type in [ "+1", "-1", diff --git a/github/IssueComment.py b/github/IssueComment.py index e25f48f9..ab2b5038 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -33,10 +33,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.NamedUser @@ -128,7 +124,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :param body: string :rtype: None """ - assert isinstance(body, (str, six.text_type)), body + assert isinstance(body, str), body post_parameters = { "body": body, } @@ -158,9 +154,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :param reaction_type: string :rtype: :class:`github.Reaction.Reaction` """ - assert isinstance( - reaction_type, (str, six.text_type) - ), "reaction type should be a string" + assert isinstance(reaction_type, str), "reaction type should be a string" assert reaction_type in [ "+1", "-1", diff --git a/github/IssueEvent.py b/github/IssueEvent.py index f7da5b69..250a87c0 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -31,8 +31,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.Issue import github.NamedUser diff --git a/github/IssuePullRequest.py b/github/IssuePullRequest.py index 9ee61f9d..f35f4da0 100644 --- a/github/IssuePullRequest.py +++ b/github/IssuePullRequest.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Label.py b/github/Label.py index b48d1f74..02c6486c 100644 --- a/github/Label.py +++ b/github/Label.py @@ -31,10 +31,7 @@ # # ################################################################################ -from __future__ import absolute_import - -import six -import six.moves.urllib.parse +import urllib.parse import github.GithubObject @@ -96,10 +93,10 @@ class Label(github.GithubObject.CompletableGithubObject): :param description: string :rtype: None """ - assert isinstance(name, (str, six.text_type)), name - assert isinstance(color, (str, six.text_type)), color + assert isinstance(name, str), name + assert isinstance(color, str), color assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description post_parameters = { "name": name, @@ -117,7 +114,7 @@ class Label(github.GithubObject.CompletableGithubObject): @property def _identity(self): - return six.moves.urllib.parse.quote(self.name) + return urllib.parse.quote(self.name) def _initAttributes(self): self._color = github.GithubObject.NotSet diff --git a/github/License.py b/github/License.py index dd5414db..f9ed8843 100644 --- a/github/License.py +++ b/github/License.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/MainClass.py b/github/MainClass.py index e775916e..829a7e44 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -48,15 +48,12 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime import pickle import time import jwt import requests -import six import urllib3 import github.Gist @@ -120,22 +117,14 @@ class Github(object): :param retry: int or urllib3.util.retry.Retry object """ - assert login_or_token is None or isinstance( - login_or_token, (str, six.text_type) - ), login_or_token - assert password is None or isinstance(password, (str, six.text_type)), password - assert jwt is None or isinstance(jwt, (str, six.text_type)), jwt - assert isinstance(base_url, (str, six.text_type)), base_url - assert isinstance(timeout, six.integer_types), timeout - assert client_id is None or isinstance( - client_id, (str, six.text_type) - ), client_id - assert client_secret is None or isinstance( - client_secret, (str, six.text_type) - ), client_secret - assert user_agent is None or isinstance( - user_agent, (str, six.text_type) - ), user_agent + assert login_or_token is None or isinstance(login_or_token, str), login_or_token + assert password is None or isinstance(password, str), password + assert jwt is None or isinstance(jwt, str), jwt + assert isinstance(base_url, str), base_url + assert isinstance(timeout, int), timeout + assert client_id is None or isinstance(client_id, str), client_id + assert client_secret is None or isinstance(client_secret, str), client_secret + assert user_agent is None or isinstance(user_agent, str), user_agent assert ( retry is None or isinstance(retry, (int)) @@ -230,7 +219,7 @@ class Github(object): :rtype: :class:`github.License.License` """ - assert isinstance(key, (str, six.text_type)), key + assert isinstance(key, str), key headers, data = self.__requester.requestJsonAndCheck("GET", "/licenses/" + key) return github.License.License(self.__requester, headers, data, completed=True) @@ -252,9 +241,7 @@ class Github(object): :param login: string :rtype: :class:`github.NamedUser.NamedUser` """ - assert login is github.GithubObject.NotSet or isinstance( - login, (str, six.text_type) - ), login + assert login is github.GithubObject.NotSet or isinstance(login, str), login if login is github.GithubObject.NotSet: return AuthenticatedUser.AuthenticatedUser( self.__requester, {}, {"url": "/user"}, completed=False @@ -273,9 +260,7 @@ class Github(object): :param since: integer :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ - assert since is github.GithubObject.NotSet or isinstance( - since, six.integer_types - ), since + assert since is github.GithubObject.NotSet or isinstance(since, int), since url_parameters = dict() if since is not github.GithubObject.NotSet: url_parameters["since"] = since @@ -289,7 +274,7 @@ class Github(object): :param login: string :rtype: :class:`github.Organization.Organization` """ - assert isinstance(login, (str, six.text_type)), login + assert isinstance(login, str), login headers, data = self.__requester.requestJsonAndCheck("GET", "/orgs/" + login) return github.Organization.Organization( self.__requester, headers, data, completed=True @@ -301,9 +286,7 @@ class Github(object): :param since: integer :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Organization.Organization` """ - assert since is github.GithubObject.NotSet or isinstance( - since, six.integer_types - ), since + assert since is github.GithubObject.NotSet or isinstance(since, int), since url_parameters = dict() if since is not github.GithubObject.NotSet: url_parameters["since"] = since @@ -319,7 +302,7 @@ class Github(object): :calls: `GET /repos/:owner/:repo `_ or `GET /repositories/:id `_ :rtype: :class:`github.Repository.Repository` """ - assert isinstance(full_name_or_id, (str, six.text_type, int)), full_name_or_id + assert isinstance(full_name_or_id, (str, int)), full_name_or_id url_base = "/repositories/" if isinstance(full_name_or_id, int) else "/repos/" url = "%s%s" % (url_base, full_name_or_id) if lazy: @@ -340,9 +323,7 @@ class Github(object): :param visibility: string ('all','public') :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ - assert since is github.GithubObject.NotSet or isinstance( - since, six.integer_types - ), since + assert since is github.GithubObject.NotSet or isinstance(since, int), since url_parameters = dict() if since is not github.GithubObject.NotSet: url_parameters["since"] = since @@ -375,7 +356,7 @@ class Github(object): :param id: string :rtype: :class:`github.Gist.Gist` """ - assert isinstance(id, (str, six.text_type)), id + assert isinstance(id, str), id headers, data = self.__requester.requestJsonAndCheck("GET", "/gists/" + id) return github.Gist.Gist(self.__requester, headers, data, completed=True) @@ -410,7 +391,7 @@ class Github(object): :param qualifiers: keyword dict query qualifiers :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ - assert isinstance(query, (str, six.text_type)), query + assert isinstance(query, str), query url_parameters = dict() if ( sort is not github.GithubObject.NotSet @@ -455,7 +436,7 @@ class Github(object): :param qualifiers: keyword dict query qualifiers :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ - assert isinstance(query, (str, six.text_type)), query + assert isinstance(query, str), query url_parameters = dict() if sort is not github.GithubObject.NotSet: assert sort in ("followers", "repositories", "joined"), sort @@ -496,7 +477,7 @@ class Github(object): :param qualifiers: keyword dict query qualifiers :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue` """ - assert isinstance(query, (str, six.text_type)), query + assert isinstance(query, str), query url_parameters = dict() if sort is not github.GithubObject.NotSet: assert sort in ("comments", "created", "updated"), sort @@ -536,7 +517,7 @@ class Github(object): :param qualifiers: keyword dict query qualifiers :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.ContentFile.ContentFile` """ - assert isinstance(query, (str, six.text_type)), query + assert isinstance(query, str), query url_parameters = dict() if ( sort is not github.GithubObject.NotSet @@ -584,7 +565,7 @@ class Github(object): :param qualifiers: keyword dict query qualifiers :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Commit.Commit` """ - assert isinstance(query, (str, six.text_type)), query + assert isinstance(query, str), query url_parameters = dict() if ( sort is not github.GithubObject.NotSet @@ -622,7 +603,7 @@ class Github(object): :param qualifiers: keyword dict query qualifiers :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Topic.Topic` """ - assert isinstance(query, (str, six.text_type)), query + assert isinstance(query, str), query url_parameters = dict() query_chunks = [] @@ -650,7 +631,7 @@ class Github(object): :param context: :class:`github.Repository.Repository` :rtype: string """ - assert isinstance(text, (str, six.text_type)), text + assert isinstance(text, str), text assert context is github.GithubObject.NotSet or isinstance( context, github.Repository.Repository ), context @@ -669,7 +650,7 @@ class Github(object): :param name: string :rtype: :class:`github.HookDescription.HookDescription` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name headers, attributes = self.__requester.requestJsonAndCheck( "GET", "/hooks/" + name ) @@ -705,7 +686,7 @@ class Github(object): :calls: `GET /gitignore/templates/:name `_ :rtype: :class:`github.GitignoreTemplate.GitignoreTemplate` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name headers, attributes = self.__requester.requestJsonAndCheck( "GET", "/gitignore/templates/" + name ) @@ -779,7 +760,7 @@ class GithubIntegration(object): self.base_url = base_url self.integration_id = integration_id self.private_key = private_key - assert isinstance(base_url, (str, six.text_type)), base_url + assert isinstance(base_url, str), base_url def create_jwt(self, expiration=60): """ diff --git a/github/Migration.py b/github/Migration.py index 4365775f..94ae9110 100644 --- a/github/Migration.py +++ b/github/Migration.py @@ -32,10 +32,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.NamedUser import github.PaginatedList @@ -171,7 +167,7 @@ class Migration(github.GithubObject.CompletableGithubObject): :param repo_name: str :rtype: None """ - assert isinstance(repo_name, (str, six.text_type)), repo_name + assert isinstance(repo_name, str), repo_name headers, data = self._requester.requestJsonAndCheck( "DELETE", self.url + "/repos/" + repo_name + "/lock", diff --git a/github/Milestone.py b/github/Milestone.py index 647aedf4..4362a47c 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -30,12 +30,8 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime -import six - import github.GithubObject import github.Label import github.NamedUser @@ -178,12 +174,10 @@ class Milestone(github.GithubObject.CompletableGithubObject): :param due_on: date :rtype: None """ - assert isinstance(title, (str, six.text_type)), title - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state + assert isinstance(title, str), title + assert state is github.GithubObject.NotSet or isinstance(state, str), state assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description assert due_on is github.GithubObject.NotSet or isinstance( due_on, datetime.date diff --git a/github/NamedUser.py b/github/NamedUser.py index 686dd09a..d1ad8cf5 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -37,12 +37,8 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime -import six - import github.Event import github.Gist import github.GithubObject @@ -521,7 +517,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :param name: string :rtype: :class:`github.Repository.Repository` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name headers, data = self._requester.requestJsonAndCheck( "GET", "/repos/" + self.login + "/" + name ) @@ -542,14 +538,10 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :param direction: string :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ - assert type is github.GithubObject.NotSet or isinstance( - type, (str, six.text_type) - ), type - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert type is github.GithubObject.NotSet or isinstance(type, str), type + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction url_parameters = dict() if type is not github.GithubObject.NotSet: @@ -617,7 +609,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :param org: string or :class:`github.Organization.Organization` :rtype: :class:`github.Membership.Membership` """ - assert isinstance(org, (str, six.text_type)) or isinstance( + assert isinstance(org, str) or isinstance( org, github.Organization.Organization ), org if isinstance(org, github.Organization.Organization): diff --git a/github/Notification.py b/github/Notification.py index 74efbf2f..174d59c2 100644 --- a/github/Notification.py +++ b/github/Notification.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NotificationSubject import github.Repository diff --git a/github/NotificationSubject.py b/github/NotificationSubject.py index d97c256e..83bee7d3 100644 --- a/github/NotificationSubject.py +++ b/github/NotificationSubject.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Organization.py b/github/Organization.py index 6ff06102..eb4439bd 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -41,12 +41,8 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime -import six - import github.Event import github.GithubObject import github.NamedUser @@ -322,9 +318,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :param role: string :rtype: None """ - assert role is github.GithubObject.NotSet or isinstance( - role, (str, six.text_type) - ), role + assert role is github.GithubObject.NotSet or isinstance(role, str), role assert isinstance(member, github.NamedUser.NamedUser), member put_parameters = {} if role is not github.GithubObject.NotSet: @@ -378,10 +372,10 @@ class Organization(github.GithubObject.CompletableGithubObject): :param active: bool :rtype: :class:`github.Hook.Hook` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name assert isinstance(config, dict), config assert events is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in events + isinstance(element, str) for element in events ), events assert active is github.GithubObject.NotSet or isinstance(active, bool), active post_parameters = { @@ -434,12 +428,12 @@ class Organization(github.GithubObject.CompletableGithubObject): :param allow_rebase_merge: bool :rtype: :class:`github.Repository.Repository` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description assert homepage is github.GithubObject.NotSet or isinstance( - homepage, (str, six.text_type) + homepage, str ), homepage assert private is github.GithubObject.NotSet or isinstance( private, bool @@ -457,16 +451,16 @@ class Organization(github.GithubObject.CompletableGithubObject): has_projects, bool ), has_projects assert team_id is github.GithubObject.NotSet or isinstance( - team_id, six.integer_types + team_id, int ), team_id assert auto_init is github.GithubObject.NotSet or isinstance( auto_init, bool ), auto_init assert license_template is github.GithubObject.NotSet or isinstance( - license_template, (str, six.text_type) + license_template, str ), license_template assert gitignore_template is github.GithubObject.NotSet or isinstance( - gitignore_template, (str, six.text_type) + gitignore_template, str ), gitignore_template assert allow_squash_merge is github.GithubObject.NotSet or isinstance( allow_squash_merge, bool @@ -532,18 +526,18 @@ class Organization(github.GithubObject.CompletableGithubObject): :param description: string :rtype: :class:`github.Team.Team` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name assert repo_names is github.GithubObject.NotSet or all( isinstance(element, github.Repository.Repository) for element in repo_names ), repo_names assert permission is github.GithubObject.NotSet or isinstance( - permission, (str, six.text_type) + permission, str ), permission assert privacy is github.GithubObject.NotSet or isinstance( - privacy, (str, six.text_type) + privacy, str ), privacy assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description post_parameters = { "name": name, @@ -569,7 +563,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: None` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "DELETE", self.url + "/hooks/" + str(id) ) @@ -596,26 +590,20 @@ class Organization(github.GithubObject.CompletableGithubObject): :rtype: None """ assert billing_email is github.GithubObject.NotSet or isinstance( - billing_email, (str, six.text_type) + billing_email, str ), billing_email - assert blog is github.GithubObject.NotSet or isinstance( - blog, (str, six.text_type) - ), blog + assert blog is github.GithubObject.NotSet or isinstance(blog, str), blog assert company is github.GithubObject.NotSet or isinstance( - company, (str, six.text_type) + company, str ), company assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description - assert email is github.GithubObject.NotSet or isinstance( - email, (str, six.text_type) - ), email + assert email is github.GithubObject.NotSet or isinstance(email, str), email assert location is github.GithubObject.NotSet or isinstance( - location, (str, six.text_type) + location, str ), location - assert name is github.GithubObject.NotSet or isinstance( - name, (str, six.text_type) - ), name + assert name is github.GithubObject.NotSet or isinstance(name, str), name post_parameters = dict() if billing_email is not github.GithubObject.NotSet: post_parameters["billing_email"] = billing_email @@ -653,11 +641,11 @@ class Organization(github.GithubObject.CompletableGithubObject): :param active: bool :rtype: :class:`github.Hook.Hook` """ - assert isinstance(id, six.integer_types), id - assert isinstance(name, (str, six.text_type)), name + assert isinstance(id, int), id + assert isinstance(name, str), name assert isinstance(config, dict), config assert events is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in events + isinstance(element, str) for element in events ), events assert active is github.GithubObject.NotSet or isinstance(active, bool), active post_parameters = { @@ -688,7 +676,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.Hook.Hook` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/hooks/" + str(id) ) @@ -723,20 +711,14 @@ class Organization(github.GithubObject.CompletableGithubObject): :param since: datetime.datetime :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue` """ - assert filter is github.GithubObject.NotSet or isinstance( - filter, (str, six.text_type) - ), filter - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state + assert filter is github.GithubObject.NotSet or isinstance(filter, str), filter + assert state is github.GithubObject.NotSet or isinstance(state, str), state assert labels is github.GithubObject.NotSet or all( isinstance(element, github.Label.Label) for element in labels ), labels - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction assert since is github.GithubObject.NotSet or isinstance( since, datetime.datetime @@ -768,11 +750,9 @@ class Organization(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ assert filter_ is github.GithubObject.NotSet or isinstance( - filter_, (str, six.text_type) + filter_, str ), filter_ - assert role is github.GithubObject.NotSet or isinstance( - role, (str, six.text_type) - ), role + assert role is github.GithubObject.NotSet or isinstance(role, str), role url_parameters = {} if filter_ is not github.GithubObject.NotSet: @@ -824,7 +804,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ assert filter_ is github.GithubObject.NotSet or isinstance( - filter_, (str, six.text_type) + filter_, str ), filter_ url_parameters = {} @@ -865,7 +845,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :param name: string :rtype: :class:`github.Repository.Repository` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name headers, data = self._requester.requestJsonAndCheck( "GET", "/repos/" + self.login + "/" + name ) @@ -886,14 +866,10 @@ class Organization(github.GithubObject.CompletableGithubObject): :param direction: string ('asc', desc') :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ - assert type is github.GithubObject.NotSet or isinstance( - type, (str, six.text_type) - ), type - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert type is github.GithubObject.NotSet or isinstance(type, str), type + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction url_parameters = dict() @@ -916,7 +892,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.Team.Team` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck("GET", "/teams/" + str(id)) return github.Team.Team(self._requester, headers, data, completed=True) @@ -926,7 +902,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :param slug: string :rtype: :class:`github.Team.Team` """ - assert isinstance(slug, (str, six.text_type)), slug + assert isinstance(slug, str), slug headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/teams/" + slug ) @@ -972,9 +948,7 @@ class Organization(github.GithubObject.CompletableGithubObject): assert user is github.GithubObject.NotSet or isinstance( user, github.NamedUser.NamedUser ), user - assert email is github.GithubObject.NotSet or isinstance( - email, (str, six.text_type) - ), email + assert email is github.GithubObject.NotSet or isinstance(email, str), email assert (email is github.GithubObject.NotSet) ^ ( user is github.GithubObject.NotSet ), "specify only one of email or user" @@ -984,7 +958,7 @@ class Organization(github.GithubObject.CompletableGithubObject): elif email is not github.GithubObject.NotSet: parameters["email"] = email if role is not github.GithubObject.NotSet: - assert isinstance(role, (str, six.text_type)), role + assert isinstance(role, str), role assert role in ["admin", "direct_member", "billing_manager"] parameters["role"] = role if teams is not github.GithubObject.NotSet: @@ -1072,7 +1046,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.Migration.Migration` """ assert isinstance(repos, (list, tuple)), repos - assert all(isinstance(repo, (str, six.text_type)) for repo in repos), repos + assert all(isinstance(repo, str) for repo in repos), repos assert lock_repositories is github.GithubObject.NotSet or isinstance( lock_repositories, bool ), lock_repositories diff --git a/github/PaginatedList.py b/github/PaginatedList.py index c6cf41a0..b6327444 100644 --- a/github/PaginatedList.py +++ b/github/PaginatedList.py @@ -37,10 +37,7 @@ # # ################################################################################ -from __future__ import absolute_import - -import six -from six.moves.urllib.parse import parse_qs +from urllib.parse import parse_qs class PaginatedListBase: @@ -49,7 +46,7 @@ class PaginatedListBase: def __getitem__(self, index): assert isinstance(index, (int, slice)) - if isinstance(index, six.integer_types): + if isinstance(index, int): self.__fetchToIndex(index) return self.__elements[index] else: diff --git a/github/Path.py b/github/Path.py index 8df76115..7b2102b8 100644 --- a/github/Path.py +++ b/github/Path.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Permissions.py b/github/Permissions.py index 84084796..95b13c85 100644 --- a/github/Permissions.py +++ b/github/Permissions.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Plan.py b/github/Plan.py index 3ab504b1..a740afbb 100644 --- a/github/Plan.py +++ b/github/Plan.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Project.py b/github/Project.py index 9bc4ec01..a7e8062c 100644 --- a/github/Project.py +++ b/github/Project.py @@ -22,10 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.ProjectColumn @@ -163,7 +159,7 @@ class Project(github.GithubObject.CompletableGithubObject): calls: `POST https://developer.github.com/v3/projects/columns/#create-a-project-column>`_ :param name: string """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name post_parameters = {"name": name} import_header = {"Accept": Consts.mediaTypeProjectsPreview} headers, data = self._requester.requestJsonAndCheck( diff --git a/github/ProjectCard.py b/github/ProjectCard.py index 2715ce9b..13dff57d 100644 --- a/github/ProjectCard.py +++ b/github/ProjectCard.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject # NOTE: There is currently no way to get cards "in triage" for a project. diff --git a/github/ProjectColumn.py b/github/ProjectColumn.py index 7301508d..244a3184 100644 --- a/github/ProjectColumn.py +++ b/github/ProjectColumn.py @@ -22,10 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.Project import github.ProjectCard @@ -104,7 +100,7 @@ class ProjectColumn(github.GithubObject.CompletableGithubObject): :param archived_state: string """ assert archived_state is github.GithubObject.NotSet or isinstance( - archived_state, (str, six.text_type) + archived_state, str ), archived_state url_parameters = dict() @@ -132,14 +128,14 @@ class ProjectColumn(github.GithubObject.CompletableGithubObject): :param content_type: string """ post_parameters = {} - if isinstance(note, (str, six.text_type)): + if isinstance(note, str): assert content_id is github.GithubObject.NotSet, content_id assert content_type is github.GithubObject.NotSet, content_type post_parameters = {"note": note} else: assert note is github.GithubObject.NotSet, note assert isinstance(content_id, int), content_id - assert isinstance(content_type, (str, six.text_type)), content_type + assert isinstance(content_type, str), content_type post_parameters = {"content_id": content_id, "content_type": content_type} import_header = {"Accept": Consts.mediaTypeProjectsPreview} diff --git a/github/PullRequest.py b/github/PullRequest.py index b7b97ac1..62c1a4bf 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -42,12 +42,8 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime - -import six -import six.moves.urllib.parse +import urllib.parse import github.Commit import github.File @@ -389,10 +385,10 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :param position: integer :rtype: :class:`github.PullRequestComment.PullRequestComment` """ - assert isinstance(body, (str, six.text_type)), body + assert isinstance(body, str), body assert isinstance(commit_id, github.Commit.Commit), commit_id - assert isinstance(path, (str, six.text_type)), path - assert isinstance(position, six.integer_types), position + assert isinstance(path, str), path + assert isinstance(position, int), position post_parameters = { "body": body, "commit_id": commit_id._identity, @@ -412,7 +408,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :param body: string :rtype: :class:`github.IssueComment.IssueComment` """ - assert isinstance(body, (str, six.text_type)), body + assert isinstance(body, str), body post_parameters = { "body": body, } @@ -478,13 +474,11 @@ class PullRequest(github.GithubObject.CompletableGithubObject): """ post_parameters = dict() if reviewers is not github.GithubObject.NotSet: - assert all( - isinstance(element, (str, six.text_type)) for element in reviewers - ), reviewers + assert all(isinstance(element, str) for element in reviewers), reviewers post_parameters["reviewers"] = reviewers if team_reviewers is not github.GithubObject.NotSet: assert all( - isinstance(element, (str, six.text_type)) for element in team_reviewers + isinstance(element, str) for element in team_reviewers ), team_reviewers post_parameters["team_reviewers"] = team_reviewers headers, data = self._requester.requestJsonAndCheck( @@ -504,13 +498,11 @@ class PullRequest(github.GithubObject.CompletableGithubObject): """ post_parameters = dict() if reviewers is not github.GithubObject.NotSet: - assert all( - isinstance(element, (str, six.text_type)) for element in reviewers - ), reviewers + assert all(isinstance(element, str) for element in reviewers), reviewers post_parameters["reviewers"] = reviewers if team_reviewers is not github.GithubObject.NotSet: assert all( - isinstance(element, (str, six.text_type)) for element in team_reviewers + isinstance(element, str) for element in team_reviewers ), team_reviewers post_parameters["team_reviewers"] = team_reviewers headers, data = self._requester.requestJsonAndCheck( @@ -532,18 +524,10 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :param base: string :rtype: None """ - assert title is github.GithubObject.NotSet or isinstance( - title, (str, six.text_type) - ), title - assert body is github.GithubObject.NotSet or isinstance( - body, (str, six.text_type) - ), body - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state - assert base is github.GithubObject.NotSet or isinstance( - base, (str, six.text_type) - ), base + assert title is github.GithubObject.NotSet or isinstance(title, str), title + assert body is github.GithubObject.NotSet or isinstance(body, str), body + assert state is github.GithubObject.NotSet or isinstance(state, str), state + assert base is github.GithubObject.NotSet or isinstance(base, str), base post_parameters = dict() if title is not github.GithubObject.NotSet: post_parameters["title"] = title @@ -572,7 +556,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.PullRequestComment.PullRequestComment` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self._parentUrl(self.url) + "/comments/" + str(id) ) @@ -614,7 +598,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestComment.PullRequestComment` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id return github.PaginatedList.PaginatedList( github.PullRequestComment.PullRequestComment, self._requester, @@ -646,7 +630,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.IssueComment.IssueComment` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self._parentUrl(self.issue_url) + "/comments/" + str(id) ) @@ -685,7 +669,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.PullRequestReview.PullRequestReview` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/reviews/" + str(id), ) @@ -743,8 +727,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :rtype: None """ assert all( - isinstance(element, (github.Label.Label, str, six.text_type)) - for element in labels + isinstance(element, (github.Label.Label, str)) for element in labels ), labels post_parameters = [ label.name if isinstance(label, github.Label.Label) else label @@ -769,11 +752,11 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :param label: :class:`github.Label.Label` or string :rtype: None """ - assert isinstance(label, (github.Label.Label, str, six.text_type)), label + assert isinstance(label, (github.Label.Label, str)), label if isinstance(label, github.Label.Label): label = label._identity else: - label = six.moves.urllib.parse.quote(label) + label = urllib.parse.quote(label) headers, data = self._requester.requestJsonAndCheck( "DELETE", self.issue_url + "/labels/" + label ) @@ -785,8 +768,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :rtype: None """ assert all( - isinstance(element, (github.Label.Label, str, six.text_type)) - for element in labels + isinstance(element, (github.Label.Label, str)) for element in labels ), labels post_parameters = [ label.name if isinstance(label, github.Label.Label) else label @@ -817,17 +799,15 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.PullRequestMergeStatus.PullRequestMergeStatus` """ assert commit_message is github.GithubObject.NotSet or isinstance( - commit_message, (str, six.text_type) + commit_message, str ), commit_message assert commit_title is github.GithubObject.NotSet or isinstance( - commit_title, (str, six.text_type) + commit_title, str ), commit_title assert merge_method is github.GithubObject.NotSet or isinstance( - merge_method, (str, six.text_type) + merge_method, str ), merge_method - assert sha is github.GithubObject.NotSet or isinstance( - sha, (str, six.text_type) - ), sha + assert sha is github.GithubObject.NotSet or isinstance(sha, str), sha post_parameters = dict() if commit_message is not github.GithubObject.NotSet: post_parameters["commit_message"] = commit_message @@ -896,7 +876,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :param expected_head_sha: string :rtype: bool """ - assert isinstance(expected_head_sha, (str, six.text_type)), expected_head_sha + assert isinstance(expected_head_sha, str), expected_head_sha post_parameters = {"expected_head_sha": expected_head_sha} status, headers, data = self._requester.requestJson( "PUT", diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index 4b5dcaa8..e6e0e82e 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -34,10 +34,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.NamedUser @@ -185,7 +181,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :param body: string :rtype: None """ - assert isinstance(body, (str, six.text_type)), body + assert isinstance(body, str), body post_parameters = { "body": body, } @@ -215,9 +211,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :param reaction_type: string :rtype: :class:`github.Reaction.Reaction` """ - assert isinstance( - reaction_type, (str, six.text_type) - ), "reaction type should be a string" + assert isinstance(reaction_type, str), "reaction type should be a string" assert reaction_type in [ "+1", "-1", diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index 00018111..add34390 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -31,8 +31,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py index 5bd6a33a..a069b2f1 100644 --- a/github/PullRequestPart.py +++ b/github/PullRequestPart.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NamedUser import github.Repository diff --git a/github/PullRequestReview.py b/github/PullRequestReview.py index edd53de4..59f603b1 100644 --- a/github/PullRequestReview.py +++ b/github/PullRequestReview.py @@ -26,10 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.NamedUser @@ -119,7 +115,7 @@ class PullRequestReview(github.GithubObject.CompletableGithubObject): :calls: `PUT /repos/:owner/:repo/pulls/:number/reviews/:review_id/dismissals `_ :rtype: None """ - assert isinstance(message, (str, six.text_type)), message + assert isinstance(message, str), message post_parameters = {"message": message} headers, data = self._requester.requestJsonAndCheck( "PUT", diff --git a/github/Rate.py b/github/Rate.py index 9646290b..2b78af73 100644 --- a/github/Rate.py +++ b/github/Rate.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/RateLimit.py b/github/RateLimit.py index eba10a7b..b1a173fe 100644 --- a/github/RateLimit.py +++ b/github/RateLimit.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - from deprecated import deprecated import github.GithubObject diff --git a/github/Reaction.py b/github/Reaction.py index 10f8d048..624ac8b7 100644 --- a/github/Reaction.py +++ b/github/Reaction.py @@ -24,8 +24,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NamedUser diff --git a/github/Referrer.py b/github/Referrer.py index 1c10a495..e2140764 100644 --- a/github/Referrer.py +++ b/github/Referrer.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Repository.py b/github/Repository.py index 0faea720..c1d1e466 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -85,14 +85,11 @@ # # ################################################################################ -from __future__ import absolute_import - import collections import datetime +import urllib.parse from base64 import b64encode -import six -import six.moves.urllib.parse from deprecated import deprecated import github.Branch @@ -783,10 +780,10 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: None """ assert isinstance(collaborator, github.NamedUser.NamedUser) or isinstance( - collaborator, (str, six.text_type) + collaborator, str ), collaborator assert permission is github.GithubObject.NotSet or isinstance( - permission, (str, six.text_type) + permission, str ), permission if isinstance(collaborator, github.NamedUser.NamedUser): @@ -815,7 +812,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: string """ assert isinstance(collaborator, github.NamedUser.NamedUser) or isinstance( - collaborator, (str, six.text_type) + collaborator, str ), collaborator if isinstance(collaborator, github.NamedUser.NamedUser): collaborator = collaborator._identity @@ -854,8 +851,8 @@ class Repository(github.GithubObject.CompletableGithubObject): :param head: string :rtype: :class:`github.Comparison.Comparison` """ - assert isinstance(base, (str, six.text_type)), base - assert isinstance(head, (str, six.text_type)), head + assert isinstance(base, str), base + assert isinstance(head, str), head headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/compare/" + base + "..." + head ) @@ -870,8 +867,8 @@ class Repository(github.GithubObject.CompletableGithubObject): :param encoding: string :rtype: :class:`github.GitBlob.GitBlob` """ - assert isinstance(content, (str, six.text_type)), content - assert isinstance(encoding, (str, six.text_type)), encoding + assert isinstance(content, str), content + assert isinstance(encoding, str), encoding post_parameters = { "content": content, "encoding": encoding, @@ -898,7 +895,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param committer: :class:`github.InputGitAuthor.InputGitAuthor` :rtype: :class:`github.GitCommit.GitCommit` """ - assert isinstance(message, (str, six.text_type)), message + assert isinstance(message, str), message assert isinstance(tree, github.GitTree.GitTree), tree assert all( isinstance(element, github.GitCommit.GitCommit) for element in parents @@ -932,8 +929,8 @@ class Repository(github.GithubObject.CompletableGithubObject): :param sha: string :rtype: :class:`github.GitRef.GitRef` """ - assert isinstance(ref, (str, six.text_type)), ref - assert isinstance(sha, (str, six.text_type)), sha + assert isinstance(ref, str), ref + assert isinstance(sha, str), sha post_parameters = { "ref": ref, "sha": sha, @@ -979,16 +976,15 @@ class Repository(github.GithubObject.CompletableGithubObject): :param target_commitish: string or :class:`github.Branch.Branch` or :class:`github.Commit.Commit` or :class:`github.GitCommit.GitCommit` :rtype: :class:`github.GitRelease.GitRelease` """ - assert isinstance(tag, (str, six.text_type)), tag - assert isinstance(name, (str, six.text_type)), name - assert isinstance(message, (str, six.text_type)), message + assert isinstance(tag, str), tag + assert isinstance(name, str), name + assert isinstance(message, str), message assert isinstance(draft, bool), draft assert isinstance(prerelease, bool), prerelease assert target_commitish is github.GithubObject.NotSet or isinstance( target_commitish, ( str, - six.text_type, github.Branch.Branch, github.Commit.Commit, github.GitCommit.GitCommit, @@ -1001,7 +997,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "draft": draft, "prerelease": prerelease, } - if isinstance(target_commitish, (str, six.text_type)): + if isinstance(target_commitish, str): post_parameters["target_commitish"] = target_commitish elif isinstance(target_commitish, github.Branch.Branch): post_parameters["target_commitish"] = target_commitish.name @@ -1028,10 +1024,10 @@ class Repository(github.GithubObject.CompletableGithubObject): :param tagger: :class:`github.InputGitAuthor.InputGitAuthor` :rtype: :class:`github.GitTag.GitTag` """ - assert isinstance(tag, (str, six.text_type)), tag - assert isinstance(message, (str, six.text_type)), message - assert isinstance(object, (str, six.text_type)), object - assert isinstance(type, (str, six.text_type)), type + assert isinstance(tag, str), tag + assert isinstance(message, str), message + assert isinstance(object, str), object + assert isinstance(type, str), type assert tagger is github.GithubObject.NotSet or isinstance( tagger, github.InputGitAuthor ), tagger @@ -1086,10 +1082,10 @@ class Repository(github.GithubObject.CompletableGithubObject): :param active: bool :rtype: :class:`github.Hook.Hook` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name assert isinstance(config, dict), config assert events is github.GithubObject.NotSet or all( - isinstance(element, (str, six.text_type)) for element in events + isinstance(element, str) for element in events ), events assert active is github.GithubObject.NotSet or isinstance(active, bool), active post_parameters = { @@ -1124,26 +1120,22 @@ class Repository(github.GithubObject.CompletableGithubObject): :param labels: list of :class:`github.Label.Label` :rtype: :class:`github.Issue.Issue` """ - assert isinstance(title, (str, six.text_type)), title - assert body is github.GithubObject.NotSet or isinstance( - body, (str, six.text_type) - ), body + assert isinstance(title, str), title + assert body is github.GithubObject.NotSet or isinstance(body, str), body assert ( assignee is github.GithubObject.NotSet or isinstance(assignee, github.NamedUser.NamedUser) - or isinstance(assignee, (str, six.text_type)) + or isinstance(assignee, str) ), assignee assert assignees is github.GithubObject.NotSet or all( - isinstance(element, github.NamedUser.NamedUser) - or isinstance(element, (str, six.text_type)) + isinstance(element, github.NamedUser.NamedUser) or isinstance(element, str) for element in assignees ), assignees assert milestone is github.GithubObject.NotSet or isinstance( milestone, github.Milestone.Milestone ), milestone assert labels is github.GithubObject.NotSet or all( - isinstance(element, github.Label.Label) - or isinstance(element, (str, six.text_type)) + isinstance(element, github.Label.Label) or isinstance(element, str) for element in labels ), labels @@ -1153,7 +1145,7 @@ class Repository(github.GithubObject.CompletableGithubObject): if body is not github.GithubObject.NotSet: post_parameters["body"] = body if assignee is not github.GithubObject.NotSet: - if isinstance(assignee, (str, six.text_type)): + if isinstance(assignee, str): post_parameters["assignee"] = assignee else: post_parameters["assignee"] = assignee._identity @@ -1184,8 +1176,8 @@ class Repository(github.GithubObject.CompletableGithubObject): :param read_only: bool :rtype: :class:`github.RepositoryKey.RepositoryKey` """ - assert isinstance(title, (str, six.text_type)), title - assert isinstance(key, (str, six.text_type)), key + assert isinstance(title, str), title + assert isinstance(key, str), key assert isinstance(read_only, bool), read_only post_parameters = { "title": title, @@ -1207,10 +1199,10 @@ class Repository(github.GithubObject.CompletableGithubObject): :param description: string :rtype: :class:`github.Label.Label` """ - assert isinstance(name, (str, six.text_type)), name - assert isinstance(color, (str, six.text_type)), color + assert isinstance(name, str), name + assert isinstance(color, str), color assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description post_parameters = { "name": name, @@ -1241,12 +1233,10 @@ class Repository(github.GithubObject.CompletableGithubObject): :param due_on: datetime :rtype: :class:`github.Milestone.Milestone` """ - assert isinstance(title, (str, six.text_type)), title - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state + assert isinstance(title, str), title + assert state is github.GithubObject.NotSet or isinstance(state, str), state assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description assert due_on is github.GithubObject.NotSet or isinstance( due_on, (datetime.datetime, datetime.date) @@ -1276,10 +1266,8 @@ class Repository(github.GithubObject.CompletableGithubObject): :param name: string :param body: string """ - assert isinstance(name, (str, six.text_type)), name - assert body is github.GithubObject.NotSet or isinstance( - body, (str, six.text_type) - ), body + assert isinstance(name, str), name + assert body is github.GithubObject.NotSet or isinstance(body, str), body post_parameters = { "name": name, "body": body, @@ -1311,10 +1299,10 @@ class Repository(github.GithubObject.CompletableGithubObject): def __create_pull_1( self, title, body, base, head, maintainer_can_modify=github.GithubObject.NotSet ): - assert isinstance(title, (str, six.text_type)), title - assert isinstance(body, (str, six.text_type)), body - assert isinstance(base, (str, six.text_type)), base - assert isinstance(head, (str, six.text_type)), head + assert isinstance(title, str), title + assert isinstance(body, str), body + assert isinstance(base, str), base + assert isinstance(head, str), head assert maintainer_can_modify is github.GithubObject.NotSet or isinstance( maintainer_can_modify, bool ), maintainer_can_modify @@ -1331,8 +1319,8 @@ class Repository(github.GithubObject.CompletableGithubObject): def __create_pull_2(self, issue, base, head): assert isinstance(issue, github.Issue.Issue), issue - assert isinstance(base, (str, six.text_type)), base - assert isinstance(head, (str, six.text_type)), head + assert isinstance(base, str), base + assert isinstance(head, str), head return self.__create_pull(issue=issue._identity, base=base, head=head) def __create_pull(self, **kwds): @@ -1359,13 +1347,13 @@ class Repository(github.GithubObject.CompletableGithubObject): :param vcs_password: string :rtype: :class:`github.SourceImport.SourceImport` """ - assert isinstance(vcs, (str, six.text_type)), vcs - assert isinstance(vcs_url, (str, six.text_type)), vcs_url + assert isinstance(vcs, str), vcs + assert isinstance(vcs_url, str), vcs_url assert vcs_username is github.GithubObject.NotSet or isinstance( - vcs_username, (str, six.text_type) + vcs_username, str ), vcs_username assert vcs_password is github.GithubObject.NotSet or isinstance( - vcs_password, (str, six.text_type) + vcs_password, str ), vcs_password put_parameters = {"vcs": vcs, "vcs_url": vcs_url} @@ -1427,12 +1415,12 @@ class Repository(github.GithubObject.CompletableGithubObject): """ if name is None: name = self.name - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description assert homepage is github.GithubObject.NotSet or isinstance( - homepage, (str, six.text_type) + homepage, str ), homepage assert private is github.GithubObject.NotSet or isinstance( private, bool @@ -1450,7 +1438,7 @@ class Repository(github.GithubObject.CompletableGithubObject): has_downloads, bool ), has_downloads assert default_branch is github.GithubObject.NotSet or isinstance( - default_branch, (str, six.text_type) + default_branch, str ), default_branch assert allow_squash_merge is github.GithubObject.NotSet or isinstance( allow_squash_merge, bool @@ -1503,10 +1491,8 @@ class Repository(github.GithubObject.CompletableGithubObject): :param ref: string :rtype: string """ - assert isinstance(archive_format, (str, six.text_type)), archive_format - assert ref is github.GithubObject.NotSet or isinstance( - ref, (str, six.text_type) - ), ref + assert isinstance(archive_format, str), archive_format + assert ref is github.GithubObject.NotSet or isinstance(ref, str), ref url = self.url + "/" + archive_format if ref is not github.GithubObject.NotSet: url += "/" + ref @@ -1528,7 +1514,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param branch: string :rtype: :class:`github.Branch.Branch` """ - assert isinstance(branch, (str, six.text_type)), branch + assert isinstance(branch, str), branch headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/branches/" + branch ) @@ -1572,7 +1558,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.CommitComment.CommitComment` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/comments/" + str(id) ) @@ -1598,7 +1584,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param sha: string :rtype: :class:`github.Commit.Commit` """ - assert isinstance(sha, (str, six.text_type)), sha + assert isinstance(sha, str), sha headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/commits/" + sha ) @@ -1621,12 +1607,8 @@ class Repository(github.GithubObject.CompletableGithubObject): :param author: string or :class:`github.NamedUser.NamedUser` or :class:`github.AuthenticatedUser.AuthenticatedUser` :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Commit.Commit` """ - assert sha is github.GithubObject.NotSet or isinstance( - sha, (str, six.text_type) - ), sha - assert path is github.GithubObject.NotSet or isinstance( - path, (str, six.text_type) - ), path + assert sha is github.GithubObject.NotSet or isinstance(sha, str), sha + assert path is github.GithubObject.NotSet or isinstance(path, str), path assert since is github.GithubObject.NotSet or isinstance( since, datetime.datetime ), since @@ -1637,7 +1619,6 @@ class Repository(github.GithubObject.CompletableGithubObject): author, ( str, - six.text_type, github.NamedUser.NamedUser, github.AuthenticatedUser.AuthenticatedUser, ), @@ -1673,10 +1654,8 @@ class Repository(github.GithubObject.CompletableGithubObject): :param ref: string :rtype: :class:`github.ContentFile.ContentFile` or a list of them """ - assert isinstance(path, (str, six.text_type)), path - assert ref is github.GithubObject.NotSet or isinstance( - ref, (str, six.text_type) - ), ref + assert isinstance(path, str), path + assert ref is github.GithubObject.NotSet or isinstance(ref, str), ref # Path of '/' should be the empty string. if path == "/": path = "" @@ -1685,7 +1664,7 @@ class Repository(github.GithubObject.CompletableGithubObject): url_parameters["ref"] = ref headers, data = self._requester.requestJsonAndCheck( "GET", - self.url + "/contents/" + six.moves.urllib.parse.quote(path), + self.url + "/contents/" + urllib.parse.quote(path), parameters=url_parameters, ) @@ -1743,7 +1722,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: None or list of :class:`github.View.View` """ assert per is github.GithubObject.NotSet or ( - isinstance(per, (str, six.text_type)) and (per == "day" or per == "week") + isinstance(per, str) and (per == "day" or per == "week") ), "per must be day or week, day by default" url_parameters = dict() if per is not github.GithubObject.NotSet: @@ -1769,7 +1748,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: None or list of :class:`github.Clone.Clone` """ assert per is github.GithubObject.NotSet or ( - isinstance(per, (str, six.text_type)) and (per == "day" or per == "week") + isinstance(per, str) and (per == "day" or per == "week") ), "per must be day or week, day by default" url_parameters = dict() if per is not github.GithubObject.NotSet: @@ -1829,22 +1808,16 @@ class Repository(github.GithubObject.CompletableGithubObject): 'content': :class:`ContentFile `:, 'commit': :class:`Commit `} """ - assert isinstance(path, (str, six.text_type)), "path must be str/unicode object" - assert isinstance( - message, (str, six.text_type) - ), "message must be str/unicode object" - assert isinstance( - content, (str, six.text_type, bytes) - ), "content must be a str/unicode object" - assert branch is github.GithubObject.NotSet or isinstance( - branch, (str, six.text_type) - ), "branch must be a str/unicode object" + assert isinstance(path, str) + assert isinstance(message, str) + assert isinstance(content, (str, bytes)) + assert branch is github.GithubObject.NotSet or isinstance(branch, str) assert author is github.GithubObject.NotSet or isinstance( author, github.InputGitAuthor - ), "author must be a github.InputGitAuthor object" + ) assert committer is github.GithubObject.NotSet or isinstance( committer, github.InputGitAuthor - ), "committer must be a github.InputGitAuthor object" + ) if not isinstance(content, bytes): content = content.encode("utf-8") @@ -1860,7 +1833,7 @@ class Repository(github.GithubObject.CompletableGithubObject): headers, data = self._requester.requestJsonAndCheck( "PUT", - self.url + "/contents/" + six.moves.urllib.parse.quote(path), + self.url + "/contents/" + urllib.parse.quote(path), input=put_parameters, ) @@ -1897,23 +1870,17 @@ class Repository(github.GithubObject.CompletableGithubObject): 'content': :class:`ContentFile `:, 'commit': :class:`Commit `} """ - assert isinstance(path, (str, six.text_type)), "path must be str/unicode object" - assert isinstance( - message, (str, six.text_type) - ), "message must be str/unicode object" - assert isinstance( - content, (str, six.text_type, bytes) - ), "content must be a str/unicode object" - assert isinstance(sha, (str, six.text_type)), "sha must be a str/unicode object" - assert branch is github.GithubObject.NotSet or isinstance( - branch, (str, six.text_type) - ), "branch must be a str/unicode object" + assert isinstance(path, str) + assert isinstance(message, str) + assert isinstance(content, (str, bytes)) + assert isinstance(sha, str) + assert branch is github.GithubObject.NotSet or isinstance(branch, str) assert author is github.GithubObject.NotSet or isinstance( author, github.InputGitAuthor - ), "author must be a github.InputGitAuthor object" + ) assert committer is github.GithubObject.NotSet or isinstance( committer, github.InputGitAuthor - ), "committer must be a github.InputGitAuthor object" + ) if not isinstance(content, bytes): content = content.encode("utf-8") @@ -1930,7 +1897,7 @@ class Repository(github.GithubObject.CompletableGithubObject): headers, data = self._requester.requestJsonAndCheck( "PUT", - self.url + "/contents/" + six.moves.urllib.parse.quote(path), + self.url + "/contents/" + urllib.parse.quote(path), input=put_parameters, ) @@ -1965,13 +1932,11 @@ class Repository(github.GithubObject.CompletableGithubObject): 'content': :class:`null `:, 'commit': :class:`Commit `} """ - assert isinstance(path, (str, six.text_type)), "path must be str/unicode object" - assert isinstance( - message, (str, six.text_type) - ), "message must be str/unicode object" - assert isinstance(sha, (str, six.text_type)), "sha must be a str/unicode object" + assert isinstance(path, str), "path must be str/unicode object" + assert isinstance(message, str), "message must be str/unicode object" + assert isinstance(sha, str), "sha must be a str/unicode object" assert branch is github.GithubObject.NotSet or isinstance( - branch, (str, six.text_type) + branch, str ), "branch must be a str/unicode object" assert author is github.GithubObject.NotSet or isinstance( author, github.InputGitAuthor @@ -1990,7 +1955,7 @@ class Repository(github.GithubObject.CompletableGithubObject): headers, data = self._requester.requestJsonAndCheck( "DELETE", - self.url + "/contents/" + six.moves.urllib.parse.quote(path), + self.url + "/contents/" + urllib.parse.quote(path), input=url_parameters, ) @@ -2039,7 +2004,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.Download.Download` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/downloads/" + str(id) ) @@ -2079,7 +2044,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.Repository.Repository` """ assert organization is github.GithubObject.NotSet or isinstance( - organization, (str, six.text_type) + organization, str ), organization post_parameters = {} if organization is not None: @@ -2095,7 +2060,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param sha: string :rtype: :class:`github.GitBlob.GitBlob` """ - assert isinstance(sha, (str, six.text_type)), sha + assert isinstance(sha, str), sha headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/git/blobs/" + sha ) @@ -2107,7 +2072,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param sha: string :rtype: :class:`github.GitCommit.GitCommit` """ - assert isinstance(sha, (str, six.text_type)), sha + assert isinstance(sha, str), sha headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/git/commits/" + sha ) @@ -2124,7 +2089,7 @@ class Repository(github.GithubObject.CompletableGithubObject): prefix = "/git/refs/" if not self._requester.FIX_REPO_GET_GIT_REF: prefix = "/git/" - assert isinstance(ref, (str, six.text_type)), ref + assert isinstance(ref, str), ref headers, data = self._requester.requestJsonAndCheck( "GET", self.url + prefix + ref ) @@ -2145,7 +2110,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param sha: string :rtype: :class:`github.GitTag.GitTag` """ - assert isinstance(sha, (str, six.text_type)), sha + assert isinstance(sha, str), sha headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/git/tags/" + sha ) @@ -2158,7 +2123,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param recursive: bool :rtype: :class:`github.GitTree.GitTree` """ - assert isinstance(sha, (str, six.text_type)), sha + assert isinstance(sha, str), sha assert recursive is github.GithubObject.NotSet or isinstance( recursive, bool ), recursive @@ -2177,7 +2142,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.Hook.Hook` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/hooks/" + str(id) ) @@ -2198,7 +2163,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param number: integer :rtype: :class:`github.Issue.Issue` """ - assert isinstance(number, six.integer_types), number + assert isinstance(number, int), number headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/issues/" + str(number) ) @@ -2235,13 +2200,11 @@ class Repository(github.GithubObject.CompletableGithubObject): or milestone == "none" or isinstance(milestone, github.Milestone.Milestone) ), milestone - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state + assert state is github.GithubObject.NotSet or isinstance(state, str), state assert ( assignee is github.GithubObject.NotSet or isinstance(assignee, github.NamedUser.NamedUser) - or isinstance(assignee, (str, six.text_type)) + or isinstance(assignee, str) ), assignee assert mentioned is github.GithubObject.NotSet or isinstance( mentioned, github.NamedUser.NamedUser @@ -2249,11 +2212,9 @@ class Repository(github.GithubObject.CompletableGithubObject): assert labels is github.GithubObject.NotSet or all( isinstance(element, github.Label.Label) for element in labels ), labels - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction assert since is github.GithubObject.NotSet or isinstance( since, datetime.datetime @@ -2261,18 +2222,18 @@ class Repository(github.GithubObject.CompletableGithubObject): assert ( creator is github.GithubObject.NotSet or isinstance(creator, github.NamedUser.NamedUser) - or isinstance(creator, (str, six.text_type)) + or isinstance(creator, str) ), creator url_parameters = dict() if milestone is not github.GithubObject.NotSet: - if isinstance(milestone, (str, six.text_type)): + if isinstance(milestone, str): url_parameters["milestone"] = milestone else: url_parameters["milestone"] = milestone._identity if state is not github.GithubObject.NotSet: url_parameters["state"] = state if assignee is not github.GithubObject.NotSet: - if isinstance(assignee, (str, six.text_type)): + if isinstance(assignee, str): url_parameters["assignee"] = assignee else: url_parameters["assignee"] = assignee._identity @@ -2287,7 +2248,7 @@ class Repository(github.GithubObject.CompletableGithubObject): if since is not github.GithubObject.NotSet: url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ") if creator is not github.GithubObject.NotSet: - if isinstance(creator, (str, six.text_type)): + if isinstance(creator, str): url_parameters["creator"] = creator else: url_parameters["creator"] = creator._identity @@ -2308,11 +2269,9 @@ class Repository(github.GithubObject.CompletableGithubObject): :param since: datetime.datetime :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueComment.IssueComment` """ - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction assert since is github.GithubObject.NotSet or isinstance( since, datetime.datetime @@ -2337,7 +2296,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.IssueEvent.IssueEvent` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/issues/events/" + str(id), @@ -2366,7 +2325,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param id: integer :rtype: :class:`github.RepositoryKey.RepositoryKey` """ - assert isinstance(id, six.integer_types), id + assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/keys/" + str(id) ) @@ -2392,9 +2351,9 @@ class Repository(github.GithubObject.CompletableGithubObject): :param name: string :rtype: :class:`github.Label.Label` """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name headers, data = self._requester.requestJsonAndCheck( - "GET", self.url + "/labels/" + six.moves.urllib.parse.quote(name) + "GET", self.url + "/labels/" + urllib.parse.quote(name) ) return github.Label.Label(self._requester, headers, data, completed=True) @@ -2436,7 +2395,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param number: integer :rtype: :class:`github.Milestone.Milestone` """ - assert isinstance(number, six.integer_types), number + assert isinstance(number, int), number headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/milestones/" + str(number) ) @@ -2457,14 +2416,10 @@ class Repository(github.GithubObject.CompletableGithubObject): :param direction: string :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Milestone.Milestone` """ - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert state is github.GithubObject.NotSet or isinstance(state, str), state + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction url_parameters = dict() if state is not github.GithubObject.NotSet: @@ -2498,7 +2453,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param number: integer :rtype: :class:`github.PullRequest.PullRequest` """ - assert isinstance(number, six.integer_types), number + assert isinstance(number, int), number headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/pulls/" + str(number) ) @@ -2523,21 +2478,13 @@ class Repository(github.GithubObject.CompletableGithubObject): :param head: string :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequest.PullRequest` """ - assert state is github.GithubObject.NotSet or isinstance( - state, (str, six.text_type) - ), state - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert state is github.GithubObject.NotSet or isinstance(state, str), state + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction - assert base is github.GithubObject.NotSet or isinstance( - base, (str, six.text_type) - ), base - assert head is github.GithubObject.NotSet or isinstance( - head, (str, six.text_type) - ), head + assert base is github.GithubObject.NotSet or isinstance(base, str), base + assert head is github.GithubObject.NotSet or isinstance(head, str), head url_parameters = dict() if state is not github.GithubObject.NotSet: url_parameters["state"] = state @@ -2584,11 +2531,9 @@ class Repository(github.GithubObject.CompletableGithubObject): :param since: datetime.datetime :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestComment.PullRequestComment` """ - assert sort is github.GithubObject.NotSet or isinstance( - sort, (str, six.text_type) - ), sort + assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort assert direction is github.GithubObject.NotSet or isinstance( - direction, (str, six.text_type) + direction, str ), direction assert since is github.GithubObject.NotSet or isinstance( since, datetime.datetime @@ -2613,9 +2558,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :param ref: string :rtype: :class:`github.ContentFile.ContentFile` """ - assert ref is github.GithubObject.NotSet or isinstance( - ref, (str, six.text_type) - ), ref + assert ref is github.GithubObject.NotSet or isinstance(ref, str), ref url_parameters = dict() if ref is not github.GithubObject.NotSet: url_parameters["ref"] = ref @@ -2788,7 +2731,7 @@ class Repository(github.GithubObject.CompletableGithubObject): return github.GitRelease.GitRelease( self._requester, headers, data, completed=True ) - elif isinstance(id, (str, six.text_type)): + elif isinstance(id, str): headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/releases/tags/" + id ) @@ -2845,7 +2788,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: bool """ assert isinstance(assignee, github.NamedUser.NamedUser) or isinstance( - assignee, (str, six.text_type) + assignee, str ), assignee if isinstance(assignee, github.NamedUser.NamedUser): @@ -2863,7 +2806,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: bool """ assert isinstance(collaborator, github.NamedUser.NamedUser) or isinstance( - collaborator, (str, six.text_type) + collaborator, str ), collaborator if isinstance(collaborator, github.NamedUser.NamedUser): @@ -2877,8 +2820,7 @@ class Repository(github.GithubObject.CompletableGithubObject): def _legacy_convert_issue(self, attributes): convertedAttributes = { "number": attributes["number"], - "url": "/repos" - + six.moves.urllib.parse.urlparse(attributes["html_url"]).path, + "url": "/repos" + urllib.parse.urlparse(attributes["html_url"]).path, "user": { "login": attributes["user"], "url": "/users/" + attributes["user"], @@ -2901,7 +2843,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue` """ assert state in ["open", "closed"], state - assert isinstance(keyword, (str, six.text_type)), keyword + assert isinstance(keyword, str), keyword headers, data = self._requester.requestJsonAndCheck( "GET", "/legacy/issues/search/" @@ -2911,7 +2853,7 @@ class Repository(github.GithubObject.CompletableGithubObject): + "/" + state + "/" - + six.moves.urllib.parse.quote(keyword), + + urllib.parse.quote(keyword), ) return [ github.Issue.Issue( @@ -2987,10 +2929,10 @@ class Repository(github.GithubObject.CompletableGithubObject): :param commit_message: string :rtype: :class:`github.Commit.Commit` """ - assert isinstance(base, (str, six.text_type)), base - assert isinstance(head, (str, six.text_type)), head + assert isinstance(base, str), base + assert isinstance(head, str), head assert commit_message is github.GithubObject.NotSet or isinstance( - commit_message, (str, six.text_type) + commit_message, str ), commit_message post_parameters = { "base": base, @@ -3087,7 +3029,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: None """ assert isinstance(collaborator, github.NamedUser.NamedUser) or isinstance( - collaborator, (str, six.text_type) + collaborator, str ), collaborator if isinstance(collaborator, github.NamedUser.NamedUser): @@ -3118,12 +3060,10 @@ class Repository(github.GithubObject.CompletableGithubObject): return self._hub("unsubscribe", event, callback, github.GithubObject.NotSet) def _hub(self, mode, event, callback, secret): - assert isinstance(mode, (str, six.text_type)), mode - assert isinstance(event, (str, six.text_type)), event - assert isinstance(callback, (str, six.text_type)), callback - assert secret is github.GithubObject.NotSet or isinstance( - secret, (str, six.text_type) - ), secret + assert isinstance(mode, str), mode + assert isinstance(event, str), event + assert isinstance(callback, str), callback + assert secret is github.GithubObject.NotSet or isinstance(secret, str), secret post_parameters = collections.OrderedDict() post_parameters["hub.callback"] = callback diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 7ec47e49..11dba434 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -35,8 +35,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/Requester.py b/github/Requester.py index f253f0f3..71a7d192 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -52,8 +52,6 @@ # # ################################################################################ -from __future__ import absolute_import - import base64 import json import logging @@ -61,11 +59,10 @@ import mimetypes import os import re import time +import urllib from io import IOBase import requests -import six -import six.moves.urllib.parse from . import Consts, GithubException @@ -78,7 +75,7 @@ class RequestsResponse: self.text = r.text def getheaders(self): - return six.iteritems(self.headers) + return self.headers.items() def read(self): return self.text @@ -286,7 +283,7 @@ class Requester: self.__authorizationHeader = None self.__base_url = base_url - o = six.moves.urllib.parse.urlparse(base_url) + o = urllib.parse.urlparse(base_url) self.__hostname = o.hostname self.__port = o.port self.__prefix = o.path @@ -348,7 +345,7 @@ class Requester: def __customConnection(self, url): cnx = None if not url.startswith("/"): - o = six.moves.urllib.parse.urlparse(url) + o = urllib.parse.urlparse(url) if ( o.hostname != self.__hostname or (o.port and o.port != self.__port) @@ -420,7 +417,7 @@ class Requester: eol = "\r\n" encoded_input = "" - for name, value in six.iteritems(input): + for name, value in input.items(): encoded_input += "--" + boundary + eol encoded_input += ( 'Content-Disposition: form-data; name="' + name + '"' + eol @@ -518,7 +515,7 @@ class Requester: return self.__requestRaw(original_cnx, verb, url, requestHeaders, input) if status == 301 and "location" in responseHeaders: - o = six.moves.urllib.parse.urlparse(responseHeaders["location"]) + o = urllib.parse.urlparse(responseHeaders["location"]) return self.__requestRaw(original_cnx, verb, o.path, requestHeaders, input) return status, responseHeaders, output @@ -536,7 +533,7 @@ class Requester: if url.startswith("/"): url = self.__prefix + url else: - o = six.moves.urllib.parse.urlparse(url) + o = urllib.parse.urlparse(url) assert o.hostname in [ self.__hostname, "uploads.github.com", @@ -553,7 +550,7 @@ class Requester: if len(parameters) == 0: return url else: - return url + "?" + six.moves.urllib.parse.urlencode(parameters) + return url + "?" + urllib.parse.urlencode(parameters) def __createConnection(self): kwds = {} diff --git a/github/RequiredPullRequestReviews.py b/github/RequiredPullRequestReviews.py index daaf2483..34b8ce43 100644 --- a/github/RequiredPullRequestReviews.py +++ b/github/RequiredPullRequestReviews.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NamedUser import github.Team diff --git a/github/RequiredStatusChecks.py b/github/RequiredStatusChecks.py index 94d74a48..e4fba2e1 100644 --- a/github/RequiredStatusChecks.py +++ b/github/RequiredStatusChecks.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/SourceImport.py b/github/SourceImport.py index 2eef55e9..a7c46248 100644 --- a/github/SourceImport.py +++ b/github/SourceImport.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject from github import Consts diff --git a/github/Stargazer.py b/github/Stargazer.py index 3982caf9..71f51705 100644 --- a/github/Stargazer.py +++ b/github/Stargazer.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github diff --git a/github/StatsCodeFrequency.py b/github/StatsCodeFrequency.py index ab41868a..aab58812 100755 --- a/github/StatsCodeFrequency.py +++ b/github/StatsCodeFrequency.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/StatsCommitActivity.py b/github/StatsCommitActivity.py index 714e94f8..ade32342 100755 --- a/github/StatsCommitActivity.py +++ b/github/StatsCommitActivity.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/StatsContributor.py b/github/StatsContributor.py index 0bbb248b..0f974a2a 100755 --- a/github/StatsContributor.py +++ b/github/StatsContributor.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NamedUser diff --git a/github/StatsParticipation.py b/github/StatsParticipation.py index 60a64ceb..546b7784 100755 --- a/github/StatsParticipation.py +++ b/github/StatsParticipation.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/StatsPunchCard.py b/github/StatsPunchCard.py index a9742d90..e602345a 100755 --- a/github/StatsPunchCard.py +++ b/github/StatsPunchCard.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject import github.NamedUser # TODO remove unused diff --git a/github/Tag.py b/github/Tag.py index 1f60de70..65a601b2 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -31,8 +31,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.Commit import github.GithubObject diff --git a/github/Team.py b/github/Team.py index 8c28a758..047438fa 100644 --- a/github/Team.py +++ b/github/Team.py @@ -41,10 +41,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - import github.GithubObject import github.NamedUser import github.Organization @@ -181,9 +177,7 @@ class Team(github.GithubObject.CompletableGithubObject): :rtype: None """ assert isinstance(member, github.NamedUser.NamedUser), member - assert role is github.GithubObject.NotSet or isinstance( - role, (str, six.text_type) - ), role + assert role is github.GithubObject.NotSet or isinstance(role, str), role if role is not github.GithubObject.NotSet: assert role in ["member", "maintainer"] put_parameters = { @@ -245,15 +239,15 @@ class Team(github.GithubObject.CompletableGithubObject): :param privacy: string :rtype: None """ - assert isinstance(name, (str, six.text_type)), name + assert isinstance(name, str), name assert description is github.GithubObject.NotSet or isinstance( - description, (str, six.text_type) + description, str ), description assert permission is github.GithubObject.NotSet or isinstance( - permission, (str, six.text_type) + permission, str ), permission assert privacy is github.GithubObject.NotSet or isinstance( - privacy, (str, six.text_type) + privacy, str ), privacy post_parameters = { "name": name, @@ -288,9 +282,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, six.text_type) - ), role + assert role is github.GithubObject.NotSet or isinstance(role, str), role url_parameters = dict() if role is not github.GithubObject.NotSet: assert role in ["member", "maintainer", "all"] diff --git a/github/TeamDiscussion.py b/github/TeamDiscussion.py index cd1ddf4f..207ebe4e 100644 --- a/github/TeamDiscussion.py +++ b/github/TeamDiscussion.py @@ -22,7 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import import github.GithubObject import github.NamedUser diff --git a/github/Topic.py b/github/Topic.py index cdee4214..bb5aaffb 100644 --- a/github/Topic.py +++ b/github/Topic.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/UserKey.py b/github/UserKey.py index c18a60d4..d8ff31b9 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -31,8 +31,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/View.py b/github/View.py index 0c7b6547..d0180543 100644 --- a/github/View.py +++ b/github/View.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.GithubObject diff --git a/github/__init__.py b/github/__init__.py index d6fe13e6..3bf517b1 100644 --- a/github/__init__.py +++ b/github/__init__.py @@ -37,8 +37,6 @@ like :class:`github.NamedUser.NamedUser` or :class:`github.Repository.Repository All classes inherit from :class:`github.GithubObject.GithubObject`. """ -from __future__ import absolute_import - import logging from github.MainClass import Github, GithubIntegration diff --git a/manage.sh b/manage.sh index b6c6e089..2d65667d 100755 --- a/manage.sh +++ b/manage.sh @@ -18,19 +18,10 @@ function fix_headers { } function test { - test2 - test3 -} - -function test2 { coverage run --branch --include=github/*.py --omit=github/tests/*.py setup.py test --quiet || exit coverage report --show-missing || exit } -function test3 { - python3 setup.py test --quiet || exit -} - function bump { previousVersion=$( grep '^version =' setup.py | sed 's/version = \"\(.*\)\"/\1/' ) echo "Next version number? (previous: '$previousVersion')" diff --git a/requirements.txt b/requirements.txt index e29381df..d678b9ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ requests>=2.14.0 pyjwt -six sphinx<1.8 sphinx-rtd-theme<0.5 Deprecated diff --git a/scripts/add_attribute.py b/scripts/add_attribute.py index 18ad75b7..b905ca2d 100644 --- a/scripts/add_attribute.py +++ b/scripts/add_attribute.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import os.path import sys @@ -41,35 +39,11 @@ else: types = { - "string": ( - "string", - None, - 'self._makeStringAttribute(attributes["' + attributeName + '"])', - ), - "int": ( - "integer", - None, - 'self._makeIntAttribute(attributes["' + attributeName + '"])', - ), - "bool": ( - "bool", - None, - 'self._makeBoolAttribute(attributes["' + attributeName + '"])', - ), - "datetime": ( - "datetime.datetime", - "(str, unicode)", - 'self._makeDatetimeAttribute(attributes["' + attributeName + '"])', - ), - "class": ( - ":class:`" + attributeClassType + "`", - None, - "self._makeClassAttribute(" - + attributeClassType - + ', attributes["' - + attributeName - + '"])', - ), + "string": ("string", None, "self._makeStringAttribute(attributes[\"" + attributeName + "\"])"), + "int": ("integer", None, "self._makeIntAttribute(attributes[\"" + attributeName + "\"])"), + "bool": ("bool", None, "self._makeBoolAttribute(attributes[\"" + attributeName + "\"])"), + "datetime": ("datetime.datetime", "(str, unicode)", "self._makeDatetimeAttribute(attributes[\"" + attributeName + "\"])"), + "class": (":class:`" + attributeClassType + "`", None, "self._makeClassAttribute(" + attributeClassType + ", attributes[\"" + attributeName + "\"])"), } attributeDocType, attributeAssertType, attributeValue = types[attributeType] @@ -99,19 +73,15 @@ while not added: elif line.startswith(" def "): attrName = line[8:-7] # Properties will be inserted after __repr__, but before any other function. - if attrName != "__repr__" and ( - attrName == "_identity" or attrName > attributeName or not isProperty - ): + if attrName != "__repr__" and (attrName == "_identity" or attrName > attributeName or not isProperty): if not isProperty: newLines.append(" @property") newLines.append(" def " + attributeName + "(self):") - newLines.append(' """') + newLines.append(" \"\"\"") newLines.append(" :type: " + attributeDocType) - newLines.append(' """') + newLines.append(" \"\"\"") if isCompletable: - newLines.append( - " self._completeIfNotSet(self._" + attributeName + ")" - ) + newLines.append(" self._completeIfNotSet(self._" + attributeName + ")") newLines.append(" return self._" + attributeName + ".value") newLines.append("") if isProperty: @@ -133,9 +103,7 @@ while not added: if line: attrName = line[14:-29] if not line or attrName > attributeName: - newLines.append( - " self._" + attributeName + " = github.GithubObject.NotSet" - ) + newLines.append(" self._" + attributeName + " = github.GithubObject.NotSet") added = True newLines.append(line) @@ -155,26 +123,10 @@ while not added: if line: attrName = line[12:-36] if not line or attrName > attributeName: - newLines.append( - ' if "' - + attributeName - + '" in attributes: # pragma no branch' - ) + newLines.append(" if \"" + attributeName + "\" in attributes: # pragma no branch") if attributeAssertType: - newLines.append( - ' assert attributes["' - + attributeName - + '"] is None or isinstance(attributes["' - + attributeName - + '"], ' - + attributeAssertType - + '), attributes["' - + attributeName - + '"]' - ) - newLines.append( - " self._" + attributeName + " = " + attributeValue - ) + newLines.append(" assert attributes[\"" + attributeName + "\"] is None or isinstance(attributes[\"" + attributeName + "\"], " + attributeAssertType + "), attributes[\"" + attributeName + "\"]") + newLines.append(" self._" + attributeName + " = " + attributeValue) added = True newLines.append(line) diff --git a/scripts/fix_headers.py b/scripts/fix_headers.py index 1e71479d..ff6a3c0e 100755 --- a/scripts/fix_headers.py +++ b/scripts/fix_headers.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import, print_function - import os import subprocess @@ -63,9 +61,7 @@ def generateLicenseSection(filename): def listContributors(filename): contributors = set() - for line in subprocess.check_output( - ["git", "log", "--format=format:%ad %an <%ae>", "--date=short", "--", filename] - ).split("\n"): + for line in subprocess.check_output(["git", "log", "--format=format:%ad %an <%ae>", "--date=short", "--", filename]).split("\n"): year = line[0:4] name = line[11:] contributors.add((year, name)) @@ -109,11 +105,7 @@ class PythonHeader: if len(bodyLines) > 0 and bodyLines[0] != "": newLines.append("") - if ( - "import " not in bodyLines[0] - and bodyLines[0] != '"""' - and not bodyLines[0].startswith("##########") - ): + if "import " not in bodyLines[0] and bodyLines[0] != '"""' and not bodyLines[0].startswith("##########"): newLines.append("") newLines += bodyLines @@ -137,7 +129,7 @@ class StandardHeader: def findHeadersAndFiles(): - for root, dirs, files in os.walk(".", topdown=True): + for root, dirs, files in os.walk('.', topdown=True): if ".git" in dirs: dirs.remove(".git") if "developer.github.com" in dirs: diff --git a/setup.py b/setup.py index 704f3f7e..1f123faa 100755 --- a/setup.py +++ b/setup.py @@ -41,22 +41,12 @@ # # ################################################################################ -import sys import textwrap import setuptools version = "1.45" -tests_require = [ - "cryptography", - "httpretty>=0.9.6", - "parameterized>=0.7.0", -] - -if sys.version_info < (3, 3): - tests_require.append("mock==3.0.5") - if __name__ == "__main__": setuptools.setup( @@ -101,8 +91,6 @@ if __name__ == "__main__": "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", @@ -111,8 +99,8 @@ if __name__ == "__main__": "Topic :: Software Development", ], test_suite="tests.AllTests", - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", - install_requires=["deprecated", "pyjwt", "requests>=2.14.0", "six"], + python_requires=">=3.5", + install_requires=["deprecated", "pyjwt", "requests>=2.14.0"], extras_require={"integrations": ["cryptography"]}, - tests_require=tests_require, + tests_require=["cryptography", "httpretty>=0.9.6", "parameterized>=0.7.0"], ) diff --git a/test-requirements.txt b/test-requirements.txt index b5327a5e..48a0d018 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,3 @@ cryptography httpretty>=0.9.6 -mock==3.0.5; python_version < '3.3' parameterized>=0.7.0 diff --git a/tests/AllTests.py b/tests/AllTests.py index 4b83a250..1c26b239 100644 --- a/tests/AllTests.py +++ b/tests/AllTests.py @@ -40,7 +40,6 @@ # # ################################################################################ -from __future__ import absolute_import from .AuthenticatedUser import AuthenticatedUser from .Authentication import Authentication diff --git a/tests/AuthenticatedUser.py b/tests/AuthenticatedUser.py index 9137b30c..6aacb1e0 100644 --- a/tests/AuthenticatedUser.py +++ b/tests/AuthenticatedUser.py @@ -32,8 +32,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime import github diff --git a/tests/Authentication.py b/tests/Authentication.py index a38fec52..0cafc8fd 100644 --- a/tests/Authentication.py +++ b/tests/Authentication.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github from . import Framework diff --git a/tests/Authorization.py b/tests/Authorization.py index 434d4ec9..54e91878 100644 --- a/tests/Authorization.py +++ b/tests/Authorization.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/BadAttributes.py b/tests/BadAttributes.py index ed474b30..7b48fe90 100755 --- a/tests/BadAttributes.py +++ b/tests/BadAttributes.py @@ -26,12 +26,8 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime -import six - import github from . import Framework @@ -46,7 +42,7 @@ class BadAttributes(Framework.TestCase): with self.assertRaises(github.BadAttributeException) as raisedexp: user.name self.assertEqual(raisedexp.exception.actual_value, 42) - self.assertEqual(raisedexp.exception.expected_type, (str, six.text_type)) + self.assertEqual(raisedexp.exception.expected_type, str) self.assertEqual(raisedexp.exception.transformation_exception, None) def testBadAttributeTransformation(self): @@ -56,7 +52,7 @@ class BadAttributes(Framework.TestCase): with self.assertRaises(github.BadAttributeException) as raisedexp: user.created_at self.assertEqual(raisedexp.exception.actual_value, "foobar") - self.assertEqual(raisedexp.exception.expected_type, (str, six.text_type)) + self.assertEqual(raisedexp.exception.expected_type, str) self.assertEqual( raisedexp.exception.transformation_exception.__class__, ValueError ) @@ -72,7 +68,7 @@ class BadAttributes(Framework.TestCase): with self.assertRaises(github.BadAttributeException) as raisedexp: user.updated_at self.assertEqual(raisedexp.exception.actual_value, 42) - self.assertEqual(raisedexp.exception.expected_type, (str, six.text_type)) + self.assertEqual(raisedexp.exception.expected_type, str) self.assertEqual(raisedexp.exception.transformation_exception, None) def testBadSimpleAttributeInList(self): @@ -82,7 +78,7 @@ class BadAttributes(Framework.TestCase): with self.assertRaises(github.BadAttributeException) as raisedexp: hook.events self.assertEqual(raisedexp.exception.actual_value, ["push", 42]) - self.assertEqual(raisedexp.exception.expected_type, [(str, six.text_type)]) + self.assertEqual(raisedexp.exception.expected_type, [str]) self.assertEqual(raisedexp.exception.transformation_exception, None) def testBadAttributeInClassAttribute(self): @@ -111,9 +107,7 @@ class BadAttributes(Framework.TestCase): with self.assertRaises(github.BadAttributeException) as raisedexp: gist.files self.assertEqual(raisedexp.exception.actual_value, {"test.py": 42}) - self.assertEqual( - raisedexp.exception.expected_type, {(str, six.text_type): dict} - ) + self.assertEqual(raisedexp.exception.expected_type, {str: dict}) self.assertEqual(raisedexp.exception.transformation_exception, None) def testIssue195(self): @@ -302,5 +296,5 @@ class BadAttributes(Framework.TestCase): ] ], ) - self.assertEqual(raisedexp.exception.expected_type, [(str, six.text_type)]) + self.assertEqual(raisedexp.exception.expected_type, [str]) self.assertEqual(raisedexp.exception.transformation_exception, None) diff --git a/tests/Branch.py b/tests/Branch.py index 66b2dc09..4623c338 100644 --- a/tests/Branch.py +++ b/tests/Branch.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github from . import Framework diff --git a/tests/BranchProtection.py b/tests/BranchProtection.py index 769d96b1..eba5c57e 100644 --- a/tests/BranchProtection.py +++ b/tests/BranchProtection.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Commit.py b/tests/Commit.py index d8b29fdc..f61613ef 100644 --- a/tests/Commit.py +++ b/tests/Commit.py @@ -29,10 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - -import six - from . import Framework @@ -64,7 +60,7 @@ class Commit(Framework.TestCase): self.assertEqual( self.commit.files[0].filename, "github/GithubObjects/GitAuthor.py" ) - self.assertTrue(isinstance(self.commit.files[0].patch, (str, six.text_type))) + self.assertTrue(isinstance(self.commit.files[0].patch, str)) self.assertEqual( self.commit.files[0].raw_url, "https://github.com/jacquev6/PyGithub/raw/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py", diff --git a/tests/CommitCombinedStatus.py b/tests/CommitCombinedStatus.py index e8fae897..1f9db98b 100644 --- a/tests/CommitCombinedStatus.py +++ b/tests/CommitCombinedStatus.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/CommitComment.py b/tests/CommitComment.py index 49911db7..2fbaf360 100644 --- a/tests/CommitComment.py +++ b/tests/CommitComment.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/CommitStatus.py b/tests/CommitStatus.py index 84c76d5a..19c35ceb 100644 --- a/tests/CommitStatus.py +++ b/tests/CommitStatus.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/ConditionalRequestUpdate.py b/tests/ConditionalRequestUpdate.py index 16c7acfb..0a0c31a7 100644 --- a/tests/ConditionalRequestUpdate.py +++ b/tests/ConditionalRequestUpdate.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Connection.py b/tests/Connection.py index f3d1db07..ab541760 100644 --- a/tests/Connection.py +++ b/tests/Connection.py @@ -22,23 +22,17 @@ # # ################################################################################ -from __future__ import absolute_import import itertools import unittest from io import StringIO +from unittest.mock import Mock import httpretty from parameterized import parameterized from . import Framework -try: - from unittest.mock import Mock -except ImportError: - from mock import Mock - - PARAMETERS = itertools.product( [ (Framework.ReplayingHttpConnection, "http"), diff --git a/tests/ContentFile.py b/tests/ContentFile.py index 4b4719a4..e1286929 100644 --- a/tests/ContentFile.py +++ b/tests/ContentFile.py @@ -30,8 +30,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Download.py b/tests/Download.py index bf258b60..3beea0e9 100644 --- a/tests/Download.py +++ b/tests/Download.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/Enterprise.py b/tests/Enterprise.py index 35627947..772eb88a 100644 --- a/tests/Enterprise.py +++ b/tests/Enterprise.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github from . import Framework @@ -90,9 +88,7 @@ class Enterprise(Framework.BasicTestCase): ], ) - def testUnknownUrlScheme( - self, - ): # To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument + def testUnknownUrlScheme(self): with self.assertRaises(AssertionError) as raisedexp: github.Github( self.login, self.password, base_url="foobar://my.enterprise.com" diff --git a/tests/Equality.py b/tests/Equality.py index 223f1b41..b0cc3644 100755 --- a/tests/Equality.py +++ b/tests/Equality.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Event.py b/tests/Event.py index 973461c9..acfaab50 100644 --- a/tests/Event.py +++ b/tests/Event.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/Exceptions.py b/tests/Exceptions.py index bed594c8..eb9531b6 100644 --- a/tests/Exceptions.py +++ b/tests/Exceptions.py @@ -31,12 +31,8 @@ # # ################################################################################ -from __future__ import absolute_import - import pickle -from six.moves import range - import github from github.GithubException import IncompletableObject diff --git a/tests/ExposeAllAttributes.py b/tests/ExposeAllAttributes.py index 23550640..161b617f 100644 --- a/tests/ExposeAllAttributes.py +++ b/tests/ExposeAllAttributes.py @@ -25,10 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import, print_function - -import six - from . import Framework @@ -136,10 +132,8 @@ class ExposeAllAttributes(Framework.TestCase): ] ) - for className, attributesMissingInClass in sorted( - six.iteritems(missingAttributes) - ): - for attrName, value in sorted(six.iteritems(attributesMissingInClass)): + for className, attributesMissingInClass in sorted(missingAttributes.items()): + for attrName, value in sorted(attributesMissingInClass.items()): print(className, attrName, "->", repr(value)) self.assertEqual(sum(len(attrs) for attrs in missingAttributes.values()), 0) diff --git a/tests/Framework.py b/tests/Framework.py index e49fde84..4a417c3e 100644 --- a/tests/Framework.py +++ b/tests/Framework.py @@ -36,8 +36,6 @@ # # ################################################################################ -from __future__ import absolute_import, print_function - import io import json import os @@ -45,7 +43,6 @@ import traceback import unittest import httpretty -import six from requests.structures import CaseInsensitiveDict from urllib3.util import Url @@ -99,7 +96,6 @@ class RecordingConnection: self.__cnx = self._realConnection(host, port, *args, **kwds) def request(self, verb, url, input, headers): - print(verb, url, input, headers, end=" ") self.__cnx.request(verb, url, input, headers) # fixAuthorizationHeader changes the parameter directly to remove Authorization token. # however, this is the real dictionary that *will be sent* by "requests", @@ -116,7 +112,7 @@ class RecordingConnection: self.__writeLine(self.__port) self.__writeLine(url) self.__writeLine(anonymous_headers) - self.__writeLine(six.text_type(input).replace("\n", "").replace("\r", "")) + self.__writeLine(str(input).replace("\n", "").replace("\r", "")) def getresponse(self): res = self.__cnx.getresponse() @@ -137,7 +133,7 @@ class RecordingConnection: return self.__cnx.close() def __writeLine(self, line): - self.__file.write(six.text_type(line) + u"\n") + self.__file.write(str(line) + u"\n") class RecordingHttpConnection(RecordingConnection): @@ -185,7 +181,7 @@ class ReplayingConnection: ) self.__testCase.assertEqual(headers, eval(readLine(self.__file))) expectedInput = readLine(self.__file) - if isinstance(input, (str, six.text_type)): + if isinstance(input, str): if input.startswith("{"): self.__testCase.assertEqual( json.loads(input.replace("\n", "").replace("\r", "")), diff --git a/tests/Gist.py b/tests/Gist.py index 1a422367..1b04099e 100644 --- a/tests/Gist.py +++ b/tests/Gist.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime import github diff --git a/tests/GistComment.py b/tests/GistComment.py index 63aba8fd..c2638768 100644 --- a/tests/GistComment.py +++ b/tests/GistComment.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/GitBlob.py b/tests/GitBlob.py index c2f35c99..db7539bd 100644 --- a/tests/GitBlob.py +++ b/tests/GitBlob.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/GitCommit.py b/tests/GitCommit.py index 93e1382b..cf43736e 100644 --- a/tests/GitCommit.py +++ b/tests/GitCommit.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/GitMembership.py b/tests/GitMembership.py index 00cf2502..5da9bd53 100644 --- a/tests/GitMembership.py +++ b/tests/GitMembership.py @@ -39,7 +39,6 @@ # along with PyGithub. If not, see . # # # ################################################################################ -from __future__ import absolute_import from . import Framework diff --git a/tests/GitRef.py b/tests/GitRef.py index 2f83dbd7..8fc03854 100644 --- a/tests/GitRef.py +++ b/tests/GitRef.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/GitRelease.py b/tests/GitRelease.py index f092fbaf..9a6d427b 100644 --- a/tests/GitRelease.py +++ b/tests/GitRelease.py @@ -34,8 +34,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime import os import zipfile diff --git a/tests/GitReleaseAsset.py b/tests/GitReleaseAsset.py index e3c074d7..fbab8b1d 100644 --- a/tests/GitReleaseAsset.py +++ b/tests/GitReleaseAsset.py @@ -24,8 +24,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/GitTag.py b/tests/GitTag.py index 28e22183..13e5d5a9 100644 --- a/tests/GitTag.py +++ b/tests/GitTag.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/GitTree.py b/tests/GitTree.py index a0d57d3b..15b7c087 100644 --- a/tests/GitTree.py +++ b/tests/GitTree.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/GithubIntegration.py b/tests/GithubIntegration.py index fabb0a26..24733fbb 100644 --- a/tests/GithubIntegration.py +++ b/tests/GithubIntegration.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import datetime import json import sys diff --git a/tests/Github_.py b/tests/Github_.py index 199f8108..0fdcc035 100644 --- a/tests/Github_.py +++ b/tests/Github_.py @@ -32,8 +32,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime import github diff --git a/tests/Hook.py b/tests/Hook.py index 429f375d..b77b07bf 100644 --- a/tests/Hook.py +++ b/tests/Hook.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/Issue.py b/tests/Issue.py index 02aa5169..90744174 100644 --- a/tests/Issue.py +++ b/tests/Issue.py @@ -33,8 +33,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/Issue131.py b/tests/Issue131.py index c74e6484..938a2096 100644 --- a/tests/Issue131.py +++ b/tests/Issue131.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue133.py b/tests/Issue133.py index 85e2d8af..b9a3d2d5 100644 --- a/tests/Issue133.py +++ b/tests/Issue133.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue134.py b/tests/Issue134.py index be9034d9..9f10cc98 100644 --- a/tests/Issue134.py +++ b/tests/Issue134.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github from . import Framework diff --git a/tests/Issue139.py b/tests/Issue139.py index b746b84b..d6db6020 100644 --- a/tests/Issue139.py +++ b/tests/Issue139.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue140.py b/tests/Issue140.py index 8f18f7a2..49d9d19d 100644 --- a/tests/Issue140.py +++ b/tests/Issue140.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue142.py b/tests/Issue142.py index b35e6425..2278bdfc 100644 --- a/tests/Issue142.py +++ b/tests/Issue142.py @@ -25,7 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import import github diff --git a/tests/Issue158.py b/tests/Issue158.py index 04136ef1..c649c405 100644 --- a/tests/Issue158.py +++ b/tests/Issue158.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github from . import Framework diff --git a/tests/Issue174.py b/tests/Issue174.py index 5f526f83..535c0e3e 100644 --- a/tests/Issue174.py +++ b/tests/Issue174.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue214.py b/tests/Issue214.py index 2c376626..cfe41b54 100644 --- a/tests/Issue214.py +++ b/tests/Issue214.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue216.py b/tests/Issue216.py index c1d1a5af..8cc30a35 100644 --- a/tests/Issue216.py +++ b/tests/Issue216.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue278.py b/tests/Issue278.py index 6c28a70c..6e28cf1e 100644 --- a/tests/Issue278.py +++ b/tests/Issue278.py @@ -24,8 +24,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue33.py b/tests/Issue33.py index 42de4cec..f693dd0a 100644 --- a/tests/Issue33.py +++ b/tests/Issue33.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue494.py b/tests/Issue494.py index 6905afbb..21d57a42 100644 --- a/tests/Issue494.py +++ b/tests/Issue494.py @@ -23,8 +23,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue50.py b/tests/Issue50.py index da9d8cde..0f187f76 100644 --- a/tests/Issue50.py +++ b/tests/Issue50.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue54.py b/tests/Issue54.py index 3db5ed23..57995609 100644 --- a/tests/Issue54.py +++ b/tests/Issue54.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/Issue572.py b/tests/Issue572.py index 7ad2c4da..c6f601d0 100644 --- a/tests/Issue572.py +++ b/tests/Issue572.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github from . import Framework diff --git a/tests/Issue80.py b/tests/Issue80.py index 87099f8b..855f2250 100644 --- a/tests/Issue80.py +++ b/tests/Issue80.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github from . import Framework diff --git a/tests/Issue823.py b/tests/Issue823.py index cd77fd9b..22051184 100644 --- a/tests/Issue823.py +++ b/tests/Issue823.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue87.py b/tests/Issue87.py index 822c673e..0103a130 100644 --- a/tests/Issue87.py +++ b/tests/Issue87.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Issue937.py b/tests/Issue937.py index c4ddf068..43664312 100644 --- a/tests/Issue937.py +++ b/tests/Issue937.py @@ -17,14 +17,10 @@ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # # details. # # # - - -# # -################################################################################ -from __future__ import absolute_import - # You should have received a copy of the GNU Lesser General Public License # # along with PyGithub. If not, see . # +# # +################################################################################ from . import Framework diff --git a/tests/Issue945.py b/tests/Issue945.py index 59921294..3b6b4d63 100644 --- a/tests/Issue945.py +++ b/tests/Issue945.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/IssueComment.py b/tests/IssueComment.py index 3f28aaa3..3ec1afe7 100644 --- a/tests/IssueComment.py +++ b/tests/IssueComment.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/IssueEvent.py b/tests/IssueEvent.py index 4fa262f1..aec4721b 100644 --- a/tests/IssueEvent.py +++ b/tests/IssueEvent.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/Label.py b/tests/Label.py index 60ecd4a2..b8a7fa29 100644 --- a/tests/Label.py +++ b/tests/Label.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/License.py b/tests/License.py index 0f51a3a1..5a04dc39 100644 --- a/tests/License.py +++ b/tests/License.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Logging_.py b/tests/Logging_.py index d84d3312..6fea2746 100644 --- a/tests/Logging_.py +++ b/tests/Logging_.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github from . import Framework diff --git a/tests/Markdown.py b/tests/Markdown.py index 1870928f..02dd53ff 100644 --- a/tests/Markdown.py +++ b/tests/Markdown.py @@ -27,8 +27,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Migration.py b/tests/Migration.py index a05664fd..b5dcf95c 100644 --- a/tests/Migration.py +++ b/tests/Migration.py @@ -47,8 +47,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime import github diff --git a/tests/Milestone.py b/tests/Milestone.py index 163a8f9e..4021b573 100644 --- a/tests/Milestone.py +++ b/tests/Milestone.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/NamedUser.py b/tests/NamedUser.py index f1e42898..2580e99c 100644 --- a/tests/NamedUser.py +++ b/tests/NamedUser.py @@ -31,8 +31,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/Notification.py b/tests/Notification.py index 5880dd96..e7454184 100644 --- a/tests/Notification.py +++ b/tests/Notification.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Organization.py b/tests/Organization.py index 71626edb..f79915d6 100644 --- a/tests/Organization.py +++ b/tests/Organization.py @@ -34,8 +34,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime import github diff --git a/tests/OrganizationHasInMembers.py b/tests/OrganizationHasInMembers.py index 6b52ad46..86c4fe17 100644 --- a/tests/OrganizationHasInMembers.py +++ b/tests/OrganizationHasInMembers.py @@ -23,8 +23,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/PaginatedList.py b/tests/PaginatedList.py index 45dd9764..52453818 100644 --- a/tests/PaginatedList.py +++ b/tests/PaginatedList.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - from github.PaginatedList import PaginatedList as PaginatedListImpl from . import Framework diff --git a/tests/Persistence.py b/tests/Persistence.py index 716d4671..d39ffe16 100644 --- a/tests/Persistence.py +++ b/tests/Persistence.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - from io import BytesIO as IO import github diff --git a/tests/Project.py b/tests/Project.py index 52d121c4..259a1dc1 100644 --- a/tests/Project.py +++ b/tests/Project.py @@ -22,8 +22,6 @@ # # # ############################################################################## -from __future__ import absolute_import - import github from . import Framework diff --git a/tests/PullRequest.py b/tests/PullRequest.py index f8eb9755..642e8c70 100644 --- a/tests/PullRequest.py +++ b/tests/PullRequest.py @@ -31,8 +31,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/PullRequest1168.py b/tests/PullRequest1168.py index 277895cd..e610d173 100644 --- a/tests/PullRequest1168.py +++ b/tests/PullRequest1168.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/PullRequest1169.py b/tests/PullRequest1169.py index 112e646d..cbffbfb8 100644 --- a/tests/PullRequest1169.py +++ b/tests/PullRequest1169.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/PullRequestComment.py b/tests/PullRequestComment.py index a215aeee..fe86c751 100644 --- a/tests/PullRequestComment.py +++ b/tests/PullRequestComment.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/PullRequestFile.py b/tests/PullRequestFile.py index 64c092ae..3ed6ca20 100644 --- a/tests/PullRequestFile.py +++ b/tests/PullRequestFile.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/PullRequestReview.py b/tests/PullRequestReview.py index 8a024c2e..f252359f 100644 --- a/tests/PullRequestReview.py +++ b/tests/PullRequestReview.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/RateLimiting.py b/tests/RateLimiting.py index f2b1ebbc..f2270f30 100644 --- a/tests/RateLimiting.py +++ b/tests/RateLimiting.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/RawData.py b/tests/RawData.py index 690e1a22..18a2c753 100644 --- a/tests/RawData.py +++ b/tests/RawData.py @@ -25,8 +25,6 @@ # # ################################################################################ -from __future__ import absolute_import - import github.NamedUser from . import Framework diff --git a/tests/Reaction.py b/tests/Reaction.py index 9a0aa462..5b3307fd 100644 --- a/tests/Reaction.py +++ b/tests/Reaction.py @@ -23,8 +23,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/Repository.py b/tests/Repository.py index b55d37f7..4fbe32a9 100644 --- a/tests/Repository.py +++ b/tests/Repository.py @@ -47,8 +47,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime import github diff --git a/tests/RepositoryKey.py b/tests/RepositoryKey.py index 96a0f1b6..6fbc07a8 100644 --- a/tests/RepositoryKey.py +++ b/tests/RepositoryKey.py @@ -31,8 +31,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/RequiredPullRequestReviews.py b/tests/RequiredPullRequestReviews.py index d69c5185..3840e9b9 100644 --- a/tests/RequiredPullRequestReviews.py +++ b/tests/RequiredPullRequestReviews.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/RequiredStatusChecks.py b/tests/RequiredStatusChecks.py index 07f3b163..dabb7a0c 100644 --- a/tests/RequiredStatusChecks.py +++ b/tests/RequiredStatusChecks.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Retry.py b/tests/Retry.py index 80f8f6e7..621815e9 100644 --- a/tests/Retry.py +++ b/tests/Retry.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import requests import urllib3 from httpretty import httpretty diff --git a/tests/Search.py b/tests/Search.py index cdc74929..befccbf4 100644 --- a/tests/Search.py +++ b/tests/Search.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/SourceImport.py b/tests/SourceImport.py index 2a39aace..a8135370 100644 --- a/tests/SourceImport.py +++ b/tests/SourceImport.py @@ -22,8 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Tag.py b/tests/Tag.py index 82a4a195..3a0cfd7b 100644 --- a/tests/Tag.py +++ b/tests/Tag.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/Team.py b/tests/Team.py index 83163843..208156af 100644 --- a/tests/Team.py +++ b/tests/Team.py @@ -34,7 +34,6 @@ # # ################################################################################ -from __future__ import absolute_import from datetime import datetime diff --git a/tests/Time.py b/tests/Time.py index fd9b9b33..4743eaa3 100644 --- a/tests/Time.py +++ b/tests/Time.py @@ -20,8 +20,6 @@ # # ################################################################################ -from __future__ import absolute_import - from datetime import timedelta, tzinfo diff --git a/tests/Topic.py b/tests/Topic.py index 378e5bcb..629cdaab 100644 --- a/tests/Topic.py +++ b/tests/Topic.py @@ -22,7 +22,6 @@ # # ################################################################################ -from __future__ import absolute_import from datetime import datetime from operator import attrgetter diff --git a/tests/Traffic.py b/tests/Traffic.py index c55e30b3..29189cd1 100644 --- a/tests/Traffic.py +++ b/tests/Traffic.py @@ -26,8 +26,6 @@ # # ################################################################################ -from __future__ import absolute_import - import datetime from . import Framework diff --git a/tests/UserKey.py b/tests/UserKey.py index 9d5d85c5..d47f3c14 100644 --- a/tests/UserKey.py +++ b/tests/UserKey.py @@ -29,8 +29,6 @@ # # ################################################################################ -from __future__ import absolute_import - from . import Framework diff --git a/tests/__main__.py b/tests/__main__.py index 461aafc4..eadc5ba6 100644 --- a/tests/__main__.py +++ b/tests/__main__.py @@ -28,8 +28,6 @@ # # ################################################################################ -from __future__ import absolute_import - import sys import unittest