mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Merge branch 'develop' into topic/GetContentsWithRef
This commit is contained in:
+138
-139
@@ -13,22 +13,21 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import InputFileContent
|
||||
import Gist
|
||||
import Repository
|
||||
import NamedUser
|
||||
import Plan
|
||||
import Organization
|
||||
import UserKey
|
||||
import Issue
|
||||
import Event
|
||||
import Authorization
|
||||
import github.Gist
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
import github.Plan
|
||||
import github.Organization
|
||||
import github.UserKey
|
||||
import github.Issue
|
||||
import github.Event
|
||||
import github.Authorization
|
||||
|
||||
|
||||
class AuthenticatedUser(GithubObject.GithubObject):
|
||||
class AuthenticatedUser(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def avatar_url(self):
|
||||
self._completeIfNotSet(self._avatar_url)
|
||||
@@ -165,7 +164,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def add_to_following(self, following):
|
||||
assert isinstance(following, NamedUser.NamedUser), following
|
||||
assert isinstance(following, github.NamedUser.NamedUser), following
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
"/user/following/" + following._identity,
|
||||
@@ -174,7 +173,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def add_to_starred(self, starred):
|
||||
assert isinstance(starred, Repository.Repository), starred
|
||||
assert isinstance(starred, github.Repository.Repository), starred
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
"/user/starred/" + starred._identity,
|
||||
@@ -183,7 +182,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def add_to_subscriptions(self, subscription):
|
||||
assert isinstance(subscription, Repository.Repository), subscription
|
||||
assert isinstance(subscription, github.Repository.Repository), subscription
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
"/user/subscriptions/" + subscription._identity,
|
||||
@@ -192,7 +191,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def add_to_watched(self, watched):
|
||||
assert isinstance(watched, Repository.Repository), watched
|
||||
assert isinstance(watched, github.Repository.Repository), watched
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
"/user/watched/" + watched._identity,
|
||||
@@ -200,16 +199,16 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def create_authorization(self, scopes=GithubObject.NotSet, note=GithubObject.NotSet, note_url=GithubObject.NotSet):
|
||||
assert scopes is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes
|
||||
assert note is GithubObject.NotSet or isinstance(note, (str, unicode)), note
|
||||
assert note_url is GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url
|
||||
def create_authorization(self, scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet):
|
||||
assert scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes
|
||||
assert note is github.GithubObject.NotSet or isinstance(note, (str, unicode)), note
|
||||
assert note_url is github.GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url
|
||||
post_parameters = dict()
|
||||
if scopes is not GithubObject.NotSet:
|
||||
if scopes is not github.GithubObject.NotSet:
|
||||
post_parameters["scopes"] = scopes
|
||||
if note is not GithubObject.NotSet:
|
||||
if note is not github.GithubObject.NotSet:
|
||||
post_parameters["note"] = note
|
||||
if note_url is not GithubObject.NotSet:
|
||||
if note_url is not github.GithubObject.NotSet:
|
||||
post_parameters["note_url"] = note_url
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -217,27 +216,27 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Authorization.Authorization(self._requester, data, completed=True)
|
||||
return github.Authorization.Authorization(self._requester, data, completed=True)
|
||||
|
||||
def create_fork(self, repo):
|
||||
assert isinstance(repo, Repository.Repository), repo
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
"/repos/" + repo.owner.login + "/" + repo.name + "/forks",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
|
||||
def create_gist(self, public, files, description=GithubObject.NotSet):
|
||||
def create_gist(self, public, files, description=github.GithubObject.NotSet):
|
||||
assert isinstance(public, bool), public
|
||||
assert all(isinstance(element, InputFileContent.InputFileContent) for element in files.itervalues()), files
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
post_parameters = {
|
||||
"public": public,
|
||||
"files": dict((key, value._identity) for key, value in files.iteritems()),
|
||||
}
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -245,7 +244,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Gist.Gist(self._requester, data, completed=True)
|
||||
return github.Gist.Gist(self._requester, data, completed=True)
|
||||
|
||||
def create_key(self, title, key):
|
||||
assert isinstance(title, (str, unicode)), title
|
||||
@@ -260,36 +259,36 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return UserKey.UserKey(self._requester, data, completed=True)
|
||||
return github.UserKey.UserKey(self._requester, data, completed=True)
|
||||
|
||||
def create_repo(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, private=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, auto_init=GithubObject.NotSet, gitignore_template=GithubObject.NotSet):
|
||||
def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert homepage is GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
|
||||
assert private is GithubObject.NotSet or isinstance(private, bool), private
|
||||
assert has_issues is GithubObject.NotSet or isinstance(has_issues, bool), has_issues
|
||||
assert has_wiki is GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
|
||||
assert has_downloads is GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
|
||||
assert auto_init is GithubObject.NotSet or isinstance(auto_init, bool), auto_init
|
||||
assert gitignore_template is GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
|
||||
assert private is github.GithubObject.NotSet or isinstance(private, bool), private
|
||||
assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues
|
||||
assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
|
||||
assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
|
||||
assert auto_init is github.GithubObject.NotSet or isinstance(auto_init, bool), auto_init
|
||||
assert gitignore_template is github.GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
}
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if homepage is not GithubObject.NotSet:
|
||||
if homepage is not github.GithubObject.NotSet:
|
||||
post_parameters["homepage"] = homepage
|
||||
if private is not GithubObject.NotSet:
|
||||
if private is not github.GithubObject.NotSet:
|
||||
post_parameters["private"] = private
|
||||
if has_issues is not GithubObject.NotSet:
|
||||
if has_issues is not github.GithubObject.NotSet:
|
||||
post_parameters["has_issues"] = has_issues
|
||||
if has_wiki is not GithubObject.NotSet:
|
||||
if has_wiki is not github.GithubObject.NotSet:
|
||||
post_parameters["has_wiki"] = has_wiki
|
||||
if has_downloads is not GithubObject.NotSet:
|
||||
if has_downloads is not github.GithubObject.NotSet:
|
||||
post_parameters["has_downloads"] = has_downloads
|
||||
if auto_init is not GithubObject.NotSet:
|
||||
if auto_init is not github.GithubObject.NotSet:
|
||||
post_parameters["auto_init"] = auto_init
|
||||
if gitignore_template is not GithubObject.NotSet:
|
||||
if gitignore_template is not github.GithubObject.NotSet:
|
||||
post_parameters["gitignore_template"] = gitignore_template
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -297,30 +296,30 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
|
||||
def edit(self, name=GithubObject.NotSet, email=GithubObject.NotSet, blog=GithubObject.NotSet, company=GithubObject.NotSet, location=GithubObject.NotSet, hireable=GithubObject.NotSet, bio=GithubObject.NotSet):
|
||||
assert name is GithubObject.NotSet or isinstance(name, (str, unicode)), name
|
||||
assert email is GithubObject.NotSet or isinstance(email, (str, unicode)), email
|
||||
assert blog is GithubObject.NotSet or isinstance(blog, (str, unicode)), blog
|
||||
assert company is GithubObject.NotSet or isinstance(company, (str, unicode)), company
|
||||
assert location is GithubObject.NotSet or isinstance(location, (str, unicode)), location
|
||||
assert hireable is GithubObject.NotSet or isinstance(hireable, bool), hireable
|
||||
assert bio is GithubObject.NotSet or isinstance(bio, (str, unicode)), bio
|
||||
def edit(self, name=github.GithubObject.NotSet, email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, location=github.GithubObject.NotSet, hireable=github.GithubObject.NotSet, bio=github.GithubObject.NotSet):
|
||||
assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name
|
||||
assert email is github.GithubObject.NotSet or isinstance(email, (str, unicode)), email
|
||||
assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog
|
||||
assert company is github.GithubObject.NotSet or isinstance(company, (str, unicode)), company
|
||||
assert location is github.GithubObject.NotSet or isinstance(location, (str, unicode)), location
|
||||
assert hireable is github.GithubObject.NotSet or isinstance(hireable, bool), hireable
|
||||
assert bio is github.GithubObject.NotSet or isinstance(bio, (str, unicode)), bio
|
||||
post_parameters = dict()
|
||||
if name is not GithubObject.NotSet:
|
||||
if name is not github.GithubObject.NotSet:
|
||||
post_parameters["name"] = name
|
||||
if email is not GithubObject.NotSet:
|
||||
if email is not github.GithubObject.NotSet:
|
||||
post_parameters["email"] = email
|
||||
if blog is not GithubObject.NotSet:
|
||||
if blog is not github.GithubObject.NotSet:
|
||||
post_parameters["blog"] = blog
|
||||
if company is not GithubObject.NotSet:
|
||||
if company is not github.GithubObject.NotSet:
|
||||
post_parameters["company"] = company
|
||||
if location is not GithubObject.NotSet:
|
||||
if location is not github.GithubObject.NotSet:
|
||||
post_parameters["location"] = location
|
||||
if hireable is not GithubObject.NotSet:
|
||||
if hireable is not github.GithubObject.NotSet:
|
||||
post_parameters["hireable"] = hireable
|
||||
if bio is not GithubObject.NotSet:
|
||||
if bio is not github.GithubObject.NotSet:
|
||||
post_parameters["bio"] = bio
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -338,11 +337,11 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Authorization.Authorization(self._requester, data, completed=True)
|
||||
return github.Authorization.Authorization(self._requester, data, completed=True)
|
||||
|
||||
def get_authorizations(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Authorization.Authorization,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Authorization.Authorization,
|
||||
self._requester,
|
||||
"/authorizations",
|
||||
None
|
||||
@@ -358,40 +357,40 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
return data
|
||||
|
||||
def get_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
"/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_followers(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
"/user/followers",
|
||||
None
|
||||
)
|
||||
|
||||
def get_following(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
"/user/following",
|
||||
None
|
||||
)
|
||||
|
||||
def get_gists(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Gist.Gist,
|
||||
self._requester,
|
||||
"/gists",
|
||||
None
|
||||
)
|
||||
|
||||
def get_issues(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Issue.Issue,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Issue.Issue,
|
||||
self._requester,
|
||||
"/issues",
|
||||
None
|
||||
@@ -405,28 +404,28 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return UserKey.UserKey(self._requester, data, completed=True)
|
||||
return github.UserKey.UserKey(self._requester, data, completed=True)
|
||||
|
||||
def get_keys(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
UserKey.UserKey,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.UserKey.UserKey,
|
||||
self._requester,
|
||||
"/user/keys",
|
||||
None
|
||||
)
|
||||
|
||||
def get_organization_events(self, org):
|
||||
assert isinstance(org, Organization.Organization), org
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
assert isinstance(org, github.Organization.Organization), org
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
"/users/" + self.login + "/events/orgs/" + org.login,
|
||||
None
|
||||
)
|
||||
|
||||
def get_orgs(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Organization.Organization,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Organization.Organization,
|
||||
self._requester,
|
||||
"/user/orgs",
|
||||
None
|
||||
@@ -440,60 +439,60 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
|
||||
def get_repos(self, type=GithubObject.NotSet, sort=GithubObject.NotSet, direction=GithubObject.NotSet):
|
||||
assert type is GithubObject.NotSet or isinstance(type, (str, unicode)), type
|
||||
assert sort is GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
|
||||
assert direction is GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
|
||||
def get_repos(self, type=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet):
|
||||
assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type
|
||||
assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
|
||||
assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
|
||||
url_parameters = dict()
|
||||
if type is not GithubObject.NotSet:
|
||||
if type is not github.GithubObject.NotSet:
|
||||
url_parameters["type"] = type
|
||||
if sort is not GithubObject.NotSet:
|
||||
if sort is not github.GithubObject.NotSet:
|
||||
url_parameters["sort"] = sort
|
||||
if direction is not GithubObject.NotSet:
|
||||
if direction is not github.GithubObject.NotSet:
|
||||
url_parameters["direction"] = direction
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
"/user/repos",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_starred(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
"/user/starred",
|
||||
None
|
||||
)
|
||||
|
||||
def get_starred_gists(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Gist.Gist,
|
||||
self._requester,
|
||||
"/gists/starred",
|
||||
None
|
||||
)
|
||||
|
||||
def get_subscriptions(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
"/user/subscriptions",
|
||||
None
|
||||
)
|
||||
|
||||
def get_watched(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
"/user/watched",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_following(self, following):
|
||||
assert isinstance(following, NamedUser.NamedUser), following
|
||||
assert isinstance(following, github.NamedUser.NamedUser), following
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
"/user/following/" + following._identity,
|
||||
@@ -503,7 +502,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
return status == 204
|
||||
|
||||
def has_in_starred(self, starred):
|
||||
assert isinstance(starred, Repository.Repository), starred
|
||||
assert isinstance(starred, github.Repository.Repository), starred
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
"/user/starred/" + starred._identity,
|
||||
@@ -513,7 +512,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
return status == 204
|
||||
|
||||
def has_in_subscriptions(self, subscription):
|
||||
assert isinstance(subscription, Repository.Repository), subscription
|
||||
assert isinstance(subscription, github.Repository.Repository), subscription
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
"/user/subscriptions/" + subscription._identity,
|
||||
@@ -523,7 +522,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
return status == 204
|
||||
|
||||
def has_in_watched(self, watched):
|
||||
assert isinstance(watched, Repository.Repository), watched
|
||||
assert isinstance(watched, github.Repository.Repository), watched
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
"/user/watched/" + watched._identity,
|
||||
@@ -543,7 +542,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def remove_from_following(self, following):
|
||||
assert isinstance(following, NamedUser.NamedUser), following
|
||||
assert isinstance(following, github.NamedUser.NamedUser), following
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
"/user/following/" + following._identity,
|
||||
@@ -552,7 +551,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def remove_from_starred(self, starred):
|
||||
assert isinstance(starred, Repository.Repository), starred
|
||||
assert isinstance(starred, github.Repository.Repository), starred
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
"/user/starred/" + starred._identity,
|
||||
@@ -561,7 +560,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def remove_from_subscriptions(self, subscription):
|
||||
assert isinstance(subscription, Repository.Repository), subscription
|
||||
assert isinstance(subscription, github.Repository.Repository), subscription
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
"/user/subscriptions/" + subscription._identity,
|
||||
@@ -570,7 +569,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def remove_from_watched(self, watched):
|
||||
assert isinstance(watched, Repository.Repository), watched
|
||||
assert isinstance(watched, github.Repository.Repository), watched
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
"/user/watched/" + watched._identity,
|
||||
@@ -579,31 +578,31 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._avatar_url = GithubObject.NotSet
|
||||
self._bio = GithubObject.NotSet
|
||||
self._blog = GithubObject.NotSet
|
||||
self._collaborators = GithubObject.NotSet
|
||||
self._company = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._disk_usage = GithubObject.NotSet
|
||||
self._email = GithubObject.NotSet
|
||||
self._followers = GithubObject.NotSet
|
||||
self._following = GithubObject.NotSet
|
||||
self._gravatar_id = GithubObject.NotSet
|
||||
self._hireable = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._location = GithubObject.NotSet
|
||||
self._login = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._owned_private_repos = GithubObject.NotSet
|
||||
self._plan = GithubObject.NotSet
|
||||
self._private_gists = GithubObject.NotSet
|
||||
self._public_gists = GithubObject.NotSet
|
||||
self._public_repos = GithubObject.NotSet
|
||||
self._total_private_repos = GithubObject.NotSet
|
||||
self._type = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._avatar_url = github.GithubObject.NotSet
|
||||
self._bio = github.GithubObject.NotSet
|
||||
self._blog = github.GithubObject.NotSet
|
||||
self._collaborators = github.GithubObject.NotSet
|
||||
self._company = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._disk_usage = github.GithubObject.NotSet
|
||||
self._email = github.GithubObject.NotSet
|
||||
self._followers = github.GithubObject.NotSet
|
||||
self._following = github.GithubObject.NotSet
|
||||
self._gravatar_id = github.GithubObject.NotSet
|
||||
self._hireable = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._location = github.GithubObject.NotSet
|
||||
self._login = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._owned_private_repos = github.GithubObject.NotSet
|
||||
self._plan = github.GithubObject.NotSet
|
||||
self._private_gists = github.GithubObject.NotSet
|
||||
self._public_gists = github.GithubObject.NotSet
|
||||
self._public_repos = github.GithubObject.NotSet
|
||||
self._total_private_repos = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "avatar_url" in attributes: # pragma no branch
|
||||
@@ -662,7 +661,7 @@ class AuthenticatedUser(GithubObject.GithubObject):
|
||||
self._owned_private_repos = attributes["owned_private_repos"]
|
||||
if "plan" in attributes: # pragma no branch
|
||||
assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"]
|
||||
self._plan = None if attributes["plan"] is None else Plan.Plan(self._requester, attributes["plan"], completed=False)
|
||||
self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False)
|
||||
if "private_gists" in attributes: # pragma no branch
|
||||
assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"]
|
||||
self._private_gists = attributes["private_gists"]
|
||||
|
||||
+24
-24
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import AuthorizationApplication
|
||||
import github.AuthorizationApplication
|
||||
|
||||
|
||||
class Authorization(GithubObject.GithubObject):
|
||||
class Authorization(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def app(self):
|
||||
self._completeIfNotSet(self._app)
|
||||
@@ -72,22 +72,22 @@ class Authorization(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, scopes=GithubObject.NotSet, add_scopes=GithubObject.NotSet, remove_scopes=GithubObject.NotSet, note=GithubObject.NotSet, note_url=GithubObject.NotSet):
|
||||
assert scopes is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes
|
||||
assert add_scopes is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_scopes), add_scopes
|
||||
assert remove_scopes is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_scopes), remove_scopes
|
||||
assert note is GithubObject.NotSet or isinstance(note, (str, unicode)), note
|
||||
assert note_url is GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url
|
||||
def edit(self, scopes=github.GithubObject.NotSet, add_scopes=github.GithubObject.NotSet, remove_scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet):
|
||||
assert scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes
|
||||
assert add_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_scopes), add_scopes
|
||||
assert remove_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_scopes), remove_scopes
|
||||
assert note is github.GithubObject.NotSet or isinstance(note, (str, unicode)), note
|
||||
assert note_url is github.GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url
|
||||
post_parameters = dict()
|
||||
if scopes is not GithubObject.NotSet:
|
||||
if scopes is not github.GithubObject.NotSet:
|
||||
post_parameters["scopes"] = scopes
|
||||
if add_scopes is not GithubObject.NotSet:
|
||||
if add_scopes is not github.GithubObject.NotSet:
|
||||
post_parameters["add_scopes"] = add_scopes
|
||||
if remove_scopes is not GithubObject.NotSet:
|
||||
if remove_scopes is not github.GithubObject.NotSet:
|
||||
post_parameters["remove_scopes"] = remove_scopes
|
||||
if note is not GithubObject.NotSet:
|
||||
if note is not github.GithubObject.NotSet:
|
||||
post_parameters["note"] = note
|
||||
if note_url is not GithubObject.NotSet:
|
||||
if note_url is not github.GithubObject.NotSet:
|
||||
post_parameters["note_url"] = note_url
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -98,20 +98,20 @@ class Authorization(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._app = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._note = GithubObject.NotSet
|
||||
self._note_url = GithubObject.NotSet
|
||||
self._scopes = GithubObject.NotSet
|
||||
self._token = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._app = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._note = github.GithubObject.NotSet
|
||||
self._note_url = github.GithubObject.NotSet
|
||||
self._scopes = github.GithubObject.NotSet
|
||||
self._token = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "app" in attributes: # pragma no branch
|
||||
assert attributes["app"] is None or isinstance(attributes["app"], dict), attributes["app"]
|
||||
self._app = None if attributes["app"] is None else AuthorizationApplication.AuthorizationApplication(self._requester, attributes["app"], completed=False)
|
||||
self._app = None if attributes["app"] is None else github.AuthorizationApplication.AuthorizationApplication(self._requester, attributes["app"], completed=False)
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"]
|
||||
self._created_at = self._parseDatetime(attributes["created_at"])
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class AuthorizationApplication(GithubObject.GithubObject):
|
||||
class AuthorizationApplication(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def name(self):
|
||||
self._completeIfNotSet(self._name)
|
||||
@@ -28,8 +28,8 @@ class AuthorizationApplication(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._name = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "name" in attributes: # pragma no branch
|
||||
|
||||
+6
-6
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import Commit
|
||||
import github.Commit
|
||||
|
||||
|
||||
class Branch(GithubObject.BasicGithubObject):
|
||||
class Branch(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def commit(self):
|
||||
return self._NoneIfNotSet(self._commit)
|
||||
@@ -28,13 +28,13 @@ class Branch(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._name)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._commit = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._commit = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "commit" in attributes: # pragma no branch
|
||||
assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"]
|
||||
self._commit = None if attributes["commit"] is None else Commit.Commit(self._requester, attributes["commit"], completed=False)
|
||||
self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, attributes["commit"], completed=False)
|
||||
if "name" in attributes: # pragma no branch
|
||||
assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
|
||||
self._name = attributes["name"]
|
||||
|
||||
+40
-41
@@ -13,19 +13,18 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import GitCommit
|
||||
import NamedUser
|
||||
import CommitStatus
|
||||
import File
|
||||
import CommitStats
|
||||
import Commit
|
||||
import CommitComment
|
||||
import github.GitCommit
|
||||
import github.NamedUser
|
||||
import github.CommitStatus
|
||||
import github.File
|
||||
import github.CommitStats
|
||||
import github.CommitComment
|
||||
|
||||
|
||||
class Commit(GithubObject.GithubObject):
|
||||
class Commit(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def author(self):
|
||||
self._completeIfNotSet(self._author)
|
||||
@@ -66,19 +65,19 @@ class Commit(GithubObject.GithubObject):
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def create_comment(self, body, line=GithubObject.NotSet, path=GithubObject.NotSet, position=GithubObject.NotSet):
|
||||
def create_comment(self, body, line=github.GithubObject.NotSet, path=github.GithubObject.NotSet, position=github.GithubObject.NotSet):
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
assert line is GithubObject.NotSet or isinstance(line, (int, long)), line
|
||||
assert path is GithubObject.NotSet or isinstance(path, (str, unicode)), path
|
||||
assert position is GithubObject.NotSet or isinstance(position, (int, long)), position
|
||||
assert line is github.GithubObject.NotSet or isinstance(line, (int, long)), line
|
||||
assert path is github.GithubObject.NotSet or isinstance(path, (str, unicode)), path
|
||||
assert position is github.GithubObject.NotSet or isinstance(position, (int, long)), position
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
if line is not GithubObject.NotSet:
|
||||
if line is not github.GithubObject.NotSet:
|
||||
post_parameters["line"] = line
|
||||
if path is not GithubObject.NotSet:
|
||||
if path is not github.GithubObject.NotSet:
|
||||
post_parameters["path"] = path
|
||||
if position is not GithubObject.NotSet:
|
||||
if position is not github.GithubObject.NotSet:
|
||||
post_parameters["position"] = position
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -86,18 +85,18 @@ class Commit(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return CommitComment.CommitComment(self._requester, data, completed=True)
|
||||
return github.CommitComment.CommitComment(self._requester, data, completed=True)
|
||||
|
||||
def create_status(self, state, target_url=GithubObject.NotSet, description=GithubObject.NotSet):
|
||||
def create_status(self, state, target_url=github.GithubObject.NotSet, description=github.GithubObject.NotSet):
|
||||
assert isinstance(state, (str, unicode)), state
|
||||
assert target_url is GithubObject.NotSet or isinstance(target_url, (str, unicode)), target_url
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert target_url is github.GithubObject.NotSet or isinstance(target_url, (str, unicode)), target_url
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
post_parameters = {
|
||||
"state": state,
|
||||
}
|
||||
if target_url is not GithubObject.NotSet:
|
||||
if target_url is not github.GithubObject.NotSet:
|
||||
post_parameters["target_url"] = target_url
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -105,19 +104,19 @@ class Commit(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return CommitStatus.CommitStatus(self._requester, data, completed=True)
|
||||
return github.CommitStatus.CommitStatus(self._requester, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
CommitComment.CommitComment,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.CommitComment.CommitComment,
|
||||
self._requester,
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_statuses(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
CommitStatus.CommitStatus,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.CommitStatus.CommitStatus,
|
||||
self._requester,
|
||||
self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha,
|
||||
None
|
||||
@@ -128,29 +127,29 @@ class Commit(GithubObject.GithubObject):
|
||||
return self.sha
|
||||
|
||||
def _initAttributes(self):
|
||||
self._author = GithubObject.NotSet
|
||||
self._commit = GithubObject.NotSet
|
||||
self._committer = GithubObject.NotSet
|
||||
self._files = GithubObject.NotSet
|
||||
self._parents = GithubObject.NotSet
|
||||
self._sha = GithubObject.NotSet
|
||||
self._stats = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._author = github.GithubObject.NotSet
|
||||
self._commit = github.GithubObject.NotSet
|
||||
self._committer = github.GithubObject.NotSet
|
||||
self._files = github.GithubObject.NotSet
|
||||
self._parents = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._stats = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "author" in attributes: # pragma no branch
|
||||
assert attributes["author"] is None or isinstance(attributes["author"], dict), attributes["author"]
|
||||
self._author = None if attributes["author"] is None else NamedUser.NamedUser(self._requester, attributes["author"], completed=False)
|
||||
self._author = None if attributes["author"] is None else github.NamedUser.NamedUser(self._requester, attributes["author"], completed=False)
|
||||
if "commit" in attributes: # pragma no branch
|
||||
assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"]
|
||||
self._commit = None if attributes["commit"] is None else GitCommit.GitCommit(self._requester, attributes["commit"], completed=False)
|
||||
self._commit = None if attributes["commit"] is None else github.GitCommit.GitCommit(self._requester, attributes["commit"], completed=False)
|
||||
if "committer" in attributes: # pragma no branch
|
||||
assert attributes["committer"] is None or isinstance(attributes["committer"], dict), attributes["committer"]
|
||||
self._committer = None if attributes["committer"] is None else NamedUser.NamedUser(self._requester, attributes["committer"], completed=False)
|
||||
self._committer = None if attributes["committer"] is None else github.NamedUser.NamedUser(self._requester, attributes["committer"], completed=False)
|
||||
if "files" in attributes: # pragma no branch
|
||||
assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"]), attributes["files"]
|
||||
self._files = None if attributes["files"] is None else [
|
||||
File.File(self._requester, element, completed=False)
|
||||
github.File.File(self._requester, element, completed=False)
|
||||
for element in attributes["files"]
|
||||
]
|
||||
if "parents" in attributes: # pragma no branch
|
||||
@@ -164,7 +163,7 @@ class Commit(GithubObject.GithubObject):
|
||||
self._sha = attributes["sha"]
|
||||
if "stats" in attributes: # pragma no branch
|
||||
assert attributes["stats"] is None or isinstance(attributes["stats"], dict), attributes["stats"]
|
||||
self._stats = None if attributes["stats"] is None else CommitStats.CommitStats(self._requester, attributes["stats"], completed=False)
|
||||
self._stats = None if attributes["stats"] is None else github.CommitStats.CommitStats(self._requester, attributes["stats"], completed=False)
|
||||
if "url" in attributes: # pragma no branch
|
||||
assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
|
||||
self._url = attributes["url"]
|
||||
|
||||
+15
-15
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import NamedUser
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class CommitComment(GithubObject.GithubObject):
|
||||
class CommitComment(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def body(self):
|
||||
self._completeIfNotSet(self._body)
|
||||
@@ -96,17 +96,17 @@ class CommitComment(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = GithubObject.NotSet
|
||||
self._commit_id = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._line = GithubObject.NotSet
|
||||
self._path = GithubObject.NotSet
|
||||
self._position = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._user = GithubObject.NotSet
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._commit_id = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._line = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._position = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes: # pragma no branch
|
||||
@@ -141,4 +141,4 @@ class CommitComment(GithubObject.GithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class CommitStats(GithubObject.BasicGithubObject):
|
||||
class CommitStats(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def additions(self):
|
||||
return self._NoneIfNotSet(self._additions)
|
||||
@@ -30,9 +30,9 @@ class CommitStats(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._total)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._additions = GithubObject.NotSet
|
||||
self._deletions = GithubObject.NotSet
|
||||
self._total = GithubObject.NotSet
|
||||
self._additions = github.GithubObject.NotSet
|
||||
self._deletions = github.GithubObject.NotSet
|
||||
self._total = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "additions" in attributes: # pragma no branch
|
||||
|
||||
+11
-11
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import NamedUser
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class CommitStatus(GithubObject.BasicGithubObject):
|
||||
class CommitStatus(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def created_at(self):
|
||||
return self._NoneIfNotSet(self._created_at)
|
||||
@@ -48,13 +48,13 @@ class CommitStatus(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._updated_at)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._creator = GithubObject.NotSet
|
||||
self._description = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._state = GithubObject.NotSet
|
||||
self._target_url = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._creator = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._target_url = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
@@ -62,7 +62,7 @@ class CommitStatus(GithubObject.BasicGithubObject):
|
||||
self._created_at = self._parseDatetime(attributes["created_at"])
|
||||
if "creator" in attributes: # pragma no branch
|
||||
assert attributes["creator"] is None or isinstance(attributes["creator"], dict), attributes["creator"]
|
||||
self._creator = None if attributes["creator"] is None else NamedUser.NamedUser(self._requester, attributes["creator"], completed=False)
|
||||
self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, attributes["creator"], completed=False)
|
||||
if "description" in attributes: # pragma no branch
|
||||
assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"]
|
||||
self._description = attributes["description"]
|
||||
|
||||
+19
-19
@@ -13,13 +13,13 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import Commit
|
||||
import File
|
||||
import github.Commit
|
||||
import github.File
|
||||
|
||||
|
||||
class Comparison(GithubObject.GithubObject):
|
||||
class Comparison(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def ahead_by(self):
|
||||
self._completeIfNotSet(self._ahead_by)
|
||||
@@ -81,18 +81,18 @@ class Comparison(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._ahead_by = GithubObject.NotSet
|
||||
self._base_commit = GithubObject.NotSet
|
||||
self._behind_by = GithubObject.NotSet
|
||||
self._commits = GithubObject.NotSet
|
||||
self._diff_url = GithubObject.NotSet
|
||||
self._files = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._patch_url = GithubObject.NotSet
|
||||
self._permalink_url = GithubObject.NotSet
|
||||
self._status = GithubObject.NotSet
|
||||
self._total_commits = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._ahead_by = github.GithubObject.NotSet
|
||||
self._base_commit = github.GithubObject.NotSet
|
||||
self._behind_by = github.GithubObject.NotSet
|
||||
self._commits = github.GithubObject.NotSet
|
||||
self._diff_url = github.GithubObject.NotSet
|
||||
self._files = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._patch_url = github.GithubObject.NotSet
|
||||
self._permalink_url = github.GithubObject.NotSet
|
||||
self._status = github.GithubObject.NotSet
|
||||
self._total_commits = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "ahead_by" in attributes: # pragma no branch
|
||||
@@ -100,14 +100,14 @@ class Comparison(GithubObject.GithubObject):
|
||||
self._ahead_by = attributes["ahead_by"]
|
||||
if "base_commit" in attributes: # pragma no branch
|
||||
assert attributes["base_commit"] is None or isinstance(attributes["base_commit"], dict), attributes["base_commit"]
|
||||
self._base_commit = None if attributes["base_commit"] is None else Commit.Commit(self._requester, attributes["base_commit"], completed=False)
|
||||
self._base_commit = None if attributes["base_commit"] is None else github.Commit.Commit(self._requester, attributes["base_commit"], completed=False)
|
||||
if "behind_by" in attributes: # pragma no branch
|
||||
assert attributes["behind_by"] is None or isinstance(attributes["behind_by"], (int, long)), attributes["behind_by"]
|
||||
self._behind_by = attributes["behind_by"]
|
||||
if "commits" in attributes: # pragma no branch
|
||||
assert attributes["commits"] is None or all(isinstance(element, dict) for element in attributes["commits"]), attributes["commits"]
|
||||
self._commits = None if attributes["commits"] is None else [
|
||||
Commit.Commit(self._requester, element, completed=False)
|
||||
github.Commit.Commit(self._requester, element, completed=False)
|
||||
for element in attributes["commits"]
|
||||
]
|
||||
if "diff_url" in attributes: # pragma no branch
|
||||
@@ -116,7 +116,7 @@ class Comparison(GithubObject.GithubObject):
|
||||
if "files" in attributes: # pragma no branch
|
||||
assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"]), attributes["files"]
|
||||
self._files = None if attributes["files"] is None else [
|
||||
File.File(self._requester, element, completed=False)
|
||||
github.File.File(self._requester, element, completed=False)
|
||||
for element in attributes["files"]
|
||||
]
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class ContentFile(GithubObject.BasicGithubObject):
|
||||
class ContentFile(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def content(self):
|
||||
return self._NoneIfNotSet(self._content)
|
||||
@@ -46,13 +46,13 @@ class ContentFile(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._type)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._content = GithubObject.NotSet
|
||||
self._encoding = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._path = GithubObject.NotSet
|
||||
self._sha = GithubObject.NotSet
|
||||
self._size = GithubObject.NotSet
|
||||
self._type = GithubObject.NotSet
|
||||
self._content = github.GithubObject.NotSet
|
||||
self._encoding = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "content" in attributes: # pragma no branch
|
||||
|
||||
+22
-22
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class Download(GithubObject.GithubObject):
|
||||
class Download(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def accesskeyid(self):
|
||||
self._completeIfNotSet(self._accesskeyid)
|
||||
@@ -126,26 +126,26 @@ class Download(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._accesskeyid = GithubObject.NotSet
|
||||
self._acl = GithubObject.NotSet
|
||||
self._bucket = GithubObject.NotSet
|
||||
self._content_type = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._description = GithubObject.NotSet
|
||||
self._download_count = GithubObject.NotSet
|
||||
self._expirationdate = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._mime_type = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._path = GithubObject.NotSet
|
||||
self._policy = GithubObject.NotSet
|
||||
self._prefix = GithubObject.NotSet
|
||||
self._redirect = GithubObject.NotSet
|
||||
self._s3_url = GithubObject.NotSet
|
||||
self._signature = GithubObject.NotSet
|
||||
self._size = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._accesskeyid = github.GithubObject.NotSet
|
||||
self._acl = github.GithubObject.NotSet
|
||||
self._bucket = github.GithubObject.NotSet
|
||||
self._content_type = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._download_count = github.GithubObject.NotSet
|
||||
self._expirationdate = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._mime_type = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._policy = github.GithubObject.NotSet
|
||||
self._prefix = github.GithubObject.NotSet
|
||||
self._redirect = github.GithubObject.NotSet
|
||||
self._s3_url = github.GithubObject.NotSet
|
||||
self._signature = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "accesskeyid" in attributes: # pragma no branch
|
||||
|
||||
+16
-16
@@ -13,14 +13,14 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import Organization
|
||||
import Repository
|
||||
import NamedUser
|
||||
import github.Organization
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class Event(GithubObject.BasicGithubObject):
|
||||
class Event(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def actor(self):
|
||||
return self._NoneIfNotSet(self._actor)
|
||||
@@ -54,19 +54,19 @@ class Event(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._type)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._actor = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._org = GithubObject.NotSet
|
||||
self._payload = GithubObject.NotSet
|
||||
self._public = GithubObject.NotSet
|
||||
self._repo = GithubObject.NotSet
|
||||
self._type = GithubObject.NotSet
|
||||
self._actor = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._org = github.GithubObject.NotSet
|
||||
self._payload = github.GithubObject.NotSet
|
||||
self._public = github.GithubObject.NotSet
|
||||
self._repo = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "actor" in attributes: # pragma no branch
|
||||
assert attributes["actor"] is None or isinstance(attributes["actor"], dict), attributes["actor"]
|
||||
self._actor = None if attributes["actor"] is None else NamedUser.NamedUser(self._requester, attributes["actor"], completed=False)
|
||||
self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, attributes["actor"], completed=False)
|
||||
if "created_at" in attributes: # pragma no branch
|
||||
assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"]
|
||||
self._created_at = self._parseDatetime(attributes["created_at"])
|
||||
@@ -75,7 +75,7 @@ class Event(GithubObject.BasicGithubObject):
|
||||
self._id = attributes["id"]
|
||||
if "org" in attributes: # pragma no branch
|
||||
assert attributes["org"] is None or isinstance(attributes["org"], dict), attributes["org"]
|
||||
self._org = None if attributes["org"] is None else Organization.Organization(self._requester, attributes["org"], completed=False)
|
||||
self._org = None if attributes["org"] is None else github.Organization.Organization(self._requester, attributes["org"], completed=False)
|
||||
if "payload" in attributes: # pragma no branch
|
||||
assert attributes["payload"] is None or isinstance(attributes["payload"], dict), attributes["payload"]
|
||||
self._payload = attributes["payload"]
|
||||
@@ -84,7 +84,7 @@ class Event(GithubObject.BasicGithubObject):
|
||||
self._public = attributes["public"]
|
||||
if "repo" in attributes: # pragma no branch
|
||||
assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"]
|
||||
self._repo = None if attributes["repo"] is None else Repository.Repository(self._requester, attributes["repo"], completed=False)
|
||||
self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, attributes["repo"], completed=False)
|
||||
if "type" in attributes: # pragma no branch
|
||||
assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"]
|
||||
self._type = attributes["type"]
|
||||
|
||||
+11
-11
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class File(GithubObject.BasicGithubObject):
|
||||
class File(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def additions(self):
|
||||
return self._NoneIfNotSet(self._additions)
|
||||
@@ -54,15 +54,15 @@ class File(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._status)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._additions = GithubObject.NotSet
|
||||
self._blob_url = GithubObject.NotSet
|
||||
self._changes = GithubObject.NotSet
|
||||
self._deletions = GithubObject.NotSet
|
||||
self._filename = GithubObject.NotSet
|
||||
self._patch = GithubObject.NotSet
|
||||
self._raw_url = GithubObject.NotSet
|
||||
self._sha = GithubObject.NotSet
|
||||
self._status = GithubObject.NotSet
|
||||
self._additions = github.GithubObject.NotSet
|
||||
self._blob_url = github.GithubObject.NotSet
|
||||
self._changes = github.GithubObject.NotSet
|
||||
self._deletions = github.GithubObject.NotSet
|
||||
self._filename = github.GithubObject.NotSet
|
||||
self._patch = github.GithubObject.NotSet
|
||||
self._raw_url = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._status = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "additions" in attributes: # pragma no branch
|
||||
|
||||
+34
-36
@@ -13,18 +13,16 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import Gist
|
||||
import GistComment
|
||||
import NamedUser
|
||||
import GistFile
|
||||
import InputFileContent
|
||||
import GistHistoryState
|
||||
import github.GistComment
|
||||
import github.NamedUser
|
||||
import github.GistFile
|
||||
import github.GistHistoryState
|
||||
|
||||
|
||||
class Gist(GithubObject.GithubObject):
|
||||
class Gist(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def comments(self):
|
||||
self._completeIfNotSet(self._comments)
|
||||
@@ -111,7 +109,7 @@ class Gist(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return GistComment.GistComment(self._requester, data, completed=True)
|
||||
return github.GistComment.GistComment(self._requester, data, completed=True)
|
||||
|
||||
def create_fork(self):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
@@ -130,13 +128,13 @@ class Gist(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, description=GithubObject.NotSet, files=GithubObject.NotSet):
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert files is GithubObject.NotSet or all(isinstance(element, InputFileContent.InputFileContent) for element in files.itervalues()), files
|
||||
def edit(self, description=github.GithubObject.NotSet, files=github.GithubObject.NotSet):
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert files is github.GithubObject.NotSet or all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files
|
||||
post_parameters = dict()
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if files is not GithubObject.NotSet:
|
||||
if files is not github.GithubObject.NotSet:
|
||||
post_parameters["files"] = dict((key, value._identity) for key, value in files.iteritems())
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -154,11 +152,11 @@ class Gist(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return GistComment.GistComment(self._requester, data, completed=True)
|
||||
return github.GistComment.GistComment(self._requester, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
GistComment.GistComment,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.GistComment.GistComment,
|
||||
self._requester,
|
||||
self.url + "/comments",
|
||||
None
|
||||
@@ -190,21 +188,21 @@ class Gist(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._comments = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._description = GithubObject.NotSet
|
||||
self._files = GithubObject.NotSet
|
||||
self._fork_of = GithubObject.NotSet
|
||||
self._forks = GithubObject.NotSet
|
||||
self._git_pull_url = GithubObject.NotSet
|
||||
self._git_push_url = GithubObject.NotSet
|
||||
self._history = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._public = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._user = GithubObject.NotSet
|
||||
self._comments = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._files = github.GithubObject.NotSet
|
||||
self._fork_of = github.GithubObject.NotSet
|
||||
self._forks = github.GithubObject.NotSet
|
||||
self._git_pull_url = github.GithubObject.NotSet
|
||||
self._git_push_url = github.GithubObject.NotSet
|
||||
self._history = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._public = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "comments" in attributes: # pragma no branch
|
||||
@@ -219,7 +217,7 @@ class Gist(GithubObject.GithubObject):
|
||||
if "files" in attributes: # pragma no branch
|
||||
assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"].itervalues()), attributes["files"]
|
||||
self._files = None if attributes["files"] is None else dict(
|
||||
(key, GistFile.GistFile(self._requester, element, completed=False))
|
||||
(key, github.GistFile.GistFile(self._requester, element, completed=False))
|
||||
for key, element in attributes["files"].iteritems()
|
||||
)
|
||||
if "fork_of" in attributes: # pragma no branch
|
||||
@@ -240,7 +238,7 @@ class Gist(GithubObject.GithubObject):
|
||||
if "history" in attributes: # pragma no branch
|
||||
assert attributes["history"] is None or all(isinstance(element, dict) for element in attributes["history"]), attributes["history"]
|
||||
self._history = None if attributes["history"] is None else [
|
||||
GistHistoryState.GistHistoryState(self._requester, element, completed=False)
|
||||
github.GistHistoryState.GistHistoryState(self._requester, element, completed=False)
|
||||
for element in attributes["history"]
|
||||
]
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
@@ -260,4 +258,4 @@ class Gist(GithubObject.GithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
|
||||
+10
-10
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import NamedUser
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class GistComment(GithubObject.GithubObject):
|
||||
class GistComment(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def body(self):
|
||||
self._completeIfNotSet(self._body)
|
||||
@@ -71,12 +71,12 @@ class GistComment(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._user = GithubObject.NotSet
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes: # pragma no branch
|
||||
@@ -96,4 +96,4 @@ class GistComment(GithubObject.GithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
|
||||
+7
-7
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GistFile(GithubObject.BasicGithubObject):
|
||||
class GistFile(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def content(self):
|
||||
return self._NoneIfNotSet(self._content)
|
||||
@@ -38,11 +38,11 @@ class GistFile(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._size)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._content = GithubObject.NotSet
|
||||
self._filename = GithubObject.NotSet
|
||||
self._language = GithubObject.NotSet
|
||||
self._raw_url = GithubObject.NotSet
|
||||
self._size = GithubObject.NotSet
|
||||
self._content = github.GithubObject.NotSet
|
||||
self._filename = github.GithubObject.NotSet
|
||||
self._language = github.GithubObject.NotSet
|
||||
self._raw_url = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "content" in attributes: # pragma no branch
|
||||
|
||||
+11
-11
@@ -13,13 +13,13 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import NamedUser
|
||||
import CommitStats
|
||||
import github.NamedUser
|
||||
import github.CommitStats
|
||||
|
||||
|
||||
class GistHistoryState(GithubObject.GithubObject):
|
||||
class GistHistoryState(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def change_status(self):
|
||||
self._completeIfNotSet(self._change_status)
|
||||
@@ -46,16 +46,16 @@ class GistHistoryState(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._version)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._change_status = GithubObject.NotSet
|
||||
self._committed_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._user = GithubObject.NotSet
|
||||
self._version = GithubObject.NotSet
|
||||
self._change_status = github.GithubObject.NotSet
|
||||
self._committed_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
self._version = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "change_status" in attributes: # pragma no branch
|
||||
assert attributes["change_status"] is None or isinstance(attributes["change_status"], dict), attributes["change_status"]
|
||||
self._change_status = None if attributes["change_status"] is None else CommitStats.CommitStats(self._requester, attributes["change_status"], completed=False)
|
||||
self._change_status = None if attributes["change_status"] is None else github.CommitStats.CommitStats(self._requester, attributes["change_status"], completed=False)
|
||||
if "committed_at" in attributes: # pragma no branch
|
||||
assert attributes["committed_at"] is None or isinstance(attributes["committed_at"], (str, unicode)), attributes["committed_at"]
|
||||
self._committed_at = self._parseDatetime(attributes["committed_at"])
|
||||
@@ -64,7 +64,7 @@ class GistHistoryState(GithubObject.GithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
if "version" in attributes: # pragma no branch
|
||||
assert attributes["version"] is None or isinstance(attributes["version"], (str, unicode)), attributes["version"]
|
||||
self._version = attributes["version"]
|
||||
|
||||
+5
-5
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GitAuthor(GithubObject.BasicGithubObject):
|
||||
class GitAuthor(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def date(self):
|
||||
return self._NoneIfNotSet(self._date)
|
||||
@@ -30,9 +30,9 @@ class GitAuthor(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._name)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._date = GithubObject.NotSet
|
||||
self._email = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._date = github.GithubObject.NotSet
|
||||
self._email = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "date" in attributes: # pragma no branch
|
||||
|
||||
+7
-7
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GitBlob(GithubObject.GithubObject):
|
||||
class GitBlob(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def content(self):
|
||||
self._completeIfNotSet(self._content)
|
||||
@@ -43,11 +43,11 @@ class GitBlob(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._content = GithubObject.NotSet
|
||||
self._encoding = GithubObject.NotSet
|
||||
self._sha = GithubObject.NotSet
|
||||
self._size = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._content = github.GithubObject.NotSet
|
||||
self._encoding = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "content" in attributes: # pragma no branch
|
||||
|
||||
+14
-15
@@ -13,14 +13,13 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import GitAuthor
|
||||
import GitCommit
|
||||
import GitTree
|
||||
import github.GitAuthor
|
||||
import github.GitTree
|
||||
|
||||
|
||||
class GitCommit(GithubObject.GithubObject):
|
||||
class GitCommit(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def author(self):
|
||||
self._completeIfNotSet(self._author)
|
||||
@@ -61,21 +60,21 @@ class GitCommit(GithubObject.GithubObject):
|
||||
return self.sha
|
||||
|
||||
def _initAttributes(self):
|
||||
self._author = GithubObject.NotSet
|
||||
self._committer = GithubObject.NotSet
|
||||
self._message = GithubObject.NotSet
|
||||
self._parents = GithubObject.NotSet
|
||||
self._sha = GithubObject.NotSet
|
||||
self._tree = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._author = github.GithubObject.NotSet
|
||||
self._committer = github.GithubObject.NotSet
|
||||
self._message = github.GithubObject.NotSet
|
||||
self._parents = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._tree = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "author" in attributes: # pragma no branch
|
||||
assert attributes["author"] is None or isinstance(attributes["author"], dict), attributes["author"]
|
||||
self._author = None if attributes["author"] is None else GitAuthor.GitAuthor(self._requester, attributes["author"], completed=False)
|
||||
self._author = None if attributes["author"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["author"], completed=False)
|
||||
if "committer" in attributes: # pragma no branch
|
||||
assert attributes["committer"] is None or isinstance(attributes["committer"], dict), attributes["committer"]
|
||||
self._committer = None if attributes["committer"] is None else GitAuthor.GitAuthor(self._requester, attributes["committer"], completed=False)
|
||||
self._committer = None if attributes["committer"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["committer"], completed=False)
|
||||
if "message" in attributes: # pragma no branch
|
||||
assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"]
|
||||
self._message = attributes["message"]
|
||||
@@ -90,7 +89,7 @@ class GitCommit(GithubObject.GithubObject):
|
||||
self._sha = attributes["sha"]
|
||||
if "tree" in attributes: # pragma no branch
|
||||
assert attributes["tree"] is None or isinstance(attributes["tree"], dict), attributes["tree"]
|
||||
self._tree = None if attributes["tree"] is None else GitTree.GitTree(self._requester, attributes["tree"], completed=False)
|
||||
self._tree = None if attributes["tree"] is None else github.GitTree.GitTree(self._requester, attributes["tree"], completed=False)
|
||||
if "url" in attributes: # pragma no branch
|
||||
assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
|
||||
self._url = attributes["url"]
|
||||
|
||||
+5
-5
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GitObject(GithubObject.BasicGithubObject):
|
||||
class GitObject(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def sha(self):
|
||||
return self._NoneIfNotSet(self._sha)
|
||||
@@ -30,9 +30,9 @@ class GitObject(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._sha = GithubObject.NotSet
|
||||
self._type = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "sha" in attributes: # pragma no branch
|
||||
|
||||
+10
-10
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import GitObject
|
||||
import github.GitObject
|
||||
|
||||
|
||||
class GitRef(GithubObject.GithubObject):
|
||||
class GitRef(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def object(self):
|
||||
self._completeIfNotSet(self._object)
|
||||
@@ -42,13 +42,13 @@ class GitRef(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, sha, force=GithubObject.NotSet):
|
||||
def edit(self, sha, force=github.GithubObject.NotSet):
|
||||
assert isinstance(sha, (str, unicode)), sha
|
||||
assert force is GithubObject.NotSet or isinstance(force, bool), force
|
||||
assert force is github.GithubObject.NotSet or isinstance(force, bool), force
|
||||
post_parameters = {
|
||||
"sha": sha,
|
||||
}
|
||||
if force is not GithubObject.NotSet:
|
||||
if force is not github.GithubObject.NotSet:
|
||||
post_parameters["force"] = force
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -59,14 +59,14 @@ class GitRef(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._object = GithubObject.NotSet
|
||||
self._ref = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._object = github.GithubObject.NotSet
|
||||
self._ref = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "object" in attributes: # pragma no branch
|
||||
assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"]
|
||||
self._object = None if attributes["object"] is None else GitObject.GitObject(self._requester, attributes["object"], completed=False)
|
||||
self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, attributes["object"], completed=False)
|
||||
if "ref" in attributes: # pragma no branch
|
||||
assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"]
|
||||
self._ref = attributes["ref"]
|
||||
|
||||
+12
-12
@@ -13,13 +13,13 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import GitAuthor
|
||||
import GitObject
|
||||
import github.GitAuthor
|
||||
import github.GitObject
|
||||
|
||||
|
||||
class GitTag(GithubObject.GithubObject):
|
||||
class GitTag(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def message(self):
|
||||
self._completeIfNotSet(self._message)
|
||||
@@ -51,12 +51,12 @@ class GitTag(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._message = GithubObject.NotSet
|
||||
self._object = GithubObject.NotSet
|
||||
self._sha = GithubObject.NotSet
|
||||
self._tag = GithubObject.NotSet
|
||||
self._tagger = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._message = github.GithubObject.NotSet
|
||||
self._object = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._tag = github.GithubObject.NotSet
|
||||
self._tagger = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "message" in attributes: # pragma no branch
|
||||
@@ -64,7 +64,7 @@ class GitTag(GithubObject.GithubObject):
|
||||
self._message = attributes["message"]
|
||||
if "object" in attributes: # pragma no branch
|
||||
assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"]
|
||||
self._object = None if attributes["object"] is None else GitObject.GitObject(self._requester, attributes["object"], completed=False)
|
||||
self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, attributes["object"], completed=False)
|
||||
if "sha" in attributes: # pragma no branch
|
||||
assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"]
|
||||
self._sha = attributes["sha"]
|
||||
@@ -73,7 +73,7 @@ class GitTag(GithubObject.GithubObject):
|
||||
self._tag = attributes["tag"]
|
||||
if "tagger" in attributes: # pragma no branch
|
||||
assert attributes["tagger"] is None or isinstance(attributes["tagger"], dict), attributes["tagger"]
|
||||
self._tagger = None if attributes["tagger"] is None else GitAuthor.GitAuthor(self._requester, attributes["tagger"], completed=False)
|
||||
self._tagger = None if attributes["tagger"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["tagger"], completed=False)
|
||||
if "url" in attributes: # pragma no branch
|
||||
assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
|
||||
self._url = attributes["url"]
|
||||
|
||||
+7
-7
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import GitTreeElement
|
||||
import github.GitTreeElement
|
||||
|
||||
|
||||
class GitTree(GithubObject.GithubObject):
|
||||
class GitTree(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def sha(self):
|
||||
self._completeIfNotSet(self._sha)
|
||||
@@ -39,9 +39,9 @@ class GitTree(GithubObject.GithubObject):
|
||||
return self.sha
|
||||
|
||||
def _initAttributes(self):
|
||||
self._sha = GithubObject.NotSet
|
||||
self._tree = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._tree = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "sha" in attributes: # pragma no branch
|
||||
@@ -50,7 +50,7 @@ class GitTree(GithubObject.GithubObject):
|
||||
if "tree" in attributes: # pragma no branch
|
||||
assert attributes["tree"] is None or all(isinstance(element, dict) for element in attributes["tree"]), attributes["tree"]
|
||||
self._tree = None if attributes["tree"] is None else [
|
||||
GitTreeElement.GitTreeElement(self._requester, element, completed=False)
|
||||
github.GitTreeElement.GitTreeElement(self._requester, element, completed=False)
|
||||
for element in attributes["tree"]
|
||||
]
|
||||
if "url" in attributes: # pragma no branch
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class GitTreeElement(GithubObject.BasicGithubObject):
|
||||
class GitTreeElement(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def mode(self):
|
||||
return self._NoneIfNotSet(self._mode)
|
||||
@@ -42,12 +42,12 @@ class GitTreeElement(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._mode = GithubObject.NotSet
|
||||
self._path = GithubObject.NotSet
|
||||
self._sha = GithubObject.NotSet
|
||||
self._size = GithubObject.NotSet
|
||||
self._type = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._mode = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "mode" in attributes: # pragma no branch
|
||||
|
||||
+49
-19
@@ -20,11 +20,12 @@ import AuthenticatedUser
|
||||
import NamedUser
|
||||
import Organization
|
||||
import Gist
|
||||
import PaginatedList
|
||||
import github.PaginatedList
|
||||
import Repository
|
||||
import Legacy
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
import HookDescription
|
||||
import GitignoreTemplate
|
||||
|
||||
|
||||
DEFAULT_BASE_URL = "https://api.github.com"
|
||||
@@ -47,9 +48,9 @@ class Github(object):
|
||||
def rate_limiting(self):
|
||||
return self.__requester.rate_limiting
|
||||
|
||||
def get_user(self, login=GithubObject.NotSet):
|
||||
assert login is GithubObject.NotSet or isinstance(login, (str, unicode)), login
|
||||
if login is GithubObject.NotSet:
|
||||
def get_user(self, login=github.GithubObject.NotSet):
|
||||
assert login is github.GithubObject.NotSet or isinstance(login, (str, unicode)), login
|
||||
if login is github.GithubObject.NotSet:
|
||||
return AuthenticatedUser.AuthenticatedUser(self.__requester, {"url": "/user"}, completed=False)
|
||||
else:
|
||||
headers, data = self.__requester.requestAndCheck(
|
||||
@@ -58,7 +59,7 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return NamedUser.NamedUser(self.__requester, data, completed=True)
|
||||
return github.NamedUser.NamedUser(self.__requester, data, completed=True)
|
||||
|
||||
def get_organization(self, login):
|
||||
assert isinstance(login, (str, unicode)), login
|
||||
@@ -68,7 +69,17 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Organization.Organization(self.__requester, data, completed=True)
|
||||
return github.Organization.Organization(self.__requester, data, completed=True)
|
||||
|
||||
def get_repo(self, full_name):
|
||||
assert isinstance(full_name, (str, unicode)), full_name
|
||||
headers, data = self.__requester.requestAndCheck(
|
||||
"GET",
|
||||
"/repos/" + full_name,
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Repository.Repository(self.__requester, data, completed=True)
|
||||
|
||||
def get_gist(self, id):
|
||||
assert isinstance(id, (str, unicode)), id
|
||||
@@ -78,27 +89,27 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Gist.Gist(self.__requester, data, completed=True)
|
||||
return github.Gist.Gist(self.__requester, data, completed=True)
|
||||
|
||||
def get_gists(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Gist.Gist,
|
||||
self.__requester,
|
||||
"/gists/public",
|
||||
None
|
||||
)
|
||||
|
||||
def legacy_search_repos(self, keyword, language=GithubObject.NotSet):
|
||||
def legacy_search_repos(self, keyword, language=github.GithubObject.NotSet):
|
||||
assert isinstance(keyword, (str, unicode)), keyword
|
||||
assert language is GithubObject.NotSet or isinstance(language, (str, unicode)), language
|
||||
args = {} if language is GithubObject.NotSet else {"language": language}
|
||||
assert language is github.GithubObject.NotSet or isinstance(language, (str, unicode)), language
|
||||
args = {} if language is github.GithubObject.NotSet else {"language": language}
|
||||
return Legacy.PaginatedList(
|
||||
"/legacy/repos/search/" + urllib.quote(keyword),
|
||||
args,
|
||||
self.__requester,
|
||||
"repositories",
|
||||
Legacy.convertRepo,
|
||||
Repository.Repository,
|
||||
github.Repository.Repository,
|
||||
)
|
||||
|
||||
def legacy_search_users(self, keyword):
|
||||
@@ -109,7 +120,7 @@ class Github(object):
|
||||
self.__requester,
|
||||
"users",
|
||||
Legacy.convertUser,
|
||||
NamedUser.NamedUser,
|
||||
github.NamedUser.NamedUser,
|
||||
)
|
||||
|
||||
def legacy_search_user_by_email(self, email):
|
||||
@@ -120,15 +131,15 @@ class Github(object):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return NamedUser.NamedUser(self.__requester, Legacy.convertUser(data["user"]), completed=False)
|
||||
return github.NamedUser.NamedUser(self.__requester, Legacy.convertUser(data["user"]), completed=False)
|
||||
|
||||
def render_markdown(self, text, context=GithubObject.NotSet):
|
||||
def render_markdown(self, text, context=github.GithubObject.NotSet):
|
||||
assert isinstance(text, (str, unicode)), text
|
||||
assert context is GithubObject.NotSet or isinstance(context, Repository.Repository), context
|
||||
assert context is github.GithubObject.NotSet or isinstance(context, github.Repository.Repository), context
|
||||
post_parameters = {
|
||||
"text": text
|
||||
}
|
||||
if context is not GithubObject.NotSet:
|
||||
if context is not github.GithubObject.NotSet:
|
||||
post_parameters["mode"] = "gfm"
|
||||
post_parameters["context"] = context._identity
|
||||
status, headers, data = self.__requester.requestRaw(
|
||||
@@ -147,3 +158,22 @@ class Github(object):
|
||||
None
|
||||
)
|
||||
return [HookDescription.HookDescription(self.__requester, attributes, completed=True) for attributes in data]
|
||||
|
||||
def get_gitignore_templates(self):
|
||||
headers, data = self.__requester.requestAndCheck(
|
||||
"GET",
|
||||
"/gitignore/templates",
|
||||
None,
|
||||
None
|
||||
)
|
||||
return data
|
||||
|
||||
def get_gitignore_template(self, name):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
headers, attributes = self.__requester.requestAndCheck(
|
||||
"GET",
|
||||
"/gitignore/templates/" + name,
|
||||
None,
|
||||
None
|
||||
)
|
||||
return GitignoreTemplate.GitignoreTemplate(self.__requester, attributes, completed=True)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2012 Vincent Jacques
|
||||
# vincent@vincent-jacques.net
|
||||
|
||||
# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
|
||||
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
class GitignoreTemplate(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def source(self):
|
||||
return self._NoneIfNotSet(self._source)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._NoneIfNotSet(self._name)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._source = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "source" in attributes: # pragma no branch
|
||||
assert attributes["source"] is None or isinstance(attributes["source"], (str, unicode)), attributes["source"]
|
||||
self._source = attributes["source"]
|
||||
if "name" in attributes: # pragma no branch
|
||||
assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
|
||||
self._name = attributes["name"]
|
||||
+22
-22
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import HookResponse
|
||||
import github.HookResponse
|
||||
|
||||
|
||||
class Hook(GithubObject.GithubObject):
|
||||
class Hook(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def active(self):
|
||||
self._completeIfNotSet(self._active)
|
||||
@@ -72,24 +72,24 @@ class Hook(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, name, config, events=GithubObject.NotSet, add_events=GithubObject.NotSet, remove_events=GithubObject.NotSet, active=GithubObject.NotSet):
|
||||
def edit(self, name, config, events=github.GithubObject.NotSet, add_events=github.GithubObject.NotSet, remove_events=github.GithubObject.NotSet, active=github.GithubObject.NotSet):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert isinstance(config, dict), config
|
||||
assert events is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events
|
||||
assert add_events is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_events), add_events
|
||||
assert remove_events is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_events), remove_events
|
||||
assert active is GithubObject.NotSet or isinstance(active, bool), active
|
||||
assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events
|
||||
assert add_events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_events), add_events
|
||||
assert remove_events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_events), remove_events
|
||||
assert active is github.GithubObject.NotSet or isinstance(active, bool), active
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
"config": config,
|
||||
}
|
||||
if events is not GithubObject.NotSet:
|
||||
if events is not github.GithubObject.NotSet:
|
||||
post_parameters["events"] = events
|
||||
if add_events is not GithubObject.NotSet:
|
||||
if add_events is not github.GithubObject.NotSet:
|
||||
post_parameters["add_events"] = add_events
|
||||
if remove_events is not GithubObject.NotSet:
|
||||
if remove_events is not github.GithubObject.NotSet:
|
||||
post_parameters["remove_events"] = remove_events
|
||||
if active is not GithubObject.NotSet:
|
||||
if active is not github.GithubObject.NotSet:
|
||||
post_parameters["active"] = active
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -108,15 +108,15 @@ class Hook(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._active = GithubObject.NotSet
|
||||
self._config = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._events = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._last_response = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._active = github.GithubObject.NotSet
|
||||
self._config = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._events = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._last_response = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "active" in attributes: # pragma no branch
|
||||
@@ -136,7 +136,7 @@ class Hook(GithubObject.GithubObject):
|
||||
self._id = attributes["id"]
|
||||
if "last_response" in attributes: # pragma no branch
|
||||
assert attributes["last_response"] is None or isinstance(attributes["last_response"], dict), attributes["last_response"]
|
||||
self._last_response = None if attributes["last_response"] is None else HookResponse.HookResponse(self._requester, attributes["last_response"], completed=False)
|
||||
self._last_response = None if attributes["last_response"] is None else github.HookResponse.HookResponse(self._requester, attributes["last_response"], completed=False)
|
||||
if "name" in attributes: # pragma no branch
|
||||
assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
|
||||
self._name = attributes["name"]
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class HookDescription(GithubObject.BasicGithubObject):
|
||||
class HookDescription(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def events(self):
|
||||
return self._NoneIfNotSet(self._events)
|
||||
@@ -34,10 +34,10 @@ class HookDescription(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._supported_events)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._events = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._schema = GithubObject.NotSet
|
||||
self._supported_events = GithubObject.NotSet
|
||||
self._events = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._schema = github.GithubObject.NotSet
|
||||
self._supported_events = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "events" in attributes: # pragma no branch
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class HookResponse(GithubObject.BasicGithubObject):
|
||||
class HookResponse(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def code(self):
|
||||
return self._NoneIfNotSet(self._code)
|
||||
@@ -30,9 +30,9 @@ class HookResponse(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._status)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._code = GithubObject.NotSet
|
||||
self._message = GithubObject.NotSet
|
||||
self._status = GithubObject.NotSet
|
||||
self._code = github.GithubObject.NotSet
|
||||
self._message = github.GithubObject.NotSet
|
||||
self._status = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "code" in attributes: # pragma no branch
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class InputGitTreeElement(object):
|
||||
def __init__(self, path, mode, type, content=GithubObject.NotSet, sha=GithubObject.NotSet):
|
||||
def __init__(self, path, mode, type, content=github.GithubObject.NotSet, sha=github.GithubObject.NotSet):
|
||||
self.__path = path
|
||||
self.__mode = mode
|
||||
self.__type = type
|
||||
@@ -31,8 +31,8 @@ class InputGitTreeElement(object):
|
||||
"mode": self.__mode,
|
||||
"type": self.__type,
|
||||
}
|
||||
if self.__sha is not GithubObject.NotSet:
|
||||
if self.__sha is not github.GithubObject.NotSet:
|
||||
identity["sha"] = self.__sha
|
||||
if self.__content is not GithubObject.NotSet:
|
||||
if self.__content is not github.GithubObject.NotSet:
|
||||
identity["content"] = self.__content
|
||||
return identity
|
||||
|
||||
+59
-59
@@ -13,19 +13,19 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import Repository
|
||||
import IssueEvent
|
||||
import Label
|
||||
import NamedUser
|
||||
import Milestone
|
||||
import IssueComment
|
||||
import IssuePullRequest
|
||||
import github.Repository
|
||||
import github.IssueEvent
|
||||
import github.Label
|
||||
import github.NamedUser
|
||||
import github.Milestone
|
||||
import github.IssueComment
|
||||
import github.IssuePullRequest
|
||||
|
||||
|
||||
class Issue(GithubObject.GithubObject):
|
||||
class Issue(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def assignee(self):
|
||||
self._completeIfNotSet(self._assignee)
|
||||
@@ -117,7 +117,7 @@ class Issue(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._user)
|
||||
|
||||
def add_to_labels(self, *labels):
|
||||
assert all(isinstance(element, Label.Label) for element in labels), labels
|
||||
assert all(isinstance(element, github.Label.Label) for element in labels), labels
|
||||
post_parameters = [label.name for label in labels]
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -137,7 +137,7 @@ class Issue(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
return github.IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
|
||||
def delete_labels(self):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
@@ -147,25 +147,25 @@ class Issue(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, title=GithubObject.NotSet, body=GithubObject.NotSet, assignee=GithubObject.NotSet, state=GithubObject.NotSet, milestone=GithubObject.NotSet, labels=GithubObject.NotSet):
|
||||
assert title is GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert body is GithubObject.NotSet or isinstance(body, (str, unicode)), body
|
||||
assert assignee is GithubObject.NotSet or assignee is None or isinstance(assignee, NamedUser.NamedUser), assignee
|
||||
assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert milestone is GithubObject.NotSet or milestone is None or isinstance(milestone, Milestone.Milestone), milestone
|
||||
assert labels is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in labels), labels
|
||||
def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, state=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet):
|
||||
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
|
||||
assert assignee is github.GithubObject.NotSet or assignee is None or isinstance(assignee, github.NamedUser.NamedUser), assignee
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), 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, unicode)) for element in labels), labels
|
||||
post_parameters = dict()
|
||||
if title is not GithubObject.NotSet:
|
||||
if title is not github.GithubObject.NotSet:
|
||||
post_parameters["title"] = title
|
||||
if body is not GithubObject.NotSet:
|
||||
if body is not github.GithubObject.NotSet:
|
||||
post_parameters["body"] = body
|
||||
if assignee is not GithubObject.NotSet:
|
||||
if assignee is not github.GithubObject.NotSet:
|
||||
post_parameters["assignee"] = assignee._identity if assignee else ''
|
||||
if state is not GithubObject.NotSet:
|
||||
if state is not github.GithubObject.NotSet:
|
||||
post_parameters["state"] = state
|
||||
if milestone is not GithubObject.NotSet:
|
||||
if milestone is not github.GithubObject.NotSet:
|
||||
post_parameters["milestone"] = milestone._identity if milestone else ''
|
||||
if labels is not GithubObject.NotSet:
|
||||
if labels is not github.GithubObject.NotSet:
|
||||
post_parameters["labels"] = labels
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -183,34 +183,34 @@ class Issue(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
return github.IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueComment.IssueComment,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.IssueComment.IssueComment,
|
||||
self._requester,
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueEvent.IssueEvent,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.IssueEvent.IssueEvent,
|
||||
self._requester,
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_labels(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Label.Label,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Label.Label,
|
||||
self._requester,
|
||||
self.url + "/labels",
|
||||
None
|
||||
)
|
||||
|
||||
def remove_from_labels(self, label):
|
||||
assert isinstance(label, Label.Label), label
|
||||
assert isinstance(label, github.Label.Label), label
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/labels/" + label._identity,
|
||||
@@ -219,7 +219,7 @@ class Issue(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def set_labels(self, *labels):
|
||||
assert all(isinstance(element, Label.Label) for element in labels), labels
|
||||
assert all(isinstance(element, github.Label.Label) for element in labels), labels
|
||||
post_parameters = [label.name for label in labels]
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
@@ -233,29 +233,29 @@ class Issue(GithubObject.GithubObject):
|
||||
return self.number
|
||||
|
||||
def _initAttributes(self):
|
||||
self._assignee = GithubObject.NotSet
|
||||
self._body = GithubObject.NotSet
|
||||
self._closed_at = GithubObject.NotSet
|
||||
self._closed_by = GithubObject.NotSet
|
||||
self._comments = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._labels = GithubObject.NotSet
|
||||
self._milestone = GithubObject.NotSet
|
||||
self._number = GithubObject.NotSet
|
||||
self._pull_request = GithubObject.NotSet
|
||||
self._repository = GithubObject.NotSet
|
||||
self._state = GithubObject.NotSet
|
||||
self._title = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._user = GithubObject.NotSet
|
||||
self._assignee = github.GithubObject.NotSet
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._closed_at = github.GithubObject.NotSet
|
||||
self._closed_by = github.GithubObject.NotSet
|
||||
self._comments = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._labels = github.GithubObject.NotSet
|
||||
self._milestone = github.GithubObject.NotSet
|
||||
self._number = github.GithubObject.NotSet
|
||||
self._pull_request = github.GithubObject.NotSet
|
||||
self._repository = github.GithubObject.NotSet
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "assignee" in attributes: # pragma no branch
|
||||
assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"]
|
||||
self._assignee = None if attributes["assignee"] is None else NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False)
|
||||
self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False)
|
||||
if "body" in attributes: # pragma no branch
|
||||
assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
|
||||
self._body = attributes["body"]
|
||||
@@ -264,7 +264,7 @@ class Issue(GithubObject.GithubObject):
|
||||
self._closed_at = self._parseDatetime(attributes["closed_at"])
|
||||
if "closed_by" in attributes: # pragma no branch
|
||||
assert attributes["closed_by"] is None or isinstance(attributes["closed_by"], dict), attributes["closed_by"]
|
||||
self._closed_by = None if attributes["closed_by"] is None else NamedUser.NamedUser(self._requester, attributes["closed_by"], completed=False)
|
||||
self._closed_by = None if attributes["closed_by"] is None else github.NamedUser.NamedUser(self._requester, attributes["closed_by"], completed=False)
|
||||
if "comments" in attributes: # pragma no branch
|
||||
assert attributes["comments"] is None or isinstance(attributes["comments"], (int, long)), attributes["comments"]
|
||||
self._comments = attributes["comments"]
|
||||
@@ -280,21 +280,21 @@ class Issue(GithubObject.GithubObject):
|
||||
if "labels" in attributes: # pragma no branch
|
||||
assert attributes["labels"] is None or all(isinstance(element, dict) for element in attributes["labels"]), attributes["labels"]
|
||||
self._labels = None if attributes["labels"] is None else [
|
||||
Label.Label(self._requester, element, completed=False)
|
||||
github.Label.Label(self._requester, element, completed=False)
|
||||
for element in attributes["labels"]
|
||||
]
|
||||
if "milestone" in attributes: # pragma no branch
|
||||
assert attributes["milestone"] is None or isinstance(attributes["milestone"], dict), attributes["milestone"]
|
||||
self._milestone = None if attributes["milestone"] is None else Milestone.Milestone(self._requester, attributes["milestone"], completed=False)
|
||||
self._milestone = None if attributes["milestone"] is None else github.Milestone.Milestone(self._requester, attributes["milestone"], completed=False)
|
||||
if "number" in attributes: # pragma no branch
|
||||
assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"]
|
||||
self._number = attributes["number"]
|
||||
if "pull_request" in attributes: # pragma no branch
|
||||
assert attributes["pull_request"] is None or isinstance(attributes["pull_request"], dict), attributes["pull_request"]
|
||||
self._pull_request = None if attributes["pull_request"] is None else IssuePullRequest.IssuePullRequest(self._requester, attributes["pull_request"], completed=False)
|
||||
self._pull_request = None if attributes["pull_request"] is None else github.IssuePullRequest.IssuePullRequest(self._requester, attributes["pull_request"], completed=False)
|
||||
if "repository" in attributes: # pragma no branch
|
||||
assert attributes["repository"] is None or isinstance(attributes["repository"], dict), attributes["repository"]
|
||||
self._repository = None if attributes["repository"] is None else Repository.Repository(self._requester, attributes["repository"], completed=False)
|
||||
self._repository = None if attributes["repository"] is None else github.Repository.Repository(self._requester, attributes["repository"], completed=False)
|
||||
if "state" in attributes: # pragma no branch
|
||||
assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"]
|
||||
self._state = attributes["state"]
|
||||
@@ -309,4 +309,4 @@ class Issue(GithubObject.GithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
|
||||
+10
-10
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import NamedUser
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class IssueComment(GithubObject.GithubObject):
|
||||
class IssueComment(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def body(self):
|
||||
self._completeIfNotSet(self._body)
|
||||
@@ -71,12 +71,12 @@ class IssueComment(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._user = GithubObject.NotSet
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes: # pragma no branch
|
||||
@@ -96,4 +96,4 @@ class IssueComment(GithubObject.GithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
|
||||
+13
-13
@@ -13,13 +13,13 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import Issue
|
||||
import NamedUser
|
||||
import github.Issue
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class IssueEvent(GithubObject.GithubObject):
|
||||
class IssueEvent(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def actor(self):
|
||||
self._completeIfNotSet(self._actor)
|
||||
@@ -56,18 +56,18 @@ class IssueEvent(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._actor = GithubObject.NotSet
|
||||
self._commit_id = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._event = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._issue = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._actor = github.GithubObject.NotSet
|
||||
self._commit_id = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._event = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._issue = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "actor" in attributes: # pragma no branch
|
||||
assert attributes["actor"] is None or isinstance(attributes["actor"], dict), attributes["actor"]
|
||||
self._actor = None if attributes["actor"] is None else NamedUser.NamedUser(self._requester, attributes["actor"], completed=False)
|
||||
self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, attributes["actor"], completed=False)
|
||||
if "commit_id" in attributes: # pragma no branch
|
||||
assert attributes["commit_id"] is None or isinstance(attributes["commit_id"], (str, unicode)), attributes["commit_id"]
|
||||
self._commit_id = attributes["commit_id"]
|
||||
@@ -82,7 +82,7 @@ class IssueEvent(GithubObject.GithubObject):
|
||||
self._id = attributes["id"]
|
||||
if "issue" in attributes: # pragma no branch
|
||||
assert attributes["issue"] is None or isinstance(attributes["issue"], dict), attributes["issue"]
|
||||
self._issue = None if attributes["issue"] is None else Issue.Issue(self._requester, attributes["issue"], completed=False)
|
||||
self._issue = None if attributes["issue"] is None else github.Issue.Issue(self._requester, attributes["issue"], completed=False)
|
||||
if "url" in attributes: # pragma no branch
|
||||
assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
|
||||
self._url = attributes["url"]
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class IssuePullRequest(GithubObject.BasicGithubObject):
|
||||
class IssuePullRequest(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def diff_url(self):
|
||||
return self._NoneIfNotSet(self._diff_url)
|
||||
@@ -30,9 +30,9 @@ class IssuePullRequest(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._patch_url)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._diff_url = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._patch_url = GithubObject.NotSet
|
||||
self._diff_url = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._patch_url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "diff_url" in attributes: # pragma no branch
|
||||
|
||||
+5
-5
@@ -15,10 +15,10 @@
|
||||
|
||||
import urllib
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class Label(GithubObject.GithubObject):
|
||||
class Label(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def color(self):
|
||||
self._completeIfNotSet(self._color)
|
||||
@@ -62,9 +62,9 @@ class Label(GithubObject.GithubObject):
|
||||
return urllib.quote(self.name)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._color = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._color = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "color" in attributes: # pragma no branch
|
||||
|
||||
+3
-3
@@ -15,12 +15,12 @@
|
||||
|
||||
import urlparse
|
||||
|
||||
from PaginatedList import PaginatedListBase
|
||||
import github.PaginatedList
|
||||
|
||||
|
||||
class PaginatedList(PaginatedListBase):
|
||||
class PaginatedList(github.PaginatedList.PaginatedListBase):
|
||||
def __init__(self, url, args, requester, key, convert, contentClass):
|
||||
PaginatedListBase.__init__(self)
|
||||
github.PaginatedList.PaginatedListBase.__init__(self)
|
||||
self.__url = url
|
||||
self.__args = args
|
||||
self.__requester = requester
|
||||
|
||||
+26
-26
@@ -15,14 +15,14 @@
|
||||
|
||||
import datetime
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import NamedUser
|
||||
import Label
|
||||
import github.NamedUser
|
||||
import github.Label
|
||||
|
||||
|
||||
class Milestone(GithubObject.GithubObject):
|
||||
class Milestone(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def closed_issues(self):
|
||||
self._completeIfNotSet(self._closed_issues)
|
||||
@@ -86,19 +86,19 @@ class Milestone(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, title, state=GithubObject.NotSet, description=GithubObject.NotSet, due_on=GithubObject.NotSet):
|
||||
def edit(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet):
|
||||
assert isinstance(title, (str, unicode)), title
|
||||
assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert due_on is GithubObject.NotSet or isinstance(due_on, datetime.date), due_on
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert due_on is github.GithubObject.NotSet or isinstance(due_on, datetime.date), due_on
|
||||
post_parameters = {
|
||||
"title": title,
|
||||
}
|
||||
if state is not GithubObject.NotSet:
|
||||
if state is not github.GithubObject.NotSet:
|
||||
post_parameters["state"] = state
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if due_on is not GithubObject.NotSet:
|
||||
if due_on is not github.GithubObject.NotSet:
|
||||
post_parameters["due_on"] = due_on.strftime("%Y-%m-%d")
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -109,8 +109,8 @@ class Milestone(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_labels(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Label.Label,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Label.Label,
|
||||
self._requester,
|
||||
self.url + "/labels",
|
||||
None
|
||||
@@ -121,17 +121,17 @@ class Milestone(GithubObject.GithubObject):
|
||||
return self.number
|
||||
|
||||
def _initAttributes(self):
|
||||
self._closed_issues = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._creator = GithubObject.NotSet
|
||||
self._description = GithubObject.NotSet
|
||||
self._due_on = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._number = GithubObject.NotSet
|
||||
self._open_issues = GithubObject.NotSet
|
||||
self._state = GithubObject.NotSet
|
||||
self._title = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._closed_issues = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._creator = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._due_on = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._number = github.GithubObject.NotSet
|
||||
self._open_issues = github.GithubObject.NotSet
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "closed_issues" in attributes: # pragma no branch
|
||||
@@ -142,7 +142,7 @@ class Milestone(GithubObject.GithubObject):
|
||||
self._created_at = self._parseDatetime(attributes["created_at"])
|
||||
if "creator" in attributes: # pragma no branch
|
||||
assert attributes["creator"] is None or isinstance(attributes["creator"], dict), attributes["creator"]
|
||||
self._creator = None if attributes["creator"] is None else NamedUser.NamedUser(self._requester, attributes["creator"], completed=False)
|
||||
self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, attributes["creator"], completed=False)
|
||||
if "description" in attributes: # pragma no branch
|
||||
assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"]
|
||||
self._description = attributes["description"]
|
||||
|
||||
+67
-68
@@ -13,19 +13,18 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import Gist
|
||||
import Repository
|
||||
import NamedUser
|
||||
import Plan
|
||||
import Organization
|
||||
import InputFileContent
|
||||
import Event
|
||||
import github.Gist
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
import github.Plan
|
||||
import github.Organization
|
||||
import github.Event
|
||||
|
||||
|
||||
class NamedUser(GithubObject.GithubObject):
|
||||
class NamedUser(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def avatar_url(self):
|
||||
self._completeIfNotSet(self._avatar_url)
|
||||
@@ -156,15 +155,15 @@ class NamedUser(GithubObject.GithubObject):
|
||||
self._completeIfNotSet(self._url)
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def create_gist(self, public, files, description=GithubObject.NotSet):
|
||||
def create_gist(self, public, files, description=github.GithubObject.NotSet):
|
||||
assert isinstance(public, bool), public
|
||||
assert all(isinstance(element, InputFileContent.InputFileContent) for element in files.itervalues()), files
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
post_parameters = {
|
||||
"public": public,
|
||||
"files": dict((key, value._identity) for key, value in files.iteritems()),
|
||||
}
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -172,18 +171,18 @@ class NamedUser(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Gist.Gist(self._requester, data, completed=True)
|
||||
return github.Gist.Gist(self._requester, data, completed=True)
|
||||
|
||||
def get_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_followers(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
return github.PaginatedList.PaginatedList(
|
||||
NamedUser,
|
||||
self._requester,
|
||||
self.url + "/followers",
|
||||
@@ -191,7 +190,7 @@ class NamedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def get_following(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
return github.PaginatedList.PaginatedList(
|
||||
NamedUser,
|
||||
self._requester,
|
||||
self.url + "/following",
|
||||
@@ -199,40 +198,40 @@ class NamedUser(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def get_gists(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Gist.Gist,
|
||||
self._requester,
|
||||
self.url + "/gists",
|
||||
None
|
||||
)
|
||||
|
||||
def get_orgs(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Organization.Organization,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Organization.Organization,
|
||||
self._requester,
|
||||
self.url + "/orgs",
|
||||
None
|
||||
)
|
||||
|
||||
def get_public_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/events/public",
|
||||
None
|
||||
)
|
||||
|
||||
def get_public_received_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/received_events/public",
|
||||
None
|
||||
)
|
||||
|
||||
def get_received_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/received_events",
|
||||
None
|
||||
@@ -246,39 +245,39 @@ class NamedUser(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
|
||||
def get_repos(self, type=GithubObject.NotSet):
|
||||
assert type is GithubObject.NotSet or isinstance(type, (str, unicode)), type
|
||||
def get_repos(self, type=github.GithubObject.NotSet):
|
||||
assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type
|
||||
url_parameters = dict()
|
||||
if type is not GithubObject.NotSet:
|
||||
if type is not github.GithubObject.NotSet:
|
||||
url_parameters["type"] = type
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/repos",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_starred(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/starred",
|
||||
None
|
||||
)
|
||||
|
||||
def get_subscriptions(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/subscriptions",
|
||||
None
|
||||
)
|
||||
|
||||
def get_watched(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/watched",
|
||||
None
|
||||
@@ -289,32 +288,32 @@ class NamedUser(GithubObject.GithubObject):
|
||||
return self.login
|
||||
|
||||
def _initAttributes(self):
|
||||
self._avatar_url = GithubObject.NotSet
|
||||
self._bio = GithubObject.NotSet
|
||||
self._blog = GithubObject.NotSet
|
||||
self._collaborators = GithubObject.NotSet
|
||||
self._company = GithubObject.NotSet
|
||||
self._contributions = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._disk_usage = GithubObject.NotSet
|
||||
self._email = GithubObject.NotSet
|
||||
self._followers = GithubObject.NotSet
|
||||
self._following = GithubObject.NotSet
|
||||
self._gravatar_id = GithubObject.NotSet
|
||||
self._hireable = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._location = GithubObject.NotSet
|
||||
self._login = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._owned_private_repos = GithubObject.NotSet
|
||||
self._plan = GithubObject.NotSet
|
||||
self._private_gists = GithubObject.NotSet
|
||||
self._public_gists = GithubObject.NotSet
|
||||
self._public_repos = GithubObject.NotSet
|
||||
self._total_private_repos = GithubObject.NotSet
|
||||
self._type = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._avatar_url = github.GithubObject.NotSet
|
||||
self._bio = github.GithubObject.NotSet
|
||||
self._blog = github.GithubObject.NotSet
|
||||
self._collaborators = github.GithubObject.NotSet
|
||||
self._company = github.GithubObject.NotSet
|
||||
self._contributions = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._disk_usage = github.GithubObject.NotSet
|
||||
self._email = github.GithubObject.NotSet
|
||||
self._followers = github.GithubObject.NotSet
|
||||
self._following = github.GithubObject.NotSet
|
||||
self._gravatar_id = github.GithubObject.NotSet
|
||||
self._hireable = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._location = github.GithubObject.NotSet
|
||||
self._login = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._owned_private_repos = github.GithubObject.NotSet
|
||||
self._plan = github.GithubObject.NotSet
|
||||
self._private_gists = github.GithubObject.NotSet
|
||||
self._public_gists = github.GithubObject.NotSet
|
||||
self._public_repos = github.GithubObject.NotSet
|
||||
self._total_private_repos = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "avatar_url" in attributes: # pragma no branch
|
||||
@@ -376,7 +375,7 @@ class NamedUser(GithubObject.GithubObject):
|
||||
self._owned_private_repos = attributes["owned_private_repos"]
|
||||
if "plan" in attributes: # pragma no branch
|
||||
assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"]
|
||||
self._plan = None if attributes["plan"] is None else Plan.Plan(self._requester, attributes["plan"], completed=False)
|
||||
self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False)
|
||||
if "private_gists" in attributes: # pragma no branch
|
||||
assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"]
|
||||
self._private_gists = attributes["private_gists"]
|
||||
|
||||
+94
-94
@@ -13,17 +13,17 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import Plan
|
||||
import Team
|
||||
import Event
|
||||
import Repository
|
||||
import NamedUser
|
||||
import github.Plan
|
||||
import github.Team
|
||||
import github.Event
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class Organization(GithubObject.GithubObject):
|
||||
class Organization(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def avatar_url(self):
|
||||
self._completeIfNotSet(self._avatar_url)
|
||||
@@ -145,7 +145,7 @@ class Organization(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def add_to_public_members(self, public_member):
|
||||
assert isinstance(public_member, NamedUser.NamedUser), public_member
|
||||
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
self.url + "/public_members/" + public_member._identity,
|
||||
@@ -154,7 +154,7 @@ class Organization(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def create_fork(self, repo):
|
||||
assert isinstance(repo, Repository.Repository), repo
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
url_parameters = {
|
||||
"org": self.login,
|
||||
}
|
||||
@@ -164,39 +164,39 @@ class Organization(GithubObject.GithubObject):
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
|
||||
def create_repo(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, private=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, team_id=GithubObject.NotSet, auto_init=GithubObject.NotSet, gitignore_template=GithubObject.NotSet):
|
||||
def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, team_id=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert homepage is GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
|
||||
assert private is GithubObject.NotSet or isinstance(private, bool), private
|
||||
assert has_issues is GithubObject.NotSet or isinstance(has_issues, bool), has_issues
|
||||
assert has_wiki is GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
|
||||
assert has_downloads is GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
|
||||
assert team_id is GithubObject.NotSet or isinstance(team_id, Team.Team), team_id
|
||||
assert auto_init is GithubObject.NotSet or isinstance(auto_init, bool), auto_init
|
||||
assert gitignore_template is GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
|
||||
assert private is github.GithubObject.NotSet or isinstance(private, bool), private
|
||||
assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues
|
||||
assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
|
||||
assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
|
||||
assert team_id is github.GithubObject.NotSet or isinstance(team_id, github.Team.Team), team_id
|
||||
assert auto_init is github.GithubObject.NotSet or isinstance(auto_init, bool), auto_init
|
||||
assert gitignore_template is github.GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
}
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if homepage is not GithubObject.NotSet:
|
||||
if homepage is not github.GithubObject.NotSet:
|
||||
post_parameters["homepage"] = homepage
|
||||
if private is not GithubObject.NotSet:
|
||||
if private is not github.GithubObject.NotSet:
|
||||
post_parameters["private"] = private
|
||||
if has_issues is not GithubObject.NotSet:
|
||||
if has_issues is not github.GithubObject.NotSet:
|
||||
post_parameters["has_issues"] = has_issues
|
||||
if has_wiki is not GithubObject.NotSet:
|
||||
if has_wiki is not github.GithubObject.NotSet:
|
||||
post_parameters["has_wiki"] = has_wiki
|
||||
if has_downloads is not GithubObject.NotSet:
|
||||
if has_downloads is not github.GithubObject.NotSet:
|
||||
post_parameters["has_downloads"] = has_downloads
|
||||
if team_id is not GithubObject.NotSet:
|
||||
if team_id is not github.GithubObject.NotSet:
|
||||
post_parameters["team_id"] = team_id._identity
|
||||
if auto_init is not GithubObject.NotSet:
|
||||
if auto_init is not github.GithubObject.NotSet:
|
||||
post_parameters["auto_init"] = auto_init
|
||||
if gitignore_template is not GithubObject.NotSet:
|
||||
if gitignore_template is not github.GithubObject.NotSet:
|
||||
post_parameters["gitignore_template"] = gitignore_template
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -204,18 +204,18 @@ class Organization(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
|
||||
def create_team(self, name, repo_names=GithubObject.NotSet, permission=GithubObject.NotSet):
|
||||
def create_team(self, name, repo_names=github.GithubObject.NotSet, permission=github.GithubObject.NotSet):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert repo_names is GithubObject.NotSet or all(isinstance(element, Repository.Repository) for element in repo_names), repo_names
|
||||
assert permission is GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
|
||||
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, unicode)), permission
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
}
|
||||
if repo_names is not GithubObject.NotSet:
|
||||
if repo_names is not github.GithubObject.NotSet:
|
||||
post_parameters["repo_names"] = [element._identity for element in repo_names]
|
||||
if permission is not GithubObject.NotSet:
|
||||
if permission is not github.GithubObject.NotSet:
|
||||
post_parameters["permission"] = permission
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -223,27 +223,27 @@ class Organization(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Team.Team(self._requester, data, completed=True)
|
||||
return github.Team.Team(self._requester, data, completed=True)
|
||||
|
||||
def edit(self, billing_email=GithubObject.NotSet, blog=GithubObject.NotSet, company=GithubObject.NotSet, email=GithubObject.NotSet, location=GithubObject.NotSet, name=GithubObject.NotSet):
|
||||
assert billing_email is GithubObject.NotSet or isinstance(billing_email, (str, unicode)), billing_email
|
||||
assert blog is GithubObject.NotSet or isinstance(blog, (str, unicode)), blog
|
||||
assert company is GithubObject.NotSet or isinstance(company, (str, unicode)), company
|
||||
assert email is GithubObject.NotSet or isinstance(email, (str, unicode)), email
|
||||
assert location is GithubObject.NotSet or isinstance(location, (str, unicode)), location
|
||||
assert name is GithubObject.NotSet or isinstance(name, (str, unicode)), name
|
||||
def edit(self, billing_email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, email=github.GithubObject.NotSet, location=github.GithubObject.NotSet, name=github.GithubObject.NotSet):
|
||||
assert billing_email is github.GithubObject.NotSet or isinstance(billing_email, (str, unicode)), billing_email
|
||||
assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog
|
||||
assert company is github.GithubObject.NotSet or isinstance(company, (str, unicode)), company
|
||||
assert email is github.GithubObject.NotSet or isinstance(email, (str, unicode)), email
|
||||
assert location is github.GithubObject.NotSet or isinstance(location, (str, unicode)), location
|
||||
assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name
|
||||
post_parameters = dict()
|
||||
if billing_email is not GithubObject.NotSet:
|
||||
if billing_email is not github.GithubObject.NotSet:
|
||||
post_parameters["billing_email"] = billing_email
|
||||
if blog is not GithubObject.NotSet:
|
||||
if blog is not github.GithubObject.NotSet:
|
||||
post_parameters["blog"] = blog
|
||||
if company is not GithubObject.NotSet:
|
||||
if company is not github.GithubObject.NotSet:
|
||||
post_parameters["company"] = company
|
||||
if email is not GithubObject.NotSet:
|
||||
if email is not github.GithubObject.NotSet:
|
||||
post_parameters["email"] = email
|
||||
if location is not GithubObject.NotSet:
|
||||
if location is not github.GithubObject.NotSet:
|
||||
post_parameters["location"] = location
|
||||
if name is not GithubObject.NotSet:
|
||||
if name is not github.GithubObject.NotSet:
|
||||
post_parameters["name"] = name
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -254,24 +254,24 @@ class Organization(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_members(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/members",
|
||||
None
|
||||
)
|
||||
|
||||
def get_public_members(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/public_members",
|
||||
None
|
||||
@@ -285,15 +285,15 @@ class Organization(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Repository.Repository(self._requester, data, completed=True)
|
||||
return github.Repository.Repository(self._requester, data, completed=True)
|
||||
|
||||
def get_repos(self, type=GithubObject.NotSet):
|
||||
assert type is GithubObject.NotSet or isinstance(type, (str, unicode)), type
|
||||
def get_repos(self, type=github.GithubObject.NotSet):
|
||||
assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type
|
||||
url_parameters = dict()
|
||||
if type is not GithubObject.NotSet:
|
||||
if type is not github.GithubObject.NotSet:
|
||||
url_parameters["type"] = type
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/repos",
|
||||
url_parameters
|
||||
@@ -307,18 +307,18 @@ class Organization(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Team.Team(self._requester, data, completed=True)
|
||||
return github.Team.Team(self._requester, data, completed=True)
|
||||
|
||||
def get_teams(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Team.Team,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Team.Team,
|
||||
self._requester,
|
||||
self.url + "/teams",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_members(self, member):
|
||||
assert isinstance(member, NamedUser.NamedUser), member
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
self.url + "/members/" + member._identity,
|
||||
@@ -328,7 +328,7 @@ class Organization(GithubObject.GithubObject):
|
||||
return status == 204
|
||||
|
||||
def has_in_public_members(self, public_member):
|
||||
assert isinstance(public_member, NamedUser.NamedUser), public_member
|
||||
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
self.url + "/public_members/" + public_member._identity,
|
||||
@@ -338,7 +338,7 @@ class Organization(GithubObject.GithubObject):
|
||||
return status == 204
|
||||
|
||||
def remove_from_members(self, member):
|
||||
assert isinstance(member, NamedUser.NamedUser), member
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/members/" + member._identity,
|
||||
@@ -347,7 +347,7 @@ class Organization(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def remove_from_public_members(self, public_member):
|
||||
assert isinstance(public_member, NamedUser.NamedUser), public_member
|
||||
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/public_members/" + public_member._identity,
|
||||
@@ -356,30 +356,30 @@ class Organization(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._avatar_url = GithubObject.NotSet
|
||||
self._billing_email = GithubObject.NotSet
|
||||
self._blog = GithubObject.NotSet
|
||||
self._collaborators = GithubObject.NotSet
|
||||
self._company = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._disk_usage = GithubObject.NotSet
|
||||
self._email = GithubObject.NotSet
|
||||
self._followers = GithubObject.NotSet
|
||||
self._following = GithubObject.NotSet
|
||||
self._gravatar_id = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._location = GithubObject.NotSet
|
||||
self._login = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._owned_private_repos = GithubObject.NotSet
|
||||
self._plan = GithubObject.NotSet
|
||||
self._private_gists = GithubObject.NotSet
|
||||
self._public_gists = GithubObject.NotSet
|
||||
self._public_repos = GithubObject.NotSet
|
||||
self._total_private_repos = GithubObject.NotSet
|
||||
self._type = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._avatar_url = github.GithubObject.NotSet
|
||||
self._billing_email = github.GithubObject.NotSet
|
||||
self._blog = github.GithubObject.NotSet
|
||||
self._collaborators = github.GithubObject.NotSet
|
||||
self._company = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._disk_usage = github.GithubObject.NotSet
|
||||
self._email = github.GithubObject.NotSet
|
||||
self._followers = github.GithubObject.NotSet
|
||||
self._following = github.GithubObject.NotSet
|
||||
self._gravatar_id = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._location = github.GithubObject.NotSet
|
||||
self._login = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._owned_private_repos = github.GithubObject.NotSet
|
||||
self._plan = github.GithubObject.NotSet
|
||||
self._private_gists = github.GithubObject.NotSet
|
||||
self._public_gists = github.GithubObject.NotSet
|
||||
self._public_repos = github.GithubObject.NotSet
|
||||
self._total_private_repos = github.GithubObject.NotSet
|
||||
self._type = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "avatar_url" in attributes: # pragma no branch
|
||||
@@ -435,7 +435,7 @@ class Organization(GithubObject.GithubObject):
|
||||
self._owned_private_repos = attributes["owned_private_repos"]
|
||||
if "plan" in attributes: # pragma no branch
|
||||
assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"]
|
||||
self._plan = None if attributes["plan"] is None else Plan.Plan(self._requester, attributes["plan"], completed=False)
|
||||
self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False)
|
||||
if "private_gists" in attributes: # pragma no branch
|
||||
assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"]
|
||||
self._private_gists = attributes["private_gists"]
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class PaginatedListBase:
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class Permissions(GithubObject.BasicGithubObject):
|
||||
class Permissions(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def admin(self):
|
||||
return self._NoneIfNotSet(self._admin)
|
||||
@@ -30,9 +30,9 @@ class Permissions(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._push)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._admin = GithubObject.NotSet
|
||||
self._pull = GithubObject.NotSet
|
||||
self._push = GithubObject.NotSet
|
||||
self._admin = github.GithubObject.NotSet
|
||||
self._pull = github.GithubObject.NotSet
|
||||
self._push = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "admin" in attributes: # pragma no branch
|
||||
|
||||
+6
-6
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class Plan(GithubObject.BasicGithubObject):
|
||||
class Plan(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def collaborators(self):
|
||||
return self._NoneIfNotSet(self._collaborators)
|
||||
@@ -34,10 +34,10 @@ class Plan(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._space)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._collaborators = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._private_repos = GithubObject.NotSet
|
||||
self._space = GithubObject.NotSet
|
||||
self._collaborators = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._private_repos = github.GithubObject.NotSet
|
||||
self._space = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "collaborators" in attributes: # pragma no branch
|
||||
|
||||
+66
-66
@@ -13,19 +13,19 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import PullRequestMergeStatus
|
||||
import NamedUser
|
||||
import PullRequestPart
|
||||
import PullRequestComment
|
||||
import File
|
||||
import IssueComment
|
||||
import Commit
|
||||
import github.PullRequestMergeStatus
|
||||
import github.NamedUser
|
||||
import github.PullRequestPart
|
||||
import github.PullRequestComment
|
||||
import github.File
|
||||
import github.IssueComment
|
||||
import github.Commit
|
||||
|
||||
|
||||
class PullRequest(GithubObject.GithubObject):
|
||||
class PullRequest(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def additions(self):
|
||||
self._completeIfNotSet(self._additions)
|
||||
@@ -166,7 +166,7 @@ class PullRequest(GithubObject.GithubObject):
|
||||
|
||||
def create_review_comment(self, body, commit_id, path, position):
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
assert isinstance(commit_id, Commit.Commit), commit_id
|
||||
assert isinstance(commit_id, github.Commit.Commit), commit_id
|
||||
assert isinstance(path, (str, unicode)), path
|
||||
assert isinstance(position, (int, long)), position
|
||||
post_parameters = {
|
||||
@@ -181,7 +181,7 @@ class PullRequest(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return PullRequestComment.PullRequestComment(self._requester, data, completed=True)
|
||||
return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True)
|
||||
|
||||
def create_issue_comment(self, body):
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
@@ -194,18 +194,18 @@ class PullRequest(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
return github.IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
|
||||
def edit(self, title=GithubObject.NotSet, body=GithubObject.NotSet, state=GithubObject.NotSet):
|
||||
assert title is GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert body is GithubObject.NotSet or isinstance(body, (str, unicode)), body
|
||||
assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, state=github.GithubObject.NotSet):
|
||||
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
post_parameters = dict()
|
||||
if title is not GithubObject.NotSet:
|
||||
if title is not github.GithubObject.NotSet:
|
||||
post_parameters["title"] = title
|
||||
if body is not GithubObject.NotSet:
|
||||
if body is not github.GithubObject.NotSet:
|
||||
post_parameters["body"] = body
|
||||
if state is not GithubObject.NotSet:
|
||||
if state is not github.GithubObject.NotSet:
|
||||
post_parameters["state"] = state
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -226,30 +226,30 @@ class PullRequest(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PullRequestComment.PullRequestComment(self._requester, data, completed=True)
|
||||
return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
return self.get_review_comments()
|
||||
|
||||
def get_review_comments(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
PullRequestComment.PullRequestComment,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.PullRequestComment.PullRequestComment,
|
||||
self._requester,
|
||||
self.url + "/comments",
|
||||
None
|
||||
)
|
||||
|
||||
def get_commits(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Commit.Commit,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Commit.Commit,
|
||||
self._requester,
|
||||
self.url + "/commits",
|
||||
None
|
||||
)
|
||||
|
||||
def get_files(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
File.File,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.File.File,
|
||||
self._requester,
|
||||
self.url + "/files",
|
||||
None
|
||||
@@ -263,11 +263,11 @@ class PullRequest(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
return github.IssueComment.IssueComment(self._requester, data, completed=True)
|
||||
|
||||
def get_issue_comments(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueComment.IssueComment,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.IssueComment.IssueComment,
|
||||
self._requester,
|
||||
self._parentUrl(self._parentUrl(self.url)) + "/issues/" + str(self.number) + "/comments",
|
||||
None
|
||||
@@ -282,10 +282,10 @@ class PullRequest(GithubObject.GithubObject):
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def merge(self, commit_message=GithubObject.NotSet):
|
||||
assert commit_message is GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message
|
||||
def merge(self, commit_message=github.GithubObject.NotSet):
|
||||
assert commit_message is github.GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message
|
||||
post_parameters = dict()
|
||||
if commit_message is not GithubObject.NotSet:
|
||||
if commit_message is not github.GithubObject.NotSet:
|
||||
post_parameters["commit_message"] = commit_message
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
@@ -293,36 +293,36 @@ class PullRequest(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return PullRequestMergeStatus.PullRequestMergeStatus(self._requester, data, completed=True)
|
||||
return github.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, data, completed=True)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._additions = GithubObject.NotSet
|
||||
self._assignee = GithubObject.NotSet
|
||||
self._base = GithubObject.NotSet
|
||||
self._body = GithubObject.NotSet
|
||||
self._changed_files = GithubObject.NotSet
|
||||
self._closed_at = GithubObject.NotSet
|
||||
self._comments = GithubObject.NotSet
|
||||
self._commits = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._deletions = GithubObject.NotSet
|
||||
self._diff_url = GithubObject.NotSet
|
||||
self._head = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._issue_url = GithubObject.NotSet
|
||||
self._mergeable = GithubObject.NotSet
|
||||
self._merged = GithubObject.NotSet
|
||||
self._merged_at = GithubObject.NotSet
|
||||
self._merged_by = GithubObject.NotSet
|
||||
self._number = GithubObject.NotSet
|
||||
self._patch_url = GithubObject.NotSet
|
||||
self._review_comments = GithubObject.NotSet
|
||||
self._state = GithubObject.NotSet
|
||||
self._title = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._user = GithubObject.NotSet
|
||||
self._additions = github.GithubObject.NotSet
|
||||
self._assignee = github.GithubObject.NotSet
|
||||
self._base = github.GithubObject.NotSet
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._changed_files = github.GithubObject.NotSet
|
||||
self._closed_at = github.GithubObject.NotSet
|
||||
self._comments = github.GithubObject.NotSet
|
||||
self._commits = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._deletions = github.GithubObject.NotSet
|
||||
self._diff_url = github.GithubObject.NotSet
|
||||
self._head = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._issue_url = github.GithubObject.NotSet
|
||||
self._mergeable = github.GithubObject.NotSet
|
||||
self._merged = github.GithubObject.NotSet
|
||||
self._merged_at = github.GithubObject.NotSet
|
||||
self._merged_by = github.GithubObject.NotSet
|
||||
self._number = github.GithubObject.NotSet
|
||||
self._patch_url = github.GithubObject.NotSet
|
||||
self._review_comments = github.GithubObject.NotSet
|
||||
self._state = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "additions" in attributes: # pragma no branch
|
||||
@@ -330,10 +330,10 @@ class PullRequest(GithubObject.GithubObject):
|
||||
self._additions = attributes["additions"]
|
||||
if "assignee" in attributes: # pragma no branch
|
||||
assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"]
|
||||
self._assignee = None if attributes["assignee"] is None else NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False)
|
||||
self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False)
|
||||
if "base" in attributes: # pragma no branch
|
||||
assert attributes["base"] is None or isinstance(attributes["base"], dict), attributes["base"]
|
||||
self._base = None if attributes["base"] is None else PullRequestPart.PullRequestPart(self._requester, attributes["base"], completed=False)
|
||||
self._base = None if attributes["base"] is None else github.PullRequestPart.PullRequestPart(self._requester, attributes["base"], completed=False)
|
||||
if "body" in attributes: # pragma no branch
|
||||
assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
|
||||
self._body = attributes["body"]
|
||||
@@ -360,7 +360,7 @@ class PullRequest(GithubObject.GithubObject):
|
||||
self._diff_url = attributes["diff_url"]
|
||||
if "head" in attributes: # pragma no branch
|
||||
assert attributes["head"] is None or isinstance(attributes["head"], dict), attributes["head"]
|
||||
self._head = None if attributes["head"] is None else PullRequestPart.PullRequestPart(self._requester, attributes["head"], completed=False)
|
||||
self._head = None if attributes["head"] is None else github.PullRequestPart.PullRequestPart(self._requester, attributes["head"], completed=False)
|
||||
if "html_url" in attributes: # pragma no branch
|
||||
assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"]
|
||||
self._html_url = attributes["html_url"]
|
||||
@@ -381,7 +381,7 @@ class PullRequest(GithubObject.GithubObject):
|
||||
self._merged_at = self._parseDatetime(attributes["merged_at"])
|
||||
if "merged_by" in attributes: # pragma no branch
|
||||
assert attributes["merged_by"] is None or isinstance(attributes["merged_by"], dict), attributes["merged_by"]
|
||||
self._merged_by = None if attributes["merged_by"] is None else NamedUser.NamedUser(self._requester, attributes["merged_by"], completed=False)
|
||||
self._merged_by = None if attributes["merged_by"] is None else github.NamedUser.NamedUser(self._requester, attributes["merged_by"], completed=False)
|
||||
if "number" in attributes: # pragma no branch
|
||||
assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"]
|
||||
self._number = attributes["number"]
|
||||
@@ -405,4 +405,4 @@ class PullRequest(GithubObject.GithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import NamedUser
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class PullRequestComment(GithubObject.GithubObject):
|
||||
class PullRequestComment(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def body(self):
|
||||
self._completeIfNotSet(self._body)
|
||||
@@ -96,17 +96,17 @@ class PullRequestComment(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = GithubObject.NotSet
|
||||
self._commit_id = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._original_commit_id = GithubObject.NotSet
|
||||
self._original_position = GithubObject.NotSet
|
||||
self._path = GithubObject.NotSet
|
||||
self._position = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._user = GithubObject.NotSet
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._commit_id = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._original_commit_id = github.GithubObject.NotSet
|
||||
self._original_position = github.GithubObject.NotSet
|
||||
self._path = github.GithubObject.NotSet
|
||||
self._position = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "body" in attributes: # pragma no branch
|
||||
@@ -141,4 +141,4 @@ class PullRequestComment(GithubObject.GithubObject):
|
||||
self._url = attributes["url"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class PullRequestMergeStatus(GithubObject.BasicGithubObject):
|
||||
class PullRequestMergeStatus(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def merged(self):
|
||||
return self._NoneIfNotSet(self._merged)
|
||||
@@ -30,9 +30,9 @@ class PullRequestMergeStatus(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._sha)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._merged = GithubObject.NotSet
|
||||
self._message = GithubObject.NotSet
|
||||
self._sha = GithubObject.NotSet
|
||||
self._merged = github.GithubObject.NotSet
|
||||
self._message = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "merged" in attributes: # pragma no branch
|
||||
|
||||
+11
-11
@@ -13,13 +13,13 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import Repository
|
||||
import NamedUser
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class PullRequestPart(GithubObject.BasicGithubObject):
|
||||
class PullRequestPart(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def label(self):
|
||||
return self._NoneIfNotSet(self._label)
|
||||
@@ -41,11 +41,11 @@ class PullRequestPart(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._user)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._label = GithubObject.NotSet
|
||||
self._ref = GithubObject.NotSet
|
||||
self._repo = GithubObject.NotSet
|
||||
self._sha = GithubObject.NotSet
|
||||
self._user = GithubObject.NotSet
|
||||
self._label = github.GithubObject.NotSet
|
||||
self._ref = github.GithubObject.NotSet
|
||||
self._repo = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "label" in attributes: # pragma no branch
|
||||
@@ -56,10 +56,10 @@ class PullRequestPart(GithubObject.BasicGithubObject):
|
||||
self._ref = attributes["ref"]
|
||||
if "repo" in attributes: # pragma no branch
|
||||
assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"]
|
||||
self._repo = None if attributes["repo"] is None else Repository.Repository(self._requester, attributes["repo"], completed=False)
|
||||
self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, attributes["repo"], completed=False)
|
||||
if "sha" in attributes: # pragma no branch
|
||||
assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"]
|
||||
self._sha = attributes["sha"]
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
|
||||
|
||||
+241
-243
@@ -16,40 +16,38 @@
|
||||
import urllib
|
||||
import datetime
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import Branch
|
||||
import IssueEvent
|
||||
import ContentFile
|
||||
import Label
|
||||
import InputGitAuthor
|
||||
import GitBlob
|
||||
import Organization
|
||||
import GitRef
|
||||
import Issue
|
||||
import Repository
|
||||
import PullRequest
|
||||
import RepositoryKey
|
||||
import NamedUser
|
||||
import Milestone
|
||||
import InputGitTreeElement
|
||||
import Comparison
|
||||
import CommitComment
|
||||
import GitCommit
|
||||
import Team
|
||||
import Commit
|
||||
import GitTree
|
||||
import Hook
|
||||
import Tag
|
||||
import GitTag
|
||||
import Download
|
||||
import Permissions
|
||||
import Event
|
||||
import Legacy
|
||||
import github.Branch
|
||||
import github.IssueEvent
|
||||
import github.ContentFile
|
||||
import github.Label
|
||||
import github.GitBlob
|
||||
import github.Organization
|
||||
import github.GitRef
|
||||
import github.Issue
|
||||
import github.Repository
|
||||
import github.PullRequest
|
||||
import github.RepositoryKey
|
||||
import github.NamedUser
|
||||
import github.Milestone
|
||||
import github.Comparison
|
||||
import github.CommitComment
|
||||
import github.GitCommit
|
||||
import github.Team
|
||||
import github.Commit
|
||||
import github.GitTree
|
||||
import github.Hook
|
||||
import github.Tag
|
||||
import github.GitTag
|
||||
import github.Download
|
||||
import github.Permissions
|
||||
import github.Event
|
||||
import github.Legacy
|
||||
|
||||
|
||||
class Repository(GithubObject.GithubObject):
|
||||
class Repository(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def clone_url(self):
|
||||
self._completeIfNotSet(self._clone_url)
|
||||
@@ -201,7 +199,7 @@ class Repository(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._watchers)
|
||||
|
||||
def add_to_collaborators(self, collaborator):
|
||||
assert isinstance(collaborator, NamedUser.NamedUser), collaborator
|
||||
assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
self.url + "/collaborators/" + collaborator._identity,
|
||||
@@ -218,20 +216,20 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Comparison.Comparison(self._requester, data, completed=True)
|
||||
return github.Comparison.Comparison(self._requester, data, completed=True)
|
||||
|
||||
def create_download(self, name, size, description=GithubObject.NotSet, content_type=GithubObject.NotSet):
|
||||
def create_download(self, name, size, description=github.GithubObject.NotSet, content_type=github.GithubObject.NotSet):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert isinstance(size, (int, long)), size
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert content_type is GithubObject.NotSet or isinstance(content_type, (str, unicode)), content_type
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert content_type is github.GithubObject.NotSet or isinstance(content_type, (str, unicode)), content_type
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
"size": size,
|
||||
}
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if content_type is not GithubObject.NotSet:
|
||||
if content_type is not github.GithubObject.NotSet:
|
||||
post_parameters["content_type"] = content_type
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -239,7 +237,7 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Download.Download(self._requester, data, completed=True)
|
||||
return github.Download.Download(self._requester, data, completed=True)
|
||||
|
||||
def create_git_blob(self, content, encoding):
|
||||
assert isinstance(content, (str, unicode)), content
|
||||
@@ -254,22 +252,22 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return GitBlob.GitBlob(self._requester, data, completed=True)
|
||||
return github.GitBlob.GitBlob(self._requester, data, completed=True)
|
||||
|
||||
def create_git_commit(self, message, tree, parents, author=GithubObject.NotSet, committer=GithubObject.NotSet):
|
||||
def create_git_commit(self, message, tree, parents, author=github.GithubObject.NotSet, committer=github.GithubObject.NotSet):
|
||||
assert isinstance(message, (str, unicode)), message
|
||||
assert isinstance(tree, GitTree.GitTree), tree
|
||||
assert all(isinstance(element, GitCommit.GitCommit) for element in parents), parents
|
||||
assert author is GithubObject.NotSet or isinstance(author, InputGitAuthor.InputGitAuthor), author
|
||||
assert committer is GithubObject.NotSet or isinstance(committer, InputGitAuthor.InputGitAuthor), committer
|
||||
assert isinstance(tree, github.GitTree.GitTree), tree
|
||||
assert all(isinstance(element, github.GitCommit.GitCommit) for element in parents), parents
|
||||
assert author is github.GithubObject.NotSet or isinstance(author, github.InputGitAuthor), author
|
||||
assert committer is github.GithubObject.NotSet or isinstance(committer, github.InputGitAuthor), committer
|
||||
post_parameters = {
|
||||
"message": message,
|
||||
"tree": tree._identity,
|
||||
"parents": [element._identity for element in parents],
|
||||
}
|
||||
if author is not GithubObject.NotSet:
|
||||
if author is not github.GithubObject.NotSet:
|
||||
post_parameters["author"] = author._identity
|
||||
if committer is not GithubObject.NotSet:
|
||||
if committer is not github.GithubObject.NotSet:
|
||||
post_parameters["committer"] = committer._identity
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -277,7 +275,7 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return GitCommit.GitCommit(self._requester, data, completed=True)
|
||||
return github.GitCommit.GitCommit(self._requester, data, completed=True)
|
||||
|
||||
def create_git_ref(self, ref, sha):
|
||||
assert isinstance(ref, (str, unicode)), ref
|
||||
@@ -292,21 +290,21 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return GitRef.GitRef(self._requester, data, completed=True)
|
||||
return github.GitRef.GitRef(self._requester, data, completed=True)
|
||||
|
||||
def create_git_tag(self, tag, message, object, type, tagger=GithubObject.NotSet):
|
||||
def create_git_tag(self, tag, message, object, type, tagger=github.GithubObject.NotSet):
|
||||
assert isinstance(tag, (str, unicode)), tag
|
||||
assert isinstance(message, (str, unicode)), message
|
||||
assert isinstance(object, (str, unicode)), object
|
||||
assert isinstance(type, (str, unicode)), type
|
||||
assert tagger is GithubObject.NotSet or isinstance(tagger, InputGitAuthor.InputGitAuthor), tagger
|
||||
assert tagger is github.GithubObject.NotSet or isinstance(tagger, github.InputGitAuthor), tagger
|
||||
post_parameters = {
|
||||
"tag": tag,
|
||||
"message": message,
|
||||
"object": object,
|
||||
"type": type,
|
||||
}
|
||||
if tagger is not GithubObject.NotSet:
|
||||
if tagger is not github.GithubObject.NotSet:
|
||||
post_parameters["tagger"] = tagger._identity
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -314,15 +312,15 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return GitTag.GitTag(self._requester, data, completed=True)
|
||||
return github.GitTag.GitTag(self._requester, data, completed=True)
|
||||
|
||||
def create_git_tree(self, tree, base_tree=GithubObject.NotSet):
|
||||
assert all(isinstance(element, InputGitTreeElement.InputGitTreeElement) for element in tree), tree
|
||||
assert base_tree is GithubObject.NotSet or isinstance(base_tree, GitTree.GitTree), base_tree
|
||||
def create_git_tree(self, tree, base_tree=github.GithubObject.NotSet):
|
||||
assert all(isinstance(element, github.InputGitTreeElement) for element in tree), tree
|
||||
assert base_tree is github.GithubObject.NotSet or isinstance(base_tree, github.GitTree.GitTree), base_tree
|
||||
post_parameters = {
|
||||
"tree": [element._identity for element in tree],
|
||||
}
|
||||
if base_tree is not GithubObject.NotSet:
|
||||
if base_tree is not github.GithubObject.NotSet:
|
||||
post_parameters["base_tree"] = base_tree._identity
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -330,20 +328,20 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return GitTree.GitTree(self._requester, data, completed=True)
|
||||
return github.GitTree.GitTree(self._requester, data, completed=True)
|
||||
|
||||
def create_hook(self, name, config, events=GithubObject.NotSet, active=GithubObject.NotSet):
|
||||
def create_hook(self, name, config, events=github.GithubObject.NotSet, active=github.GithubObject.NotSet):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert isinstance(config, dict), config
|
||||
assert events is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events
|
||||
assert active is GithubObject.NotSet or isinstance(active, bool), active
|
||||
assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events
|
||||
assert active is github.GithubObject.NotSet or isinstance(active, bool), active
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
"config": config,
|
||||
}
|
||||
if events is not GithubObject.NotSet:
|
||||
if events is not github.GithubObject.NotSet:
|
||||
post_parameters["events"] = events
|
||||
if active is not GithubObject.NotSet:
|
||||
if active is not github.GithubObject.NotSet:
|
||||
post_parameters["active"] = active
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -351,24 +349,24 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Hook.Hook(self._requester, data, completed=True)
|
||||
return github.Hook.Hook(self._requester, data, completed=True)
|
||||
|
||||
def create_issue(self, title, body=GithubObject.NotSet, assignee=GithubObject.NotSet, milestone=GithubObject.NotSet, labels=GithubObject.NotSet):
|
||||
def create_issue(self, title, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet):
|
||||
assert isinstance(title, (str, unicode)), title
|
||||
assert body is GithubObject.NotSet or isinstance(body, (str, unicode)), body
|
||||
assert assignee is GithubObject.NotSet or isinstance(assignee, NamedUser.NamedUser), assignee
|
||||
assert milestone is GithubObject.NotSet or isinstance(milestone, Milestone.Milestone), milestone
|
||||
assert labels is GithubObject.NotSet or all(isinstance(element, Label.Label) for element in labels), labels
|
||||
assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
|
||||
assert assignee is github.GithubObject.NotSet or isinstance(assignee, github.NamedUser.NamedUser), assignee
|
||||
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) for element in labels), labels
|
||||
post_parameters = {
|
||||
"title": title,
|
||||
}
|
||||
if body is not GithubObject.NotSet:
|
||||
if body is not github.GithubObject.NotSet:
|
||||
post_parameters["body"] = body
|
||||
if assignee is not GithubObject.NotSet:
|
||||
if assignee is not github.GithubObject.NotSet:
|
||||
post_parameters["assignee"] = assignee._identity
|
||||
if milestone is not GithubObject.NotSet:
|
||||
if milestone is not github.GithubObject.NotSet:
|
||||
post_parameters["milestone"] = milestone._identity
|
||||
if labels is not GithubObject.NotSet:
|
||||
if labels is not github.GithubObject.NotSet:
|
||||
post_parameters["labels"] = [element.name for element in labels]
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -376,7 +374,7 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Issue.Issue(self._requester, data, completed=True)
|
||||
return github.Issue.Issue(self._requester, data, completed=True)
|
||||
|
||||
def create_key(self, title, key):
|
||||
assert isinstance(title, (str, unicode)), title
|
||||
@@ -391,7 +389,7 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url)
|
||||
return github.RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url)
|
||||
|
||||
def create_label(self, name, color):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
@@ -406,21 +404,21 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Label.Label(self._requester, data, completed=True)
|
||||
return github.Label.Label(self._requester, data, completed=True)
|
||||
|
||||
def create_milestone(self, title, state=GithubObject.NotSet, description=GithubObject.NotSet, due_on=GithubObject.NotSet):
|
||||
def create_milestone(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet):
|
||||
assert isinstance(title, (str, unicode)), title
|
||||
assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert due_on is GithubObject.NotSet or isinstance(due_on, datetime.date), due_on
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert due_on is github.GithubObject.NotSet or isinstance(due_on, datetime.date), due_on
|
||||
post_parameters = {
|
||||
"title": title,
|
||||
}
|
||||
if state is not GithubObject.NotSet:
|
||||
if state is not github.GithubObject.NotSet:
|
||||
post_parameters["state"] = state
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if due_on is not GithubObject.NotSet:
|
||||
if due_on is not github.GithubObject.NotSet:
|
||||
post_parameters["due_on"] = due_on.strftime("%Y-%m-%d")
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -428,7 +426,7 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return Milestone.Milestone(self._requester, data, completed=True)
|
||||
return github.Milestone.Milestone(self._requester, data, completed=True)
|
||||
|
||||
def create_pull(self, *args, **kwds):
|
||||
if len(args) + len(kwds) == 4:
|
||||
@@ -444,7 +442,7 @@ class Repository(GithubObject.GithubObject):
|
||||
return self.__create_pull(title=title, body=body, base=base, head=head)
|
||||
|
||||
def __create_pull_2(self, issue, base, head):
|
||||
assert isinstance(issue, Issue.Issue), issue
|
||||
assert isinstance(issue, github.Issue.Issue), issue
|
||||
assert isinstance(base, (str, unicode)), base
|
||||
assert isinstance(head, (str, unicode)), head
|
||||
return self.__create_pull(issue=issue._identity, base=base, head=head)
|
||||
@@ -457,7 +455,7 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return PullRequest.PullRequest(self._requester, data, completed=True)
|
||||
return github.PullRequest.PullRequest(self._requester, data, completed=True)
|
||||
|
||||
def delete(self):
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
@@ -467,31 +465,31 @@ class Repository(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, public=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, default_branch=GithubObject.NotSet):
|
||||
def edit(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, public=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert homepage is GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
|
||||
assert public is GithubObject.NotSet or isinstance(public, bool), public
|
||||
assert has_issues is GithubObject.NotSet or isinstance(has_issues, bool), has_issues
|
||||
assert has_wiki is GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
|
||||
assert has_downloads is GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
|
||||
assert default_branch is GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch
|
||||
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
|
||||
assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
|
||||
assert public is github.GithubObject.NotSet or isinstance(public, bool), public
|
||||
assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues
|
||||
assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
|
||||
assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
|
||||
assert default_branch is github.GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
}
|
||||
if description is not GithubObject.NotSet:
|
||||
if description is not github.GithubObject.NotSet:
|
||||
post_parameters["description"] = description
|
||||
if homepage is not GithubObject.NotSet:
|
||||
if homepage is not github.GithubObject.NotSet:
|
||||
post_parameters["homepage"] = homepage
|
||||
if public is not GithubObject.NotSet:
|
||||
if public is not github.GithubObject.NotSet:
|
||||
post_parameters["public"] = public
|
||||
if has_issues is not GithubObject.NotSet:
|
||||
if has_issues is not github.GithubObject.NotSet:
|
||||
post_parameters["has_issues"] = has_issues
|
||||
if has_wiki is not GithubObject.NotSet:
|
||||
if has_wiki is not github.GithubObject.NotSet:
|
||||
post_parameters["has_wiki"] = has_wiki
|
||||
if has_downloads is not GithubObject.NotSet:
|
||||
if has_downloads is not github.GithubObject.NotSet:
|
||||
post_parameters["has_downloads"] = has_downloads
|
||||
if default_branch is not GithubObject.NotSet:
|
||||
if default_branch is not github.GithubObject.NotSet:
|
||||
post_parameters["default_branch"] = default_branch
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -501,11 +499,11 @@ class Repository(GithubObject.GithubObject):
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_archive_link(self, archive_format, ref=GithubObject.NotSet):
|
||||
def get_archive_link(self, archive_format, ref=github.GithubObject.NotSet):
|
||||
assert isinstance(archive_format, (str, unicode)), archive_format
|
||||
assert ref is GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
|
||||
assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
|
||||
url = self.url + "/" + archive_format
|
||||
if ref is not GithubObject.NotSet:
|
||||
if ref is not github.GithubObject.NotSet:
|
||||
url += "/" + ref
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
@@ -516,8 +514,8 @@ class Repository(GithubObject.GithubObject):
|
||||
return headers["location"]
|
||||
|
||||
def get_assignees(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/assignees",
|
||||
None
|
||||
@@ -531,19 +529,19 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Branch.Branch(self._requester, data, completed=True)
|
||||
return github.Branch.Branch(self._requester, data, completed=True)
|
||||
|
||||
def get_branches(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Branch.Branch,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Branch.Branch,
|
||||
self._requester,
|
||||
self.url + "/branches",
|
||||
None
|
||||
)
|
||||
|
||||
def get_collaborators(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/collaborators",
|
||||
None
|
||||
@@ -557,11 +555,11 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return CommitComment.CommitComment(self._requester, data, completed=True)
|
||||
return github.CommitComment.CommitComment(self._requester, data, completed=True)
|
||||
|
||||
def get_comments(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
CommitComment.CommitComment,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.CommitComment.CommitComment,
|
||||
self._requester,
|
||||
self.url + "/comments",
|
||||
None
|
||||
@@ -575,18 +573,18 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Commit.Commit(self._requester, data, completed=True)
|
||||
return github.Commit.Commit(self._requester, data, completed=True)
|
||||
|
||||
def get_commits(self, sha=GithubObject.NotSet, path=GithubObject.NotSet):
|
||||
assert sha is GithubObject.NotSet or isinstance(sha, (str, unicode)), sha
|
||||
assert path is GithubObject.NotSet or isinstance(path, (str, unicode)), path
|
||||
def get_commits(self, sha=github.GithubObject.NotSet, path=github.GithubObject.NotSet):
|
||||
assert sha is github.GithubObject.NotSet or isinstance(sha, (str, unicode)), sha
|
||||
assert path is github.GithubObject.NotSet or isinstance(path, (str, unicode)), path
|
||||
url_parameters = dict()
|
||||
if sha is not GithubObject.NotSet:
|
||||
if sha is not github.GithubObject.NotSet:
|
||||
url_parameters["sha"] = sha
|
||||
if path is not GithubObject.NotSet:
|
||||
if path is not github.GithubObject.NotSet:
|
||||
url_parameters["path"] = path
|
||||
return PaginatedList.PaginatedList(
|
||||
Commit.Commit,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Commit.Commit,
|
||||
self._requester,
|
||||
self.url + "/commits",
|
||||
url_parameters
|
||||
@@ -604,11 +602,11 @@ class Repository(GithubObject.GithubObject):
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return ContentFile.ContentFile(self._requester, data, completed=True)
|
||||
return github.ContentFile.ContentFile(self._requester, data, completed=True)
|
||||
|
||||
def get_contributors(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/contributors",
|
||||
None
|
||||
@@ -622,26 +620,26 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Download.Download(self._requester, data, completed=True)
|
||||
return github.Download.Download(self._requester, data, completed=True)
|
||||
|
||||
def get_downloads(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Download.Download,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Download.Download,
|
||||
self._requester,
|
||||
self.url + "/downloads",
|
||||
None
|
||||
)
|
||||
|
||||
def get_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
self.url + "/events",
|
||||
None
|
||||
)
|
||||
|
||||
def get_forks(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
return github.PaginatedList.PaginatedList(
|
||||
Repository,
|
||||
self._requester,
|
||||
self.url + "/forks",
|
||||
@@ -656,7 +654,7 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return GitBlob.GitBlob(self._requester, data, completed=True)
|
||||
return github.GitBlob.GitBlob(self._requester, data, completed=True)
|
||||
|
||||
def get_git_commit(self, sha):
|
||||
assert isinstance(sha, (str, unicode)), sha
|
||||
@@ -666,7 +664,7 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return GitCommit.GitCommit(self._requester, data, completed=True)
|
||||
return github.GitCommit.GitCommit(self._requester, data, completed=True)
|
||||
|
||||
def get_git_ref(self, ref):
|
||||
prefix = "/git/refs/"
|
||||
@@ -679,11 +677,11 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return GitRef.GitRef(self._requester, data, completed=True)
|
||||
return github.GitRef.GitRef(self._requester, data, completed=True)
|
||||
|
||||
def get_git_refs(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
GitRef.GitRef,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.GitRef.GitRef,
|
||||
self._requester,
|
||||
self.url + "/git/refs",
|
||||
None
|
||||
@@ -697,13 +695,13 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return GitTag.GitTag(self._requester, data, completed=True)
|
||||
return github.GitTag.GitTag(self._requester, data, completed=True)
|
||||
|
||||
def get_git_tree(self, sha, recursive=GithubObject.NotSet):
|
||||
def get_git_tree(self, sha, recursive=github.GithubObject.NotSet):
|
||||
assert isinstance(sha, (str, unicode)), sha
|
||||
assert recursive is GithubObject.NotSet or isinstance(recursive, bool), recursive
|
||||
assert recursive is github.GithubObject.NotSet or isinstance(recursive, bool), recursive
|
||||
url_parameters = dict()
|
||||
if recursive is not GithubObject.NotSet:
|
||||
if recursive is not github.GithubObject.NotSet:
|
||||
url_parameters["recursive"] = recursive
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"GET",
|
||||
@@ -711,7 +709,7 @@ class Repository(GithubObject.GithubObject):
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
return GitTree.GitTree(self._requester, data, completed=True)
|
||||
return github.GitTree.GitTree(self._requester, data, completed=True)
|
||||
|
||||
def get_hook(self, id):
|
||||
assert isinstance(id, (int, long)), id
|
||||
@@ -721,11 +719,11 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Hook.Hook(self._requester, data, completed=True)
|
||||
return github.Hook.Hook(self._requester, data, completed=True)
|
||||
|
||||
def get_hooks(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Hook.Hook,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Hook.Hook,
|
||||
self._requester,
|
||||
self.url + "/hooks",
|
||||
None
|
||||
@@ -739,42 +737,42 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Issue.Issue(self._requester, data, completed=True)
|
||||
return github.Issue.Issue(self._requester, data, completed=True)
|
||||
|
||||
def get_issues(self, milestone=GithubObject.NotSet, state=GithubObject.NotSet, assignee=GithubObject.NotSet, mentioned=GithubObject.NotSet, labels=GithubObject.NotSet, sort=GithubObject.NotSet, direction=GithubObject.NotSet, since=GithubObject.NotSet):
|
||||
assert milestone is GithubObject.NotSet or milestone == "*" or milestone == "none" or isinstance(milestone, Milestone.Milestone), milestone
|
||||
assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert assignee is GithubObject.NotSet or assignee == "*" or assignee == "none" or isinstance(assignee, NamedUser.NamedUser), assignee
|
||||
assert mentioned is GithubObject.NotSet or isinstance(mentioned, NamedUser.NamedUser), mentioned
|
||||
assert labels is GithubObject.NotSet or all(isinstance(element, Label.Label) for element in labels), labels
|
||||
assert sort is GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
|
||||
assert direction is GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
|
||||
assert since is GithubObject.NotSet or isinstance(since, datetime.datetime), since
|
||||
def get_issues(self, milestone=github.GithubObject.NotSet, state=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, mentioned=github.GithubObject.NotSet, labels=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet):
|
||||
assert milestone is github.GithubObject.NotSet or milestone == "*" or milestone == "none" or isinstance(milestone, github.Milestone.Milestone), milestone
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert assignee is github.GithubObject.NotSet or assignee == "*" or assignee == "none" or isinstance(assignee, github.NamedUser.NamedUser), assignee
|
||||
assert mentioned is github.GithubObject.NotSet or isinstance(mentioned, github.NamedUser.NamedUser), mentioned
|
||||
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, unicode)), sort
|
||||
assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
|
||||
assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
|
||||
url_parameters = dict()
|
||||
if milestone is not GithubObject.NotSet:
|
||||
if milestone is not github.GithubObject.NotSet:
|
||||
if isinstance(milestone, str):
|
||||
url_parameters["milestone"] = milestone
|
||||
else:
|
||||
url_parameters["milestone"] = milestone._identity
|
||||
if state is not GithubObject.NotSet:
|
||||
if state is not github.GithubObject.NotSet:
|
||||
url_parameters["state"] = state
|
||||
if assignee is not GithubObject.NotSet:
|
||||
if assignee is not github.GithubObject.NotSet:
|
||||
if isinstance(assignee, str):
|
||||
url_parameters["assignee"] = assignee
|
||||
else:
|
||||
url_parameters["assignee"] = assignee._identity
|
||||
if mentioned is not GithubObject.NotSet:
|
||||
if mentioned is not github.GithubObject.NotSet:
|
||||
url_parameters["mentioned"] = mentioned._identity
|
||||
if labels is not GithubObject.NotSet:
|
||||
if labels is not github.GithubObject.NotSet:
|
||||
url_parameters["labels"] = ",".join(label.name for label in labels)
|
||||
if sort is not GithubObject.NotSet:
|
||||
if sort is not github.GithubObject.NotSet:
|
||||
url_parameters["sort"] = sort
|
||||
if direction is not GithubObject.NotSet:
|
||||
if direction is not github.GithubObject.NotSet:
|
||||
url_parameters["direction"] = direction
|
||||
if since is not GithubObject.NotSet:
|
||||
if since is not github.GithubObject.NotSet:
|
||||
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
return PaginatedList.PaginatedList(
|
||||
Issue.Issue,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Issue.Issue,
|
||||
self._requester,
|
||||
self.url + "/issues",
|
||||
url_parameters
|
||||
@@ -788,11 +786,11 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return IssueEvent.IssueEvent(self._requester, data, completed=True)
|
||||
return github.IssueEvent.IssueEvent(self._requester, data, completed=True)
|
||||
|
||||
def get_issues_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueEvent.IssueEvent,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.IssueEvent.IssueEvent,
|
||||
self._requester,
|
||||
self.url + "/issues/events",
|
||||
None
|
||||
@@ -806,11 +804,11 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url)
|
||||
return github.RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url)
|
||||
|
||||
def get_keys(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
lambda requester, data, completed: RepositoryKey.RepositoryKey(requester, data, completed, repoUrl=self._url),
|
||||
return github.PaginatedList.PaginatedList(
|
||||
lambda requester, data, completed: github.RepositoryKey.RepositoryKey(requester, data, completed, repoUrl=self._url),
|
||||
self._requester,
|
||||
self.url + "/keys",
|
||||
None
|
||||
@@ -824,11 +822,11 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Label.Label(self._requester, data, completed=True)
|
||||
return github.Label.Label(self._requester, data, completed=True)
|
||||
|
||||
def get_labels(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Label.Label,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Label.Label,
|
||||
self._requester,
|
||||
self.url + "/labels",
|
||||
None
|
||||
@@ -851,29 +849,29 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Milestone.Milestone(self._requester, data, completed=True)
|
||||
return github.Milestone.Milestone(self._requester, data, completed=True)
|
||||
|
||||
def get_milestones(self, state=GithubObject.NotSet, sort=GithubObject.NotSet, direction=GithubObject.NotSet):
|
||||
assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert sort is GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
|
||||
assert direction is GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
|
||||
def get_milestones(self, state=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet):
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
|
||||
assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
|
||||
url_parameters = dict()
|
||||
if state is not GithubObject.NotSet:
|
||||
if state is not github.GithubObject.NotSet:
|
||||
url_parameters["state"] = state
|
||||
if sort is not GithubObject.NotSet:
|
||||
if sort is not github.GithubObject.NotSet:
|
||||
url_parameters["sort"] = sort
|
||||
if direction is not GithubObject.NotSet:
|
||||
if direction is not github.GithubObject.NotSet:
|
||||
url_parameters["direction"] = direction
|
||||
return PaginatedList.PaginatedList(
|
||||
Milestone.Milestone,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Milestone.Milestone,
|
||||
self._requester,
|
||||
self.url + "/milestones",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_network_events(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Event.Event,
|
||||
self._requester,
|
||||
"/networks/" + self.owner.login + "/" + self.name + "/events",
|
||||
None
|
||||
@@ -887,15 +885,15 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return PullRequest.PullRequest(self._requester, data, completed=True)
|
||||
return github.PullRequest.PullRequest(self._requester, data, completed=True)
|
||||
|
||||
def get_pulls(self, state=GithubObject.NotSet):
|
||||
assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
def get_pulls(self, state=github.GithubObject.NotSet):
|
||||
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
|
||||
url_parameters = dict()
|
||||
if state is not GithubObject.NotSet:
|
||||
if state is not github.GithubObject.NotSet:
|
||||
url_parameters["state"] = state
|
||||
return PaginatedList.PaginatedList(
|
||||
PullRequest.PullRequest,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.PullRequest.PullRequest,
|
||||
self._requester,
|
||||
self.url + "/pulls",
|
||||
url_parameters
|
||||
@@ -908,50 +906,50 @@ class Repository(GithubObject.GithubObject):
|
||||
None,
|
||||
None
|
||||
)
|
||||
return ContentFile.ContentFile(self._requester, data, completed=True)
|
||||
return github.ContentFile.ContentFile(self._requester, data, completed=True)
|
||||
|
||||
def get_stargazers(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/stargazers",
|
||||
None
|
||||
)
|
||||
|
||||
def get_subscribers(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/subscribers",
|
||||
None
|
||||
)
|
||||
|
||||
def get_tags(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Tag.Tag,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Tag.Tag,
|
||||
self._requester,
|
||||
self.url + "/tags",
|
||||
None
|
||||
)
|
||||
|
||||
def get_teams(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Team.Team,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Team.Team,
|
||||
self._requester,
|
||||
self.url + "/teams",
|
||||
None
|
||||
)
|
||||
|
||||
def get_watchers(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/watchers",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_assignees(self, assignee):
|
||||
assert isinstance(assignee, NamedUser.NamedUser), assignee
|
||||
assert isinstance(assignee, github.NamedUser.NamedUser), assignee
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
self.url + "/assignees/" + assignee._identity,
|
||||
@@ -961,7 +959,7 @@ class Repository(GithubObject.GithubObject):
|
||||
return status == 204
|
||||
|
||||
def has_in_collaborators(self, collaborator):
|
||||
assert isinstance(collaborator, NamedUser.NamedUser), collaborator
|
||||
assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
self.url + "/collaborators/" + collaborator._identity,
|
||||
@@ -980,19 +978,19 @@ class Repository(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
return [
|
||||
Issue.Issue(self._requester, Legacy.convertIssue(element), completed=False)
|
||||
github.Issue.Issue(self._requester, github.Legacy.convertIssue(element), completed=False)
|
||||
for element in data["issues"]
|
||||
]
|
||||
|
||||
def merge(self, base, head, commit_message=GithubObject.NotSet):
|
||||
def merge(self, base, head, commit_message=github.GithubObject.NotSet):
|
||||
assert isinstance(base, (str, unicode)), base
|
||||
assert isinstance(head, (str, unicode)), head
|
||||
assert commit_message is GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message
|
||||
assert commit_message is github.GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message
|
||||
post_parameters = {
|
||||
"base": base,
|
||||
"head": head,
|
||||
}
|
||||
if commit_message is not GithubObject.NotSet:
|
||||
if commit_message is not github.GithubObject.NotSet:
|
||||
post_parameters["commit_message"] = commit_message
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"POST",
|
||||
@@ -1003,10 +1001,10 @@ class Repository(GithubObject.GithubObject):
|
||||
if data is None:
|
||||
return None
|
||||
else:
|
||||
return Commit.Commit(self._requester, data, completed=True)
|
||||
return github.Commit.Commit(self._requester, data, completed=True)
|
||||
|
||||
def remove_from_collaborators(self, collaborator):
|
||||
assert isinstance(collaborator, NamedUser.NamedUser), collaborator
|
||||
assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/collaborators/" + collaborator._identity,
|
||||
@@ -1019,36 +1017,36 @@ class Repository(GithubObject.GithubObject):
|
||||
return self.owner.login + "/" + self.name
|
||||
|
||||
def _initAttributes(self):
|
||||
self._clone_url = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
self._description = GithubObject.NotSet
|
||||
self._fork = GithubObject.NotSet
|
||||
self._forks = GithubObject.NotSet
|
||||
self._full_name = GithubObject.NotSet
|
||||
self._git_url = GithubObject.NotSet
|
||||
self._has_downloads = GithubObject.NotSet
|
||||
self._has_issues = GithubObject.NotSet
|
||||
self._has_wiki = GithubObject.NotSet
|
||||
self._homepage = GithubObject.NotSet
|
||||
self._html_url = GithubObject.NotSet
|
||||
self._id = GithubObject.NotSet
|
||||
self._language = GithubObject.NotSet
|
||||
self._master_branch = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._open_issues = GithubObject.NotSet
|
||||
self._organization = GithubObject.NotSet
|
||||
self._owner = GithubObject.NotSet
|
||||
self._parent = GithubObject.NotSet
|
||||
self._permissions = GithubObject.NotSet
|
||||
self._private = GithubObject.NotSet
|
||||
self._pushed_at = GithubObject.NotSet
|
||||
self._size = GithubObject.NotSet
|
||||
self._source = GithubObject.NotSet
|
||||
self._ssh_url = GithubObject.NotSet
|
||||
self._svn_url = GithubObject.NotSet
|
||||
self._updated_at = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._watchers = GithubObject.NotSet
|
||||
self._clone_url = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
self._description = github.GithubObject.NotSet
|
||||
self._fork = github.GithubObject.NotSet
|
||||
self._forks = github.GithubObject.NotSet
|
||||
self._full_name = github.GithubObject.NotSet
|
||||
self._git_url = github.GithubObject.NotSet
|
||||
self._has_downloads = github.GithubObject.NotSet
|
||||
self._has_issues = github.GithubObject.NotSet
|
||||
self._has_wiki = github.GithubObject.NotSet
|
||||
self._homepage = github.GithubObject.NotSet
|
||||
self._html_url = github.GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._language = github.GithubObject.NotSet
|
||||
self._master_branch = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._open_issues = github.GithubObject.NotSet
|
||||
self._organization = github.GithubObject.NotSet
|
||||
self._owner = github.GithubObject.NotSet
|
||||
self._parent = github.GithubObject.NotSet
|
||||
self._permissions = github.GithubObject.NotSet
|
||||
self._private = github.GithubObject.NotSet
|
||||
self._pushed_at = github.GithubObject.NotSet
|
||||
self._size = github.GithubObject.NotSet
|
||||
self._source = github.GithubObject.NotSet
|
||||
self._ssh_url = github.GithubObject.NotSet
|
||||
self._svn_url = github.GithubObject.NotSet
|
||||
self._updated_at = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._watchers = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "clone_url" in attributes: # pragma no branch
|
||||
@@ -1104,16 +1102,16 @@ class Repository(GithubObject.GithubObject):
|
||||
self._open_issues = attributes["open_issues"]
|
||||
if "organization" in attributes: # pragma no branch
|
||||
assert attributes["organization"] is None or isinstance(attributes["organization"], dict), attributes["organization"]
|
||||
self._organization = None if attributes["organization"] is None else Organization.Organization(self._requester, attributes["organization"], completed=False)
|
||||
self._organization = None if attributes["organization"] is None else github.Organization.Organization(self._requester, attributes["organization"], completed=False)
|
||||
if "owner" in attributes: # pragma no branch
|
||||
assert attributes["owner"] is None or isinstance(attributes["owner"], dict), attributes["owner"]
|
||||
self._owner = None if attributes["owner"] is None else NamedUser.NamedUser(self._requester, attributes["owner"], completed=False)
|
||||
self._owner = None if attributes["owner"] is None else github.NamedUser.NamedUser(self._requester, attributes["owner"], completed=False)
|
||||
if "parent" in attributes: # pragma no branch
|
||||
assert attributes["parent"] is None or isinstance(attributes["parent"], dict), attributes["parent"]
|
||||
self._parent = None if attributes["parent"] is None else Repository(self._requester, attributes["parent"], completed=False)
|
||||
if "permissions" in attributes: # pragma no branch
|
||||
assert attributes["permissions"] is None or isinstance(attributes["permissions"], dict), attributes["permissions"]
|
||||
self._permissions = None if attributes["permissions"] is None else Permissions.Permissions(self._requester, attributes["permissions"], completed=False)
|
||||
self._permissions = None if attributes["permissions"] is None else github.Permissions.Permissions(self._requester, attributes["permissions"], completed=False)
|
||||
if "private" in attributes: # pragma no branch
|
||||
assert attributes["private"] is None or isinstance(attributes["private"], bool), attributes["private"]
|
||||
self._private = attributes["private"]
|
||||
|
||||
+13
-13
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class RepositoryKey(GithubObject.GithubObject):
|
||||
class RepositoryKey(github.GithubObject.GithubObject):
|
||||
def __init__(self, requester, attributes, completed, repoUrl):
|
||||
GithubObject.GithubObject.__init__(self, requester, attributes, completed)
|
||||
github.GithubObject.GithubObject.__init__(self, requester, attributes, completed)
|
||||
self.__repoUrl = repoUrl
|
||||
|
||||
@property
|
||||
@@ -58,13 +58,13 @@ class RepositoryKey(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, title=GithubObject.NotSet, key=GithubObject.NotSet):
|
||||
assert title is GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert key is GithubObject.NotSet or isinstance(key, (str, unicode)), key
|
||||
def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet):
|
||||
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key
|
||||
post_parameters = dict()
|
||||
if title is not GithubObject.NotSet:
|
||||
if title is not github.GithubObject.NotSet:
|
||||
post_parameters["title"] = title
|
||||
if key is not GithubObject.NotSet:
|
||||
if key is not github.GithubObject.NotSet:
|
||||
post_parameters["key"] = key
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -75,11 +75,11 @@ class RepositoryKey(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._id = GithubObject.NotSet
|
||||
self._key = GithubObject.NotSet
|
||||
self._title = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._verified = GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._key = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._verified = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "id" in attributes: # pragma no branch
|
||||
|
||||
+5
-1
@@ -21,6 +21,7 @@ import urlparse
|
||||
import sys
|
||||
|
||||
atLeastPython26 = sys.hexversion >= 0x02060000
|
||||
atLeastPython3 = sys.hexversion >= 0x03000000
|
||||
|
||||
if atLeastPython26:
|
||||
import json
|
||||
@@ -42,7 +43,10 @@ class Requester:
|
||||
def __init__(self, login_or_token, password, base_url, timeout, client_id, client_secret, user_agent):
|
||||
if password is not None:
|
||||
login = login_or_token
|
||||
self.__authorizationHeader = "Basic " + base64.b64encode(login + ":" + password).replace('\n', '')
|
||||
if atLeastPython3:
|
||||
self.__authorizationHeader = "Basic " + str(base64.b64encode(bytearray(login + ":" + password, "utf-8"))).replace('\n', '') # pragma no cover
|
||||
else:
|
||||
self.__authorizationHeader = "Basic " + base64.b64encode(login + ":" + password).replace('\n', '')
|
||||
elif login_or_token is not None:
|
||||
token = login_or_token
|
||||
self.__authorizationHeader = "token " + token
|
||||
|
||||
+8
-8
@@ -13,12 +13,12 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
import Commit
|
||||
import github.Commit
|
||||
|
||||
|
||||
class Tag(GithubObject.BasicGithubObject):
|
||||
class Tag(github.GithubObject.BasicGithubObject):
|
||||
@property
|
||||
def commit(self):
|
||||
return self._NoneIfNotSet(self._commit)
|
||||
@@ -36,15 +36,15 @@ class Tag(GithubObject.BasicGithubObject):
|
||||
return self._NoneIfNotSet(self._zipball_url)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._commit = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._tarball_url = GithubObject.NotSet
|
||||
self._zipball_url = GithubObject.NotSet
|
||||
self._commit = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._tarball_url = github.GithubObject.NotSet
|
||||
self._zipball_url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "commit" in attributes: # pragma no branch
|
||||
assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"]
|
||||
self._commit = None if attributes["commit"] is None else Commit.Commit(self._requester, attributes["commit"], completed=False)
|
||||
self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, attributes["commit"], completed=False)
|
||||
if "name" in attributes: # pragma no branch
|
||||
assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
|
||||
self._name = attributes["name"]
|
||||
|
||||
+24
-24
@@ -13,14 +13,14 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
import Repository
|
||||
import NamedUser
|
||||
import github.Repository
|
||||
import github.NamedUser
|
||||
|
||||
|
||||
class Team(GithubObject.GithubObject):
|
||||
class Team(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def id(self):
|
||||
self._completeIfNotSet(self._id)
|
||||
@@ -52,7 +52,7 @@ class Team(GithubObject.GithubObject):
|
||||
return self._NoneIfNotSet(self._url)
|
||||
|
||||
def add_to_members(self, member):
|
||||
assert isinstance(member, NamedUser.NamedUser), member
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
self.url + "/members/" + member._identity,
|
||||
@@ -61,7 +61,7 @@ class Team(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def add_to_repos(self, repo):
|
||||
assert isinstance(repo, Repository.Repository), repo
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PUT",
|
||||
self.url + "/repos/" + repo._identity,
|
||||
@@ -77,13 +77,13 @@ class Team(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, name, permission=GithubObject.NotSet):
|
||||
def edit(self, name, permission=github.GithubObject.NotSet):
|
||||
assert isinstance(name, (str, unicode)), name
|
||||
assert permission is GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
|
||||
assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
}
|
||||
if permission is not GithubObject.NotSet:
|
||||
if permission is not github.GithubObject.NotSet:
|
||||
post_parameters["permission"] = permission
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -94,23 +94,23 @@ class Team(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_members(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self._requester,
|
||||
self.url + "/members",
|
||||
None
|
||||
)
|
||||
|
||||
def get_repos(self):
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Repository.Repository,
|
||||
self._requester,
|
||||
self.url + "/repos",
|
||||
None
|
||||
)
|
||||
|
||||
def has_in_members(self, member):
|
||||
assert isinstance(member, NamedUser.NamedUser), member
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
self.url + "/members/" + member._identity,
|
||||
@@ -120,7 +120,7 @@ class Team(GithubObject.GithubObject):
|
||||
return status == 204
|
||||
|
||||
def has_in_repos(self, repo):
|
||||
assert isinstance(repo, Repository.Repository), repo
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
status, headers, data = self._requester.requestRaw(
|
||||
"GET",
|
||||
self.url + "/repos/" + repo._identity,
|
||||
@@ -130,7 +130,7 @@ class Team(GithubObject.GithubObject):
|
||||
return status == 204
|
||||
|
||||
def remove_from_members(self, member):
|
||||
assert isinstance(member, NamedUser.NamedUser), member
|
||||
assert isinstance(member, github.NamedUser.NamedUser), member
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/members/" + member._identity,
|
||||
@@ -139,7 +139,7 @@ class Team(GithubObject.GithubObject):
|
||||
)
|
||||
|
||||
def remove_from_repos(self, repo):
|
||||
assert isinstance(repo, Repository.Repository), repo
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/repos/" + repo._identity,
|
||||
@@ -152,12 +152,12 @@ class Team(GithubObject.GithubObject):
|
||||
return self.id
|
||||
|
||||
def _initAttributes(self):
|
||||
self._id = GithubObject.NotSet
|
||||
self._members_count = GithubObject.NotSet
|
||||
self._name = GithubObject.NotSet
|
||||
self._permission = GithubObject.NotSet
|
||||
self._repos_count = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._members_count = github.GithubObject.NotSet
|
||||
self._name = github.GithubObject.NotSet
|
||||
self._permission = github.GithubObject.NotSet
|
||||
self._repos_count = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "id" in attributes: # pragma no branch
|
||||
|
||||
+12
-12
@@ -13,10 +13,10 @@
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import GithubObject
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class UserKey(GithubObject.GithubObject):
|
||||
class UserKey(github.GithubObject.GithubObject):
|
||||
@property
|
||||
def id(self):
|
||||
self._completeIfNotSet(self._id)
|
||||
@@ -50,13 +50,13 @@ class UserKey(GithubObject.GithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def edit(self, title=GithubObject.NotSet, key=GithubObject.NotSet):
|
||||
assert title is GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert key is GithubObject.NotSet or isinstance(key, (str, unicode)), key
|
||||
def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet):
|
||||
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
|
||||
assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key
|
||||
post_parameters = dict()
|
||||
if title is not GithubObject.NotSet:
|
||||
if title is not github.GithubObject.NotSet:
|
||||
post_parameters["title"] = title
|
||||
if key is not GithubObject.NotSet:
|
||||
if key is not github.GithubObject.NotSet:
|
||||
post_parameters["key"] = key
|
||||
headers, data = self._requester.requestAndCheck(
|
||||
"PATCH",
|
||||
@@ -67,11 +67,11 @@ class UserKey(GithubObject.GithubObject):
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._id = GithubObject.NotSet
|
||||
self._key = GithubObject.NotSet
|
||||
self._title = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._verified = GithubObject.NotSet
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._key = github.GithubObject.NotSet
|
||||
self._title = github.GithubObject.NotSet
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._verified = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "id" in attributes: # pragma no branch
|
||||
|
||||
@@ -14,12 +14,15 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import base64
|
||||
import sys
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
import datetime
|
||||
|
||||
atLeastPython3 = sys.hexversion >= 0x03000000
|
||||
|
||||
|
||||
class ContentFile(Framework.TestCase):
|
||||
def setUp(self):
|
||||
@@ -32,5 +35,8 @@ class ContentFile(Framework.TestCase):
|
||||
self.assertEqual(self.file.size, 7531)
|
||||
self.assertEqual(self.file.name, "ReadMe.md")
|
||||
self.assertEqual(self.file.path, "ReadMe.md")
|
||||
self.assertEqual(len(base64.b64decode(self.file.content)), 7531)
|
||||
if atLeastPython3:
|
||||
self.assertEqual(len(base64.b64decode(bytearray(self.file.content, "utf-8"))), 7531) # pragma no cover
|
||||
else:
|
||||
self.assertEqual(len(base64.b64decode(self.file.content)), 7531)
|
||||
self.assertEqual(self.file.sha, "5628799a7d517a4aaa0c1a7004d07569cd154df0")
|
||||
|
||||
@@ -19,6 +19,7 @@ import sys
|
||||
import Framework
|
||||
|
||||
atLeastPython26 = sys.hexversion >= 0x02060000
|
||||
atMostPython2 = sys.hexversion < 0x03000000
|
||||
|
||||
|
||||
class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument
|
||||
@@ -43,7 +44,7 @@ class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we
|
||||
"message": "Validation Failed"
|
||||
}
|
||||
)
|
||||
if atLeastPython26:
|
||||
if atLeastPython26 and atMostPython2:
|
||||
self.assertEqual(str(exception), "422 {u\'message\': u\'Validation Failed\', u\'errors\': [{u\'field\': u\'key\', u\'message\': u\"key is invalid. It must begin with \'ssh-rsa\' or \'ssh-dss\'. Check that you\'re copying the public half of the key\", u\'code\': u\'custom\', u\'resource\': u\'PublicKey\'}]}")
|
||||
else:
|
||||
self.assertEqual(str(exception), "422 {\'message\': \'Validation Failed\', \'errors\': [{\'field\': \'key\', \'message\': \"key is invalid. It must begin with \'ssh-rsa\' or \'ssh-dss\'. Check that you\'re copying the public half of the key\", \'code\': \'custom\', \'resource\': \'PublicKey\'}]}") # pragma no cover
|
||||
@@ -57,7 +58,7 @@ class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we
|
||||
raised = True
|
||||
self.assertEqual(exception.status, 404)
|
||||
self.assertEqual(exception.data, {"message": "Not Found"})
|
||||
if atLeastPython26:
|
||||
if atLeastPython26 and atMostPython2:
|
||||
self.assertEqual(str(exception), "404 {u'message': u'Not Found'}")
|
||||
else:
|
||||
self.assertEqual(str(exception), "404 {'message': 'Not Found'}") # pragma no cover
|
||||
@@ -71,7 +72,7 @@ class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we
|
||||
raised = True
|
||||
self.assertEqual(exception.status, 404)
|
||||
self.assertEqual(exception.data, {"message": "Not Found"})
|
||||
if atLeastPython26:
|
||||
if atLeastPython26 and atMostPython2:
|
||||
self.assertEqual(str(exception), "404 {u'message': u'Not Found'}")
|
||||
else:
|
||||
self.assertEqual(str(exception), "404 {'message': 'Not Found'}") # pragma no cover
|
||||
@@ -85,7 +86,7 @@ class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we
|
||||
raised = True
|
||||
self.assertEqual(exception.status, 401)
|
||||
self.assertEqual(exception.data, {"message": "Bad credentials"})
|
||||
if atLeastPython26:
|
||||
if atLeastPython26 and atMostPython2:
|
||||
self.assertEqual(str(exception), "401 {u'message': u'Bad credentials'}")
|
||||
else:
|
||||
self.assertEqual(str(exception), "401 {'message': 'Bad credentials'}") # pragma no cover
|
||||
|
||||
@@ -89,7 +89,6 @@ class RecordingHttpsConnection(RecordingConnection): # pragma no cover
|
||||
_realConnection = httplib.HTTPSConnection
|
||||
|
||||
def __init__(self, file, *args, **kwds):
|
||||
print args, kwds
|
||||
RecordingConnection.__init__(self, file, "https", *args, **kwds)
|
||||
|
||||
|
||||
|
||||
+43
-35
@@ -25,47 +25,55 @@ class Gist(Framework.TestCase):
|
||||
self.gist = self.g.get_gist("2729810")
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEquals(self.gist.comments, 0)
|
||||
self.assertEquals(self.gist.created_at, datetime.datetime(2012, 2, 29, 16, 47, 12))
|
||||
self.assertEquals(self.gist.description, "How to error 500 Github API v3, as requested by Rick (GitHub Staff)")
|
||||
self.assertEquals(self.gist.files.keys(), ["fail_github.py"])
|
||||
self.assertEquals(self.gist.files["fail_github.py"].size, 1636)
|
||||
self.assertEquals(self.gist.files["fail_github.py"].filename, "fail_github.py")
|
||||
self.assertEquals(self.gist.files["fail_github.py"].language, "Python")
|
||||
self.assertEquals(self.gist.files["fail_github.py"].content, 'import httplib\nimport base64\nimport json\n\nlogin = ""\npassword = ""\norgName = ""\nrepoName = "FailGithubApi"\n\ndef doRequest( verb, url, input ):\n input = json.dumps( input )\n cnx = httplib.HTTPSConnection( "api.github.com", strict = True )\n cnx.request( verb, url, input, { "Authorization" : "Basic " + base64.b64encode( login + ":" + password ).replace( \'\\n\', \'\' ) } )\n response = cnx.getresponse()\n status = response.status\n output = response.read()\n cnx.close()\n print verb, url, input, "=>", status, output\n print\n if status < 200 or status >= 300:\n exit( 1 )\n return json.loads( output )\n\n# Create a repo\ndoRequest( "POST", "/user/repos", { "name": repoName } )\n\n# Create a blob, a tree, a commit and the master branch\nb = doRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( login, repoName ),\n { "content": "Content of the blob", "encoding": "latin1" }\n)\nt = doRequest(\n "POST", "/repos/%s/%s/git/trees" % ( login, repoName ),\n { "tree" : [ { "path": "foo.bar", "type": "blob", "mode": "100644", "sha": b["sha"] } ] }\n)\nc = doRequest(\n "POST", "/repos/%s/%s/git/commits" % ( login, repoName ),\n { "parents": [], "message": "Message of the commit", "tree": t["sha"] }\n)\ndoRequest(\n "POST", "/repos/%s/%s/git/refs" % ( login, repoName ),\n { "ref": "refs/heads/master", "sha": c["sha"] }\n)\n\n# Fork the repo\ndoRequest( "POST", "/repos/%s/%s/forks?org=%s" % ( login, repoName, orgName ), None )\n\n# Create a new blob => BOOM error 500\ndoRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( orgName, repoName ),\n { "content": "Content of the new blob", "encoding": "latin1" }\n)\n')
|
||||
self.assertEquals(self.gist.files["fail_github.py"].raw_url, "https://gist.github.com/raw/2729810/2fb3aa84e0efa50dc0f4c18b5df5b7b9ab27076b/fail_github.py")
|
||||
self.assertEquals(self.gist.forks, [])
|
||||
self.assertEquals(self.gist.git_pull_url, "git://gist.github.com/2729810.git")
|
||||
self.assertEquals(self.gist.git_push_url, "git@gist.github.com:2729810.git")
|
||||
self.assertEquals(len(self.gist.history), 1)
|
||||
self.assertEquals(self.gist.history[0].change_status.additions, 52)
|
||||
self.assertEquals(self.gist.history[0].change_status.deletions, 0)
|
||||
self.assertEquals(self.gist.history[0].change_status.total, 52)
|
||||
self.assertEquals(self.gist.history[0].committed_at, datetime.datetime(2012, 2, 29, 16, 47, 12))
|
||||
self.assertEquals(self.gist.history[0].url, "https://api.github.com/gists/2729810/a40de483e42ba33bda308371c0ef8383db73be9e")
|
||||
self.assertEquals(self.gist.history[0].user.login, "jacquev6")
|
||||
self.assertEquals(self.gist.history[0].version, "a40de483e42ba33bda308371c0ef8383db73be9e")
|
||||
self.assertEquals(self.gist.html_url, "https://gist.github.com/2729810")
|
||||
self.assertEquals(self.gist.id, "2729810")
|
||||
self.assertEquals(self.gist.public, True)
|
||||
self.assertEquals(self.gist.updated_at, datetime.datetime(2012, 2, 29, 16, 47, 12))
|
||||
self.assertEquals(self.gist.url, "https://api.github.com/gists/2729810")
|
||||
self.assertEquals(self.gist.user.login, "jacquev6")
|
||||
self.assertEqual(self.gist.comments, 0)
|
||||
self.assertEqual(self.gist.created_at, datetime.datetime(2012, 2, 29, 16, 47, 12))
|
||||
self.assertEqual(self.gist.description, "How to error 500 Github API v3, as requested by Rick (GitHub Staff)")
|
||||
self.assertEqual(self.gist.files.keys(), ["fail_github.py"])
|
||||
self.assertEqual(self.gist.files["fail_github.py"].size, 1636)
|
||||
self.assertEqual(self.gist.files["fail_github.py"].filename, "fail_github.py")
|
||||
self.assertEqual(self.gist.files["fail_github.py"].language, "Python")
|
||||
self.assertEqual(self.gist.files["fail_github.py"].content, 'import httplib\nimport base64\nimport json\n\nlogin = ""\npassword = ""\norgName = ""\nrepoName = "FailGithubApi"\n\ndef doRequest( verb, url, input ):\n input = json.dumps( input )\n cnx = httplib.HTTPSConnection( "api.github.com", strict = True )\n cnx.request( verb, url, input, { "Authorization" : "Basic " + base64.b64encode( login + ":" + password ).replace( \'\\n\', \'\' ) } )\n response = cnx.getresponse()\n status = response.status\n output = response.read()\n cnx.close()\n print verb, url, input, "=>", status, output\n print\n if status < 200 or status >= 300:\n exit( 1 )\n return json.loads( output )\n\n# Create a repo\ndoRequest( "POST", "/user/repos", { "name": repoName } )\n\n# Create a blob, a tree, a commit and the master branch\nb = doRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( login, repoName ),\n { "content": "Content of the blob", "encoding": "latin1" }\n)\nt = doRequest(\n "POST", "/repos/%s/%s/git/trees" % ( login, repoName ),\n { "tree" : [ { "path": "foo.bar", "type": "blob", "mode": "100644", "sha": b["sha"] } ] }\n)\nc = doRequest(\n "POST", "/repos/%s/%s/git/commits" % ( login, repoName ),\n { "parents": [], "message": "Message of the commit", "tree": t["sha"] }\n)\ndoRequest(\n "POST", "/repos/%s/%s/git/refs" % ( login, repoName ),\n { "ref": "refs/heads/master", "sha": c["sha"] }\n)\n\n# Fork the repo\ndoRequest( "POST", "/repos/%s/%s/forks?org=%s" % ( login, repoName, orgName ), None )\n\n# Create a new blob => BOOM error 500\ndoRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( orgName, repoName ),\n { "content": "Content of the new blob", "encoding": "latin1" }\n)\n')
|
||||
self.assertEqual(self.gist.files["fail_github.py"].raw_url, "https://gist.github.com/raw/2729810/2fb3aa84e0efa50dc0f4c18b5df5b7b9ab27076b/fail_github.py")
|
||||
self.assertEqual(self.gist.forks, [])
|
||||
self.assertEqual(self.gist.git_pull_url, "git://gist.github.com/2729810.git")
|
||||
self.assertEqual(self.gist.git_push_url, "git@gist.github.com:2729810.git")
|
||||
self.assertEqual(len(self.gist.history), 1)
|
||||
self.assertEqual(self.gist.history[0].change_status.additions, 52)
|
||||
self.assertEqual(self.gist.history[0].change_status.deletions, 0)
|
||||
self.assertEqual(self.gist.history[0].change_status.total, 52)
|
||||
self.assertEqual(self.gist.history[0].committed_at, datetime.datetime(2012, 2, 29, 16, 47, 12))
|
||||
self.assertEqual(self.gist.history[0].url, "https://api.github.com/gists/2729810/a40de483e42ba33bda308371c0ef8383db73be9e")
|
||||
self.assertEqual(self.gist.history[0].user.login, "jacquev6")
|
||||
self.assertEqual(self.gist.history[0].version, "a40de483e42ba33bda308371c0ef8383db73be9e")
|
||||
self.assertEqual(self.gist.html_url, "https://gist.github.com/2729810")
|
||||
self.assertEqual(self.gist.id, "2729810")
|
||||
self.assertEqual(self.gist.public, True)
|
||||
self.assertEqual(self.gist.updated_at, datetime.datetime(2012, 2, 29, 16, 47, 12))
|
||||
self.assertEqual(self.gist.url, "https://api.github.com/gists/2729810")
|
||||
self.assertEqual(self.gist.user.login, "jacquev6")
|
||||
|
||||
def testNewAttributes(self):
|
||||
# For gists after https://github.com/blog/1276-welcome-to-a-new-gist
|
||||
gist = self.g.get_gist("3800341")
|
||||
self.assertEqual(gist.git_pull_url, "https://gist.github.com/3800341.git")
|
||||
self.assertEqual(gist.git_push_url, "https://gist.github.com/3800341.git")
|
||||
self.assertEqual(gist.html_url, "https://gist.github.com/3800341")
|
||||
self.assertEqual(gist.url, "https://api.github.com/gists/3800341")
|
||||
|
||||
def testEditWithoutParameters(self):
|
||||
self.gist.edit()
|
||||
self.assertEquals(self.gist.description, "Gist created by PyGithub")
|
||||
self.assertEquals(self.gist.updated_at, datetime.datetime(2012, 5, 19, 7, 0, 58))
|
||||
self.assertEqual(self.gist.description, "Gist created by PyGithub")
|
||||
self.assertEqual(self.gist.updated_at, datetime.datetime(2012, 5, 19, 7, 0, 58))
|
||||
|
||||
def testEditWithAllParameters(self):
|
||||
self.gist.edit("Description edited by PyGithub", {"barbaz.txt": github.InputFileContent("File also created by PyGithub")})
|
||||
self.assertEquals(self.gist.description, "Description edited by PyGithub")
|
||||
self.assertEquals(self.gist.updated_at, datetime.datetime(2012, 5, 19, 7, 6, 10))
|
||||
self.assertEquals(self.gist.files.keys(), ["foobar.txt", "barbaz.txt"])
|
||||
self.assertEqual(self.gist.description, "Description edited by PyGithub")
|
||||
self.assertEqual(self.gist.updated_at, datetime.datetime(2012, 5, 19, 7, 6, 10))
|
||||
self.assertEqual(self.gist.files.keys(), ["foobar.txt", "barbaz.txt"])
|
||||
|
||||
def testCreateComment(self):
|
||||
comment = self.gist.create_comment("Comment created by PyGithub")
|
||||
self.assertEquals(comment.id, 323629)
|
||||
self.assertEqual(comment.id, 323629)
|
||||
|
||||
def testGetComments(self):
|
||||
self.assertListKeyEqual(self.gist.get_comments(), lambda c: c.id, [323637])
|
||||
@@ -80,10 +88,10 @@ class Gist(Framework.TestCase):
|
||||
def testFork(self):
|
||||
gist = self.g.get_gist("2729818") # Random gist
|
||||
myGist = gist.create_fork()
|
||||
self.assertEquals(myGist.id, "2729865")
|
||||
self.assertEquals(myGist.fork_of, None) # WTF
|
||||
self.assertEqual(myGist.id, "2729865")
|
||||
self.assertEqual(myGist.fork_of, None) # WTF
|
||||
sameGist = self.g.get_gist("2729865")
|
||||
self.assertEquals(sameGist.fork_of.id, "2729818")
|
||||
self.assertEqual(sameGist.fork_of.id, "2729818")
|
||||
|
||||
def testDelete(self):
|
||||
self.gist.delete()
|
||||
|
||||
@@ -24,17 +24,17 @@ class GistComment(Framework.TestCase):
|
||||
self.comment = self.g.get_gist("2729810").get_comment(323629)
|
||||
|
||||
def testAttributes(self):
|
||||
self.assertEquals(self.comment.body, "Comment created by PyGithub")
|
||||
self.assertEquals(self.comment.created_at, datetime.datetime(2012, 5, 19, 7, 7, 57))
|
||||
self.assertEquals(self.comment.id, 323629)
|
||||
self.assertEquals(self.comment.updated_at, datetime.datetime(2012, 5, 19, 7, 7, 57))
|
||||
self.assertEquals(self.comment.url, "https://api.github.com/gists/2729810/comments/323629")
|
||||
self.assertEquals(self.comment.user.login, "jacquev6")
|
||||
self.assertEqual(self.comment.body, "Comment created by PyGithub")
|
||||
self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 19, 7, 7, 57))
|
||||
self.assertEqual(self.comment.id, 323629)
|
||||
self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 19, 7, 7, 57))
|
||||
self.assertEqual(self.comment.url, "https://api.github.com/gists/2729810/comments/323629")
|
||||
self.assertEqual(self.comment.user.login, "jacquev6")
|
||||
|
||||
def testEdit(self):
|
||||
self.comment.edit("Comment edited by PyGithub")
|
||||
self.assertEquals(self.comment.body, "Comment edited by PyGithub")
|
||||
self.assertEquals(self.comment.updated_at, datetime.datetime(2012, 5, 19, 7, 12, 32))
|
||||
self.assertEqual(self.comment.body, "Comment edited by PyGithub")
|
||||
self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 19, 7, 12, 32))
|
||||
|
||||
def testDelete(self):
|
||||
self.comment.delete()
|
||||
|
||||
@@ -92,3 +92,18 @@ class Github(Framework.TestCase):
|
||||
self.assertEqual(hook.supported_events, ["push"])
|
||||
self.assertEqual(hook.events, ["push"])
|
||||
self.assertEqual(hook.schema, [["string", "url"], ["string", "token"], ["string", "project_id"], ["string", "milestone_id"], ["string", "category_id"]])
|
||||
|
||||
def testGetRepoFromFullName(self):
|
||||
self.assertEqual(self.g.get_repo("jacquev6/PyGithub").description, "Python library implementing the full Github API v3")
|
||||
|
||||
def testGetGitignoreTemplates(self):
|
||||
self.assertEqual(self.g.get_gitignore_templates(), ["Actionscript", "Android", "AppceleratorTitanium", "Autotools", "Bancha", "C", "C++", "CFWheels", "CMake", "CSharp", "CakePHP", "Clojure", "CodeIgniter", "Compass", "Concrete5", "Coq", "Delphi", "Django", "Drupal", "Erlang", "ExpressionEngine", "Finale", "ForceDotCom", "FuelPHP", "GWT", "Go", "Grails", "Haskell", "Java", "Jboss", "Jekyll", "Joomla", "Jython", "Kohana", "LaTeX", "Leiningen", "LemonStand", "Lilypond", "Lithium", "Magento", "Maven", "Node", "OCaml", "Objective-C", "Opa", "OracleForms", "Perl", "PlayFramework", "Python", "Qooxdoo", "Qt", "R", "Rails", "RhodesRhomobile", "Ruby", "Scala", "Sdcc", "SeamGen", "SketchUp", "SugarCRM", "Symfony", "Symfony2", "SymphonyCMS", "Target3001", "Tasm", "Textpattern", "TurboGears2", "Unity", "VB.Net", "Waf", "Wordpress", "Yii", "ZendFramework", "gcov", "nanoc", "opencart"])
|
||||
|
||||
def testGetGitignoreTemplate(self):
|
||||
t = self.g.get_gitignore_template("Python")
|
||||
self.assertEqual(t.name, "Python")
|
||||
self.assertEqual(t.source, "*.py[cod]\n\n# C extensions\n*.so\n\n# Packages\n*.egg\n*.egg-info\ndist\nbuild\neggs\nparts\nbin\nvar\nsdist\ndevelop-eggs\n.installed.cfg\nlib\nlib64\n\n# Installer logs\npip-log.txt\n\n# Unit test / coverage reports\n.coverage\n.tox\nnosetests.xml\n\n# Translations\n*.mo\n\n# Mr Developer\n.mr.developer.cfg\n.project\n.pydevproject\n")
|
||||
|
||||
t = self.g.get_gitignore_template("C++")
|
||||
self.assertEqual(t.name, "C++")
|
||||
self.assertEqual(t.source,"# Compiled Object files\n*.slo\n*.lo\n*.o\n\n# Compiled Dynamic libraries\n*.so\n*.dylib\n\n# Compiled Static libraries\n*.lai\n*.la\n*.a\n")
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#!/bin/env python
|
||||
|
||||
# Copyright 2012 Vincent Jacques
|
||||
# vincent@vincent-jacques.net
|
||||
|
||||
# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
|
||||
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
from AuthenticatedUser import *
|
||||
from Authentication import *
|
||||
from Authorization import *
|
||||
from Branch import *
|
||||
from Commit import *
|
||||
from CommitComment import *
|
||||
from CommitStatus import *
|
||||
from ContentFile import *
|
||||
from Download import *
|
||||
from Event import *
|
||||
from Gist import *
|
||||
from GistComment import *
|
||||
from GitBlob import *
|
||||
from GitCommit import *
|
||||
from Github import *
|
||||
from GitRef import *
|
||||
from GitTag import *
|
||||
from GitTree import *
|
||||
from Hook import *
|
||||
from Issue import *
|
||||
from IssueComment import *
|
||||
from IssueEvent import *
|
||||
from Label import *
|
||||
from Milestone import *
|
||||
from NamedUser import *
|
||||
from Organization import *
|
||||
from PullRequest import *
|
||||
from PullRequestComment import *
|
||||
from PullRequestFile import *
|
||||
from RateLimiting import *
|
||||
from Repository import *
|
||||
from RepositoryKey import *
|
||||
from Tag import *
|
||||
from Team import *
|
||||
from UserKey import *
|
||||
from Markdown import *
|
||||
|
||||
from PaginatedList import *
|
||||
from Issue33 import *
|
||||
from Issue50 import *
|
||||
from Issue54 import *
|
||||
from Exceptions import *
|
||||
from Enterprise import *
|
||||
from Issue80 import *
|
||||
|
||||
Framework.main()
|
||||
@@ -0,0 +1,5 @@
|
||||
https GET api.github.com None /gists/3800341 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4990'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '4270'), ('server', 'nginx'), ('last-modified', 'Fri, 21 Dec 2012 18:46:45 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"446137bf216c4edc30567fbc3e944b5a"'), ('cache-control', 'private, s-maxage=60, max-age=60'), ('date', 'Fri, 21 Dec 2012 20:30:39 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"created_at":"2012-09-28T14:50:53Z","commits_url":"https://api.github.com/gists/3800341/commits","html_url":"https://gist.github.com/3800341","public":true,"url":"https://api.github.com/gists/3800341","forks":[],"description":"\"Temporary merge branch\" in `git mergetool`","forks_url":"https://api.github.com/gists/3800341/forks","history":[{"change_status":{"deletions":0,"additions":81,"total":81},"committed_at":"2012-09-28T14:50:53Z","url":"https://api.github.com/gists/3800341/98f3e3709dd8aa7d93c38a0ee9392e5a8d97ebfd","version":"98f3e3709dd8aa7d93c38a0ee9392e5a8d97ebfd","user":{"type":"User","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","login":"jacquev6","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","repos_url":"https://api.github.com/users/jacquev6/repos","url":"https://api.github.com/users/jacquev6","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following","received_events_url":"https://api.github.com/users/jacquev6/received_events","organizations_url":"https://api.github.com/users/jacquev6/orgs","id":327146}}],"user":{"type":"User","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","login":"jacquev6","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","repos_url":"https://api.github.com/users/jacquev6/repos","url":"https://api.github.com/users/jacquev6","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following","received_events_url":"https://api.github.com/users/jacquev6/received_events","organizations_url":"https://api.github.com/users/jacquev6/orgs","id":327146},"git_pull_url":"https://gist.github.com/3800341.git","updated_at":"2012-09-28T14:50:53Z","id":"3800341","comments_url":"https://api.github.com/gists/3800341/comments","comments":0,"files":{"temporary_merge_branch.sh":{"content":"#!/bin/sh\n\nfunction hack() {\n echo \"Hack $1\" >> file.txt\n git add file.txt\n git commit -m \"Hacked '$1'\"\n}\n\nfunction resolve() {\n grep Hack file.txt > file2.txt\n mv file2.txt file.txt\n git add file.txt\n git commit -F .git/MERGE_MSG\n}\n\nrm -rf WorkingDirectory\nmkdir WorkingDirectory\ncd WorkingDirectory\n\n# Create the following branches:\n#\n# O <- b11\n# /\n# O\n# / \\\n# / O <- b12\n# O----O\n# \\ O <- b21\n# \\ /\n# O \n# \\\n# O <- b22\n\ngit init\n\nhack Init\n\ngit branch b1\ngit branch b2\n\ngit checkout b1\nhack b1\n\ngit branch b11\ngit branch b12\n\ngit checkout b11\nhack b11\n\ngit checkout b12\nhack b12\n\ngit checkout b2\nhack b2\n\ngit branch b21\ngit branch b22\n\ngit checkout b21\nhack b21\n\ngit checkout b22\nhack b22\n\ngit branch -D b1 b2\n\n# Then merge b11 and b21 together\ngit checkout b11 -b bX1\ngit merge b21\nresolve\n\n# And b12 and b22 together\ngit checkout b12 -b bX2\ngit merge b22\nresolve\n\n# This gives several merge bases for bX1 and bX2\ngit merge-base --all bX1 bX2\ngit merge bX1\n# And a \"Temporary merge branch\" in file.txt.BASE when launching the mergetool\ngit mergetool\n","type":"application/sh","filename":"temporary_merge_branch.sh","size":1213,"raw_url":"https://gist.github.com/raw/3800341/4b8da5ba61e17f01f836de2992f3a7a5d2c461b1/temporary_merge_branch.sh","language":"Shell"}},"git_push_url":"https://gist.github.com/3800341.git"}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
https GET api.github.com None /gitignore/templates/Python {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('content-length', '367'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-remaining', '4990'), ('server', 'nginx'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"57aaf2580ebb3b8463d514285e0ca3dd"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Fri, 21 Dec 2012 19:56:02 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"source":"*.py[cod]\n\n# C extensions\n*.so\n\n# Packages\n*.egg\n*.egg-info\ndist\nbuild\neggs\nparts\nbin\nvar\nsdist\ndevelop-eggs\n.installed.cfg\nlib\nlib64\n\n# Installer logs\npip-log.txt\n\n# Unit test / coverage reports\n.coverage\n.tox\nnosetests.xml\n\n# Translations\n*.mo\n\n# Mr Developer\n.mr.developer.cfg\n.project\n.pydevproject\n","name":"Python"}
|
||||
|
||||
https GET api.github.com None /gitignore/templates/C++ {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('content-length', '165'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-remaining', '4989'), ('server', 'nginx'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d01fd87df4d9c3bc861c8ccf8f7aa9f0"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Fri, 21 Dec 2012 19:56:03 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"source":"# Compiled Object files\n*.slo\n*.lo\n*.o\n\n# Compiled Dynamic libraries\n*.so\n*.dylib\n\n# Compiled Static libraries\n*.lai\n*.la\n*.a\n","name":"C++"}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
https GET api.github.com None /gitignore/templates {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('content-length', '757'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4993'), ('server', 'nginx'), ('connection', 'keep-alive'), ('etag', '"cc8e8df5d003cd489fd90931fa7f751a"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Fri, 21 Dec 2012 19:54:21 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
["Actionscript","Android","AppceleratorTitanium","Autotools","Bancha","C","C++","CFWheels","CMake","CSharp","CakePHP","Clojure","CodeIgniter","Compass","Concrete5","Coq","Delphi","Django","Drupal","Erlang","ExpressionEngine","Finale","ForceDotCom","FuelPHP","GWT","Go","Grails","Haskell","Java","Jboss","Jekyll","Joomla","Jython","Kohana","LaTeX","Leiningen","LemonStand","Lilypond","Lithium","Magento","Maven","Node","OCaml","Objective-C","Opa","OracleForms","Perl","PlayFramework","Python","Qooxdoo","Qt","R","Rails","RhodesRhomobile","Ruby","Scala","Sdcc","SeamGen","SketchUp","SugarCRM","Symfony","Symfony2","SymphonyCMS","Target3001","Tasm","Textpattern","TurboGears2","Unity","VB.Net","Waf","Wordpress","Yii","ZendFramework","gcov","nanoc","opencart"]
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
https GET api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4939'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"922c0519f2733063a899619ae95ce892"'), ('date', 'Sun, 20 May 2012 12:33:27 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"svn_url":"https://github.com/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"updated_at":"2012-05-19T10:50:39Z","forks":2,"homepage":"http://vincent-jacques.net/PyGithub","git_url":"git://github.com/jacquev6/PyGithub.git","url":"https://api.github.com/repos/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","open_issues":18,"fork":false,"ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-19T10:50:39Z","size":304,"private":false,"has_downloads":true,"watchers":13,"html_url":"https://github.com/jacquev6/PyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","permissions":{"pull":true,"admin":true,"push":true},"language":"Python","description":"Python library implementing the full Github API v3","created_at":"2012-02-25T12:53:47Z","id":3544490,"mirror_url":null}
|
||||
|
||||
@@ -12,21 +12,3 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
|
||||
atLeastPython27 = sys.hexversion >= 0x02070000
|
||||
|
||||
if atLeastPython27:
|
||||
import unittest
|
||||
else: # pragma no cover
|
||||
import unittest2 as unittest # pragma no cover
|
||||
|
||||
import AllTests
|
||||
|
||||
|
||||
def run():
|
||||
testLoader = unittest.loader.TestLoader()
|
||||
testRunner = unittest.runner.TextTestRunner(verbosity=1)
|
||||
test = testLoader.loadTestsFromModule(AllTests)
|
||||
return testRunner.run(test)
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import Framework
|
||||
import AllTests
|
||||
import github.tests.Framework
|
||||
import github.tests.AllTests
|
||||
|
||||
|
||||
def main(argv):
|
||||
if "--record" in argv:
|
||||
Framework.activateRecordMode()
|
||||
github.tests.Framework.activateRecordMode()
|
||||
argv = [arg for arg in argv if arg != "--record"]
|
||||
|
||||
unittest.main(module=AllTests, argv=argv)
|
||||
unittest.main(module=github.tests.AllTests, argv=argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user