Drop Python 2 support (#1329)

With the Python 2 deadline gone, it's time to move with the times and
switch to Python 3 only.
This commit is contained in:
Steve Kowalik
2020-01-06 18:01:38 +11:00
committed by GitHub
parent 4561930b82
commit b7894ea00c
195 changed files with 434 additions and 1158 deletions
+1 -2
View File
@@ -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"
-2
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
-2
View File
@@ -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
+1 -1
View File
@@ -1,7 +1,7 @@
Introduction
============
PyGithub is a Python (2 and 3) library to use the `Github API v3 <http://developer.github.com/v3>`__.
PyGithub is a Python library to use the `Github API v3 <http://developer.github.com/v3>`__.
With it, you can manage your `Github <http://github.com>`__ resources (repositories, user profiles, organizations, etc.) from Python scripts.
Should you have any question, any remark, or if you find a bug,
+42 -77
View File
@@ -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
+5 -11
View File
@@ -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:
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+12 -36
View File
@@ -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(
-2
View File
@@ -22,8 +22,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser
import github.RequiredPullRequestReviews
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+8 -16
View File
@@ -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,
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.CommitStatus
import github.GithubObject
import github.Repository
+2 -8
View File
@@ -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",
-2
View File
@@ -29,8 +29,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -32,8 +32,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser
-2
View File
@@ -29,8 +29,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.Commit
import github.File
import github.GithubObject
-2
View File
@@ -31,8 +31,6 @@
# #
################################################################################
from __future__ import absolute_import
import base64
import github.GithubObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser
import github.Organization
-2
View File
@@ -32,8 +32,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+5 -9
View File
@@ -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)
)
+1 -5
View File
@@ -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,
}
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -29,8 +29,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.CommitStats
import github.Gist
import github.GithubObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GitAuthor
import github.GithubObject
import github.GitTree
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+1 -5
View File
@@ -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,
+7 -13
View File
@@ -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://<upload_url>/repos/:owner/:repo/releases/:release_id/assets <https://developer.github.com/v3/repos/releases/#upload-a-release-asset>`_
: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:
+2 -6
View File
@@ -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
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GitAuthor
import github.GithubObject
import github.GitObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.GitTreeElement
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+13 -19
View File
@@ -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))),
)
-2
View File
@@ -29,8 +29,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+4 -8
View File
@@ -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 = {
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+2 -6
View File
@@ -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
+3 -7
View File
@@ -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
+5 -9
View File
@@ -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
-2
View File
@@ -25,8 +25,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.Authorization
import github.Event
import github.Gist
-2
View File
@@ -25,8 +25,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser
import github.PaginatedList
-2
View File
@@ -24,8 +24,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+18 -33
View File
@@ -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",
+2 -8
View File
@@ -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",
-2
View File
@@ -31,8 +31,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.Issue
import github.NamedUser
-2
View File
@@ -29,8 +29,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+5 -8
View File
@@ -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
-2
View File
@@ -22,8 +22,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+26 -45
View File
@@ -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 <http://developer.github.com/v3/repos>`_ or `GET /repositories/:id <http://developer.github.com/v3/repos>`_
: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 <http://developer.github.com/v3/gitignore>`_
: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):
"""
+1 -5
View File
@@ -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",
+3 -9
View File
@@ -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
+5 -13
View File
@@ -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):
-2
View File
@@ -29,8 +29,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NotificationSubject
import github.Repository
-2
View File
@@ -28,8 +28,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+41 -67
View File
@@ -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
+2 -5
View File
@@ -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:
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+1 -5
View File
@@ -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(
-2
View File
@@ -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.
+3 -7
View File
@@ -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}
+26 -46
View File
@@ -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",
+2 -8
View File
@@ -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",
-2
View File
@@ -31,8 +31,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -30,8 +30,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser
import github.Repository
+1 -5
View File
@@ -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 <https://developer.github.com/v3/pulls/reviews/>`_
: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",
-2
View File
@@ -27,8 +27,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -27,8 +27,6 @@
# #
################################################################################
from __future__ import absolute_import
from deprecated import deprecated
import github.GithubObject
-2
View File
@@ -24,8 +24,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+133 -193
View File
@@ -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 <github.ContentFile.ContentFile>`:,
'commit': :class:`Commit <github.Commit.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 <github.ContentFile.ContentFile>`:,
'commit': :class:`Commit <github.Commit.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 <github.GithubObject.NotSet>`:,
'commit': :class:`Commit <github.Commit.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
-2
View File
@@ -35,8 +35,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
+8 -11
View File
@@ -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 = {}
-2
View File
@@ -22,8 +22,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser
import github.Team
-2
View File
@@ -22,8 +22,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -22,8 +22,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
from github import Consts
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser # TODO remove unused
-2
View File
@@ -31,8 +31,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.Commit
import github.GithubObject
+6 -14
View File
@@ -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"]
-1
View File
@@ -22,7 +22,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
import github.NamedUser
-2
View File
@@ -22,8 +22,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -31,8 +31,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -26,8 +26,6 @@
# #
################################################################################
from __future__ import absolute_import
import github.GithubObject
-2
View File
@@ -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
-9
View File
@@ -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')"
-1
View File
@@ -1,6 +1,5 @@
requests>=2.14.0
pyjwt
six
sphinx<1.8
sphinx-rtd-theme<0.5
Deprecated
+13 -61
View File
@@ -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)
+3 -11
View File
@@ -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:
+3 -15
View File
@@ -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"],
)

Some files were not shown because too many files have changed in this diff Show More