diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py
index c67a0005..684c2142 100644
--- a/github/AuthenticatedUser.py
+++ b/github/AuthenticatedUser.py
@@ -25,134 +25,135 @@ import Issue
import Event
import Authorization
-class AuthenticatedUser( GithubObject.GithubObject ):
+
+class AuthenticatedUser(GithubObject.GithubObject):
@property
- def avatar_url( self ):
- self._completeIfNotSet( self._avatar_url )
- return self._NoneIfNotSet( self._avatar_url )
+ def avatar_url(self):
+ self._completeIfNotSet(self._avatar_url)
+ return self._NoneIfNotSet(self._avatar_url)
@property
- def bio( self ):
- self._completeIfNotSet( self._bio )
- return self._NoneIfNotSet( self._bio )
+ def bio(self):
+ self._completeIfNotSet(self._bio)
+ return self._NoneIfNotSet(self._bio)
@property
- def blog( self ):
- self._completeIfNotSet( self._blog )
- return self._NoneIfNotSet( self._blog )
+ def blog(self):
+ self._completeIfNotSet(self._blog)
+ return self._NoneIfNotSet(self._blog)
@property
- def collaborators( self ):
- self._completeIfNotSet( self._collaborators )
- return self._NoneIfNotSet( self._collaborators )
+ def collaborators(self):
+ self._completeIfNotSet(self._collaborators)
+ return self._NoneIfNotSet(self._collaborators)
@property
- def company( self ):
- self._completeIfNotSet( self._company )
- return self._NoneIfNotSet( self._company )
+ def company(self):
+ self._completeIfNotSet(self._company)
+ return self._NoneIfNotSet(self._company)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def disk_usage( self ):
- self._completeIfNotSet( self._disk_usage )
- return self._NoneIfNotSet( self._disk_usage )
+ def disk_usage(self):
+ self._completeIfNotSet(self._disk_usage)
+ return self._NoneIfNotSet(self._disk_usage)
@property
- def email( self ):
- self._completeIfNotSet( self._email )
- return self._NoneIfNotSet( self._email )
+ def email(self):
+ self._completeIfNotSet(self._email)
+ return self._NoneIfNotSet(self._email)
@property
- def followers( self ):
- self._completeIfNotSet( self._followers )
- return self._NoneIfNotSet( self._followers )
+ def followers(self):
+ self._completeIfNotSet(self._followers)
+ return self._NoneIfNotSet(self._followers)
@property
- def following( self ):
- self._completeIfNotSet( self._following )
- return self._NoneIfNotSet( self._following )
+ def following(self):
+ self._completeIfNotSet(self._following)
+ return self._NoneIfNotSet(self._following)
@property
- def gravatar_id( self ):
- self._completeIfNotSet( self._gravatar_id )
- return self._NoneIfNotSet( self._gravatar_id )
+ def gravatar_id(self):
+ self._completeIfNotSet(self._gravatar_id)
+ return self._NoneIfNotSet(self._gravatar_id)
@property
- def hireable( self ):
- self._completeIfNotSet( self._hireable )
- return self._NoneIfNotSet( self._hireable )
+ def hireable(self):
+ self._completeIfNotSet(self._hireable)
+ return self._NoneIfNotSet(self._hireable)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def location( self ):
- self._completeIfNotSet( self._location )
- return self._NoneIfNotSet( self._location )
+ def location(self):
+ self._completeIfNotSet(self._location)
+ return self._NoneIfNotSet(self._location)
@property
- def login( self ):
- self._completeIfNotSet( self._login )
- return self._NoneIfNotSet( self._login )
+ def login(self):
+ self._completeIfNotSet(self._login)
+ return self._NoneIfNotSet(self._login)
@property
- def name( self ):
- self._completeIfNotSet( self._name )
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ self._completeIfNotSet(self._name)
+ return self._NoneIfNotSet(self._name)
@property
- def owned_private_repos( self ):
- self._completeIfNotSet( self._owned_private_repos )
- return self._NoneIfNotSet( self._owned_private_repos )
+ def owned_private_repos(self):
+ self._completeIfNotSet(self._owned_private_repos)
+ return self._NoneIfNotSet(self._owned_private_repos)
@property
- def plan( self ):
- self._completeIfNotSet( self._plan )
- return self._NoneIfNotSet( self._plan )
+ def plan(self):
+ self._completeIfNotSet(self._plan)
+ return self._NoneIfNotSet(self._plan)
@property
- def private_gists( self ):
- self._completeIfNotSet( self._private_gists )
- return self._NoneIfNotSet( self._private_gists )
+ def private_gists(self):
+ self._completeIfNotSet(self._private_gists)
+ return self._NoneIfNotSet(self._private_gists)
@property
- def public_gists( self ):
- self._completeIfNotSet( self._public_gists )
- return self._NoneIfNotSet( self._public_gists )
+ def public_gists(self):
+ self._completeIfNotSet(self._public_gists)
+ return self._NoneIfNotSet(self._public_gists)
@property
- def public_repos( self ):
- self._completeIfNotSet( self._public_repos )
- return self._NoneIfNotSet( self._public_repos )
+ def public_repos(self):
+ self._completeIfNotSet(self._public_repos)
+ return self._NoneIfNotSet(self._public_repos)
@property
- def total_private_repos( self ):
- self._completeIfNotSet( self._total_private_repos )
- return self._NoneIfNotSet( self._total_private_repos )
+ def total_private_repos(self):
+ self._completeIfNotSet(self._total_private_repos)
+ return self._NoneIfNotSet(self._total_private_repos)
@property
- def type( self ):
- self._completeIfNotSet( self._type )
- return self._NoneIfNotSet( self._type )
+ def type(self):
+ self._completeIfNotSet(self._type)
+ return self._NoneIfNotSet(self._type)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def add_to_emails( self, *emails ):
- assert all( isinstance( element, ( str, unicode ) ) for element in emails ), emails
+ def add_to_emails(self, *emails):
+ assert all(isinstance(element, (str, unicode)) for element in emails), emails
post_parameters = emails
headers, data = self._requester.requestAndCheck(
"POST",
@@ -161,8 +162,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
post_parameters
)
- def add_to_following( self, following ):
- assert isinstance( following, NamedUser.NamedUser ), following
+ def add_to_following(self, following):
+ assert isinstance(following, NamedUser.NamedUser), following
headers, data = self._requester.requestAndCheck(
"PUT",
"/user/following/" + following._identity,
@@ -170,8 +171,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def add_to_starred( self, starred ):
- assert isinstance( starred, Repository.Repository ), starred
+ def add_to_starred(self, starred):
+ assert isinstance(starred, Repository.Repository), starred
headers, data = self._requester.requestAndCheck(
"PUT",
"/user/starred/" + starred._identity,
@@ -179,8 +180,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def add_to_subscriptions( self, subscription ):
- assert isinstance( subscription, Repository.Repository ), subscription
+ def add_to_subscriptions(self, subscription):
+ assert isinstance(subscription, Repository.Repository), subscription
headers, data = self._requester.requestAndCheck(
"PUT",
"/user/subscriptions/" + subscription._identity,
@@ -188,8 +189,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def add_to_watched( self, watched ):
- assert isinstance( watched, Repository.Repository ), watched
+ def add_to_watched(self, watched):
+ assert isinstance(watched, Repository.Repository), watched
headers, data = self._requester.requestAndCheck(
"PUT",
"/user/watched/" + watched._identity,
@@ -197,56 +198,56 @@ 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=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
post_parameters = dict()
if scopes is not GithubObject.NotSet:
- post_parameters[ "scopes" ] = scopes
+ post_parameters["scopes"] = scopes
if note is not GithubObject.NotSet:
- post_parameters[ "note" ] = note
+ post_parameters["note"] = note
if note_url is not GithubObject.NotSet:
- post_parameters[ "note_url" ] = note_url
+ post_parameters["note_url"] = note_url
headers, data = self._requester.requestAndCheck(
"POST",
"/authorizations",
None,
post_parameters
)
- return Authorization.Authorization( self._requester, data, completed = True )
+ return Authorization.Authorization(self._requester, data, completed=True)
- def create_fork( self, repo ):
- assert isinstance( repo, Repository.Repository ), repo
+ def create_fork(self, repo):
+ assert isinstance(repo, 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 Repository.Repository(self._requester, data, completed=True)
- def create_gist( self, public, files, description = 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
+ def create_gist(self, public, files, description=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
post_parameters = {
"public": public,
- "files": dict( ( key, value._identity ) for key, value in files.iteritems() ),
+ "files": dict((key, value._identity) for key, value in files.iteritems()),
}
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
headers, data = self._requester.requestAndCheck(
"POST",
"/gists",
None,
post_parameters
)
- return Gist.Gist( self._requester, data, completed = True )
+ return Gist.Gist(self._requester, data, completed=True)
- def create_key( self, title, key ):
- assert isinstance( title, ( str, unicode ) ), title
- assert isinstance( key, ( str, unicode ) ), key
+ def create_key(self, title, key):
+ assert isinstance(title, (str, unicode)), title
+ assert isinstance(key, (str, unicode)), key
post_parameters = {
"title": title,
"key": key,
@@ -257,81 +258,81 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None,
post_parameters
)
- return UserKey.UserKey( self._requester, data, completed = True )
+ return 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 ):
- 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
+ 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):
+ 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
post_parameters = {
"name": name,
}
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
if homepage is not GithubObject.NotSet:
- post_parameters[ "homepage" ] = homepage
+ post_parameters["homepage"] = homepage
if private is not GithubObject.NotSet:
- post_parameters[ "private" ] = private
+ post_parameters["private"] = private
if has_issues is not GithubObject.NotSet:
- post_parameters[ "has_issues" ] = has_issues
+ post_parameters["has_issues"] = has_issues
if has_wiki is not GithubObject.NotSet:
- post_parameters[ "has_wiki" ] = has_wiki
+ post_parameters["has_wiki"] = has_wiki
if has_downloads is not GithubObject.NotSet:
- post_parameters[ "has_downloads" ] = has_downloads
+ post_parameters["has_downloads"] = has_downloads
headers, data = self._requester.requestAndCheck(
"POST",
"/user/repos",
None,
post_parameters
)
- return Repository.Repository( self._requester, data, completed = True )
+ return 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=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
post_parameters = dict()
if name is not GithubObject.NotSet:
- post_parameters[ "name" ] = name
+ post_parameters["name"] = name
if email is not GithubObject.NotSet:
- post_parameters[ "email" ] = email
+ post_parameters["email"] = email
if blog is not GithubObject.NotSet:
- post_parameters[ "blog" ] = blog
+ post_parameters["blog"] = blog
if company is not GithubObject.NotSet:
- post_parameters[ "company" ] = company
+ post_parameters["company"] = company
if location is not GithubObject.NotSet:
- post_parameters[ "location" ] = location
+ post_parameters["location"] = location
if hireable is not GithubObject.NotSet:
- post_parameters[ "hireable" ] = hireable
+ post_parameters["hireable"] = hireable
if bio is not GithubObject.NotSet:
- post_parameters[ "bio" ] = bio
+ post_parameters["bio"] = bio
headers, data = self._requester.requestAndCheck(
"PATCH",
"/user",
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def get_authorization( self, id ):
- assert isinstance( id, int ), id
+ def get_authorization(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- "/authorizations/" + str( id ),
+ "/authorizations/" + str(id),
None,
None
)
- return Authorization.Authorization( self._requester, data, completed = True )
+ return Authorization.Authorization(self._requester, data, completed=True)
- def get_authorizations( self ):
+ def get_authorizations(self):
return PaginatedList.PaginatedList(
Authorization.Authorization,
self._requester,
@@ -339,7 +340,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_emails( self ):
+ def get_emails(self):
headers, data = self._requester.requestAndCheck(
"GET",
"/user/emails",
@@ -348,7 +349,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
)
return data
- def get_events( self ):
+ def get_events(self):
return PaginatedList.PaginatedList(
Event.Event,
self._requester,
@@ -356,7 +357,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_followers( self ):
+ def get_followers(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -364,7 +365,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_following( self ):
+ def get_following(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -372,7 +373,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_gists( self ):
+ def get_gists(self):
return PaginatedList.PaginatedList(
Gist.Gist,
self._requester,
@@ -380,7 +381,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_issues( self ):
+ def get_issues(self):
return PaginatedList.PaginatedList(
Issue.Issue,
self._requester,
@@ -388,17 +389,17 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_key( self, id ):
- assert isinstance( id, int ), id
+ def get_key(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- "/user/keys/" + str( id ),
+ "/user/keys/" + str(id),
None,
None
)
- return UserKey.UserKey( self._requester, data, completed = True )
+ return UserKey.UserKey(self._requester, data, completed=True)
- def get_keys( self ):
+ def get_keys(self):
return PaginatedList.PaginatedList(
UserKey.UserKey,
self._requester,
@@ -406,8 +407,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_organization_events( self, org ):
- assert isinstance( org, Organization.Organization ), org
+ def get_organization_events(self, org):
+ assert isinstance(org, Organization.Organization), org
return PaginatedList.PaginatedList(
Event.Event,
self._requester,
@@ -415,7 +416,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_orgs( self ):
+ def get_orgs(self):
return PaginatedList.PaginatedList(
Organization.Organization,
self._requester,
@@ -423,27 +424,27 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_repo( self, name ):
- assert isinstance( name, ( str, unicode ) ), name
+ def get_repo(self, name):
+ assert isinstance(name, (str, unicode)), name
headers, data = self._requester.requestAndCheck(
"GET",
"/repos/" + self.login + "/" + name,
None,
None
)
- return Repository.Repository( self._requester, data, completed = True )
+ return 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=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
url_parameters = dict()
if type is not GithubObject.NotSet:
- url_parameters[ "type" ] = type
+ url_parameters["type"] = type
if sort is not GithubObject.NotSet:
- url_parameters[ "sort" ] = sort
+ url_parameters["sort"] = sort
if direction is not GithubObject.NotSet:
- url_parameters[ "direction" ] = direction
+ url_parameters["direction"] = direction
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -451,7 +452,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
url_parameters
)
- def get_starred( self ):
+ def get_starred(self):
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -459,7 +460,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_starred_gists( self ):
+ def get_starred_gists(self):
return PaginatedList.PaginatedList(
Gist.Gist,
self._requester,
@@ -467,7 +468,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_subscriptions( self ):
+ def get_subscriptions(self):
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -475,7 +476,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def get_watched( self ):
+ def get_watched(self):
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -483,8 +484,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def has_in_following( self, following ):
- assert isinstance( following, NamedUser.NamedUser ), following
+ def has_in_following(self, following):
+ assert isinstance(following, NamedUser.NamedUser), following
status, headers, data = self._requester.requestRaw(
"GET",
"/user/following/" + following._identity,
@@ -493,8 +494,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
)
return status == 204
- def has_in_starred( self, starred ):
- assert isinstance( starred, Repository.Repository ), starred
+ def has_in_starred(self, starred):
+ assert isinstance(starred, Repository.Repository), starred
status, headers, data = self._requester.requestRaw(
"GET",
"/user/starred/" + starred._identity,
@@ -503,8 +504,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
)
return status == 204
- def has_in_subscriptions( self, subscription ):
- assert isinstance( subscription, Repository.Repository ), subscription
+ def has_in_subscriptions(self, subscription):
+ assert isinstance(subscription, Repository.Repository), subscription
status, headers, data = self._requester.requestRaw(
"GET",
"/user/subscriptions/" + subscription._identity,
@@ -513,8 +514,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
)
return status == 204
- def has_in_watched( self, watched ):
- assert isinstance( watched, Repository.Repository ), watched
+ def has_in_watched(self, watched):
+ assert isinstance(watched, Repository.Repository), watched
status, headers, data = self._requester.requestRaw(
"GET",
"/user/watched/" + watched._identity,
@@ -523,8 +524,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
)
return status == 204
- def remove_from_emails( self, *emails ):
- assert all( isinstance( element, ( str, unicode ) ) for element in emails ), emails
+ def remove_from_emails(self, *emails):
+ assert all(isinstance(element, (str, unicode)) for element in emails), emails
post_parameters = emails
headers, data = self._requester.requestAndCheck(
"DELETE",
@@ -533,8 +534,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
post_parameters
)
- def remove_from_following( self, following ):
- assert isinstance( following, NamedUser.NamedUser ), following
+ def remove_from_following(self, following):
+ assert isinstance(following, NamedUser.NamedUser), following
headers, data = self._requester.requestAndCheck(
"DELETE",
"/user/following/" + following._identity,
@@ -542,8 +543,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def remove_from_starred( self, starred ):
- assert isinstance( starred, Repository.Repository ), starred
+ def remove_from_starred(self, starred):
+ assert isinstance(starred, Repository.Repository), starred
headers, data = self._requester.requestAndCheck(
"DELETE",
"/user/starred/" + starred._identity,
@@ -551,8 +552,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def remove_from_subscriptions( self, subscription ):
- assert isinstance( subscription, Repository.Repository ), subscription
+ def remove_from_subscriptions(self, subscription):
+ assert isinstance(subscription, Repository.Repository), subscription
headers, data = self._requester.requestAndCheck(
"DELETE",
"/user/subscriptions/" + subscription._identity,
@@ -560,8 +561,8 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def remove_from_watched( self, watched ):
- assert isinstance( watched, Repository.Repository ), watched
+ def remove_from_watched(self, watched):
+ assert isinstance(watched, Repository.Repository), watched
headers, data = self._requester.requestAndCheck(
"DELETE",
"/user/watched/" + watched._identity,
@@ -569,7 +570,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
None
)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._avatar_url = GithubObject.NotSet
self._bio = GithubObject.NotSet
self._blog = GithubObject.NotSet
@@ -596,79 +597,79 @@ class AuthenticatedUser( GithubObject.GithubObject ):
self._type = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "avatar_url" in attributes: # pragma no branch
- assert attributes[ "avatar_url" ] is None or isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ]
- self._avatar_url = attributes[ "avatar_url" ]
- if "bio" in attributes: # pragma no branch
- assert attributes[ "bio" ] is None or isinstance( attributes[ "bio" ], ( str, unicode ) ), attributes[ "bio" ]
- self._bio = attributes[ "bio" ]
- if "blog" in attributes: # pragma no branch
- assert attributes[ "blog" ] is None or isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ]
- self._blog = attributes[ "blog" ]
- if "collaborators" in attributes: # pragma no branch
- assert attributes[ "collaborators" ] is None or isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ]
- self._collaborators = attributes[ "collaborators" ]
- if "company" in attributes: # pragma no branch
- assert attributes[ "company" ] is None or isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ]
- self._company = attributes[ "company" ]
- 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" ] )
- if "disk_usage" in attributes: # pragma no branch
- assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ]
- self._disk_usage = attributes[ "disk_usage" ]
- if "email" in attributes: # pragma no branch
- assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ]
- self._email = attributes[ "email" ]
- if "followers" in attributes: # pragma no branch
- assert attributes[ "followers" ] is None or isinstance( attributes[ "followers" ], int ), attributes[ "followers" ]
- self._followers = attributes[ "followers" ]
- if "following" in attributes: # pragma no branch
- assert attributes[ "following" ] is None or isinstance( attributes[ "following" ], int ), attributes[ "following" ]
- self._following = attributes[ "following" ]
- if "gravatar_id" in attributes: # pragma no branch
- assert attributes[ "gravatar_id" ] is None or isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ]
- self._gravatar_id = attributes[ "gravatar_id" ]
- if "hireable" in attributes: # pragma no branch
- assert attributes[ "hireable" ] is None or isinstance( attributes[ "hireable" ], bool ), attributes[ "hireable" ]
- self._hireable = attributes[ "hireable" ]
- 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" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "location" in attributes: # pragma no branch
- assert attributes[ "location" ] is None or isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ]
- self._location = attributes[ "location" ]
- if "login" in attributes: # pragma no branch
- assert attributes[ "login" ] is None or isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ]
- self._login = attributes[ "login" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "owned_private_repos" in attributes: # pragma no branch
- assert attributes[ "owned_private_repos" ] is None or isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ]
- 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 )
- if "private_gists" in attributes: # pragma no branch
- assert attributes[ "private_gists" ] is None or isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ]
- self._private_gists = attributes[ "private_gists" ]
- if "public_gists" in attributes: # pragma no branch
- assert attributes[ "public_gists" ] is None or isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ]
- self._public_gists = attributes[ "public_gists" ]
- if "public_repos" in attributes: # pragma no branch
- assert attributes[ "public_repos" ] is None or isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ]
- self._public_repos = attributes[ "public_repos" ]
- if "total_private_repos" in attributes: # pragma no branch
- assert attributes[ "total_private_repos" ] is None or isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ]
- self._total_private_repos = attributes[ "total_private_repos" ]
- if "type" in attributes: # pragma no branch
- assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
- self._type = attributes[ "type" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "avatar_url" in attributes: # pragma no branch
+ assert attributes["avatar_url"] is None or isinstance(attributes["avatar_url"], (str, unicode)), attributes["avatar_url"]
+ self._avatar_url = attributes["avatar_url"]
+ if "bio" in attributes: # pragma no branch
+ assert attributes["bio"] is None or isinstance(attributes["bio"], (str, unicode)), attributes["bio"]
+ self._bio = attributes["bio"]
+ if "blog" in attributes: # pragma no branch
+ assert attributes["blog"] is None or isinstance(attributes["blog"], (str, unicode)), attributes["blog"]
+ self._blog = attributes["blog"]
+ if "collaborators" in attributes: # pragma no branch
+ assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], int), attributes["collaborators"]
+ self._collaborators = attributes["collaborators"]
+ if "company" in attributes: # pragma no branch
+ assert attributes["company"] is None or isinstance(attributes["company"], (str, unicode)), attributes["company"]
+ self._company = attributes["company"]
+ 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"])
+ if "disk_usage" in attributes: # pragma no branch
+ assert attributes["disk_usage"] is None or isinstance(attributes["disk_usage"], int), attributes["disk_usage"]
+ self._disk_usage = attributes["disk_usage"]
+ if "email" in attributes: # pragma no branch
+ assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"]
+ self._email = attributes["email"]
+ if "followers" in attributes: # pragma no branch
+ assert attributes["followers"] is None or isinstance(attributes["followers"], int), attributes["followers"]
+ self._followers = attributes["followers"]
+ if "following" in attributes: # pragma no branch
+ assert attributes["following"] is None or isinstance(attributes["following"], int), attributes["following"]
+ self._following = attributes["following"]
+ if "gravatar_id" in attributes: # pragma no branch
+ assert attributes["gravatar_id"] is None or isinstance(attributes["gravatar_id"], (str, unicode)), attributes["gravatar_id"]
+ self._gravatar_id = attributes["gravatar_id"]
+ if "hireable" in attributes: # pragma no branch
+ assert attributes["hireable"] is None or isinstance(attributes["hireable"], bool), attributes["hireable"]
+ self._hireable = attributes["hireable"]
+ 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"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "location" in attributes: # pragma no branch
+ assert attributes["location"] is None or isinstance(attributes["location"], (str, unicode)), attributes["location"]
+ self._location = attributes["location"]
+ if "login" in attributes: # pragma no branch
+ assert attributes["login"] is None or isinstance(attributes["login"], (str, unicode)), attributes["login"]
+ self._login = attributes["login"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "owned_private_repos" in attributes: # pragma no branch
+ assert attributes["owned_private_repos"] is None or isinstance(attributes["owned_private_repos"], int), attributes["owned_private_repos"]
+ 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)
+ if "private_gists" in attributes: # pragma no branch
+ assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], int), attributes["private_gists"]
+ self._private_gists = attributes["private_gists"]
+ if "public_gists" in attributes: # pragma no branch
+ assert attributes["public_gists"] is None or isinstance(attributes["public_gists"], int), attributes["public_gists"]
+ self._public_gists = attributes["public_gists"]
+ if "public_repos" in attributes: # pragma no branch
+ assert attributes["public_repos"] is None or isinstance(attributes["public_repos"], int), attributes["public_repos"]
+ self._public_repos = attributes["public_repos"]
+ if "total_private_repos" in attributes: # pragma no branch
+ assert attributes["total_private_repos"] is None or isinstance(attributes["total_private_repos"], int), attributes["total_private_repos"]
+ self._total_private_repos = attributes["total_private_repos"]
+ if "type" in attributes: # pragma no branch
+ assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"]
+ self._type = attributes["type"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/Authorization.py b/github/Authorization.py
index f437d6ad..1271624c 100644
--- a/github/Authorization.py
+++ b/github/Authorization.py
@@ -15,53 +15,54 @@ import GithubObject
import AuthorizationApplication
-class Authorization( GithubObject.GithubObject ):
+
+class Authorization(GithubObject.GithubObject):
@property
- def app( self ):
- self._completeIfNotSet( self._app )
- return self._NoneIfNotSet( self._app )
+ def app(self):
+ self._completeIfNotSet(self._app)
+ return self._NoneIfNotSet(self._app)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def note( self ):
- self._completeIfNotSet( self._note )
- return self._NoneIfNotSet( self._note )
+ def note(self):
+ self._completeIfNotSet(self._note)
+ return self._NoneIfNotSet(self._note)
@property
- def note_url( self ):
- self._completeIfNotSet( self._note_url )
- return self._NoneIfNotSet( self._note_url )
+ def note_url(self):
+ self._completeIfNotSet(self._note_url)
+ return self._NoneIfNotSet(self._note_url)
@property
- def scopes( self ):
- self._completeIfNotSet( self._scopes )
- return self._NoneIfNotSet( self._scopes )
+ def scopes(self):
+ self._completeIfNotSet(self._scopes)
+ return self._NoneIfNotSet(self._scopes)
@property
- def token( self ):
- self._completeIfNotSet( self._token )
- return self._NoneIfNotSet( self._token )
+ def token(self):
+ self._completeIfNotSet(self._token)
+ return self._NoneIfNotSet(self._token)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -69,32 +70,32 @@ 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=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
post_parameters = dict()
if scopes is not GithubObject.NotSet:
- post_parameters[ "scopes" ] = scopes
+ post_parameters["scopes"] = scopes
if add_scopes is not GithubObject.NotSet:
- post_parameters[ "add_scopes" ] = add_scopes
+ post_parameters["add_scopes"] = add_scopes
if remove_scopes is not GithubObject.NotSet:
- post_parameters[ "remove_scopes" ] = remove_scopes
+ post_parameters["remove_scopes"] = remove_scopes
if note is not GithubObject.NotSet:
- post_parameters[ "note" ] = note
+ post_parameters["note"] = note
if note_url is not GithubObject.NotSet:
- post_parameters[ "note_url" ] = note_url
+ post_parameters["note_url"] = note_url
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._app = GithubObject.NotSet
self._created_at = GithubObject.NotSet
self._id = GithubObject.NotSet
@@ -105,31 +106,31 @@ class Authorization( GithubObject.GithubObject ):
self._updated_at = GithubObject.NotSet
self._url = 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 )
- 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" ] )
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "note" in attributes: # pragma no branch
- assert attributes[ "note" ] is None or isinstance( attributes[ "note" ], ( str, unicode ) ), attributes[ "note" ]
- self._note = attributes[ "note" ]
- if "note_url" in attributes: # pragma no branch
- assert attributes[ "note_url" ] is None or isinstance( attributes[ "note_url" ], ( str, unicode ) ), attributes[ "note_url" ]
- self._note_url = attributes[ "note_url" ]
- if "scopes" in attributes: # pragma no branch
- assert attributes[ "scopes" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "scopes" ] ), attributes[ "scopes" ]
- self._scopes = attributes[ "scopes" ]
- if "token" in attributes: # pragma no branch
- assert attributes[ "token" ] is None or isinstance( attributes[ "token" ], ( str, unicode ) ), attributes[ "token" ]
- self._token = attributes[ "token" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ 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)
+ 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"])
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "note" in attributes: # pragma no branch
+ assert attributes["note"] is None or isinstance(attributes["note"], (str, unicode)), attributes["note"]
+ self._note = attributes["note"]
+ if "note_url" in attributes: # pragma no branch
+ assert attributes["note_url"] is None or isinstance(attributes["note_url"], (str, unicode)), attributes["note_url"]
+ self._note_url = attributes["note_url"]
+ if "scopes" in attributes: # pragma no branch
+ assert attributes["scopes"] is None or all(isinstance(element, (str, unicode)) for element in attributes["scopes"]), attributes["scopes"]
+ self._scopes = attributes["scopes"]
+ if "token" in attributes: # pragma no branch
+ assert attributes["token"] is None or isinstance(attributes["token"], (str, unicode)), attributes["token"]
+ self._token = attributes["token"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/AuthorizationApplication.py b/github/AuthorizationApplication.py
index ea79de42..ee23a727 100644
--- a/github/AuthorizationApplication.py
+++ b/github/AuthorizationApplication.py
@@ -13,25 +13,26 @@
import GithubObject
-class AuthorizationApplication( GithubObject.GithubObject ):
+
+class AuthorizationApplication(GithubObject.GithubObject):
@property
- def name( self ):
- self._completeIfNotSet( self._name )
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ self._completeIfNotSet(self._name)
+ return self._NoneIfNotSet(self._name)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._name = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/Branch.py b/github/Branch.py
index f37da93e..4c99ed11 100644
--- a/github/Branch.py
+++ b/github/Branch.py
@@ -15,23 +15,24 @@ import GithubObject
import Commit
-class Branch( GithubObject.BasicGithubObject ):
+
+class Branch(GithubObject.BasicGithubObject):
@property
- def commit( self ):
- return self._NoneIfNotSet( self._commit )
+ def commit(self):
+ return self._NoneIfNotSet(self._commit)
@property
- def name( self ):
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ return self._NoneIfNotSet(self._name)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._commit = GithubObject.NotSet
self._name = 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 )
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
+ 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)
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
diff --git a/github/Commit.py b/github/Commit.py
index 7db6a17f..c0e8d075 100644
--- a/github/Commit.py
+++ b/github/Commit.py
@@ -22,89 +22,90 @@ import CommitStats
import Commit
import CommitComment
-class Commit( GithubObject.GithubObject ):
+
+class Commit(GithubObject.GithubObject):
@property
- def author( self ):
- self._completeIfNotSet( self._author )
- return self._NoneIfNotSet( self._author )
+ def author(self):
+ self._completeIfNotSet(self._author)
+ return self._NoneIfNotSet(self._author)
@property
- def commit( self ):
- self._completeIfNotSet( self._commit )
- return self._NoneIfNotSet( self._commit )
+ def commit(self):
+ self._completeIfNotSet(self._commit)
+ return self._NoneIfNotSet(self._commit)
@property
- def committer( self ):
- self._completeIfNotSet( self._committer )
- return self._NoneIfNotSet( self._committer )
+ def committer(self):
+ self._completeIfNotSet(self._committer)
+ return self._NoneIfNotSet(self._committer)
@property
- def files( self ):
- self._completeIfNotSet( self._files )
- return self._NoneIfNotSet( self._files )
+ def files(self):
+ self._completeIfNotSet(self._files)
+ return self._NoneIfNotSet(self._files)
@property
- def parents( self ):
- self._completeIfNotSet( self._parents )
- return self._NoneIfNotSet( self._parents )
+ def parents(self):
+ self._completeIfNotSet(self._parents)
+ return self._NoneIfNotSet(self._parents)
@property
- def sha( self ):
- self._completeIfNotSet( self._sha )
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ self._completeIfNotSet(self._sha)
+ return self._NoneIfNotSet(self._sha)
@property
- def stats( self ):
- self._completeIfNotSet( self._stats )
- return self._NoneIfNotSet( self._stats )
+ def stats(self):
+ self._completeIfNotSet(self._stats)
+ return self._NoneIfNotSet(self._stats)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def create_comment( self, body, line = GithubObject.NotSet, path = GithubObject.NotSet, position = GithubObject.NotSet ):
- assert isinstance( body, ( str, unicode ) ), body
- assert line is GithubObject.NotSet or isinstance( line, int ), line
- assert path is GithubObject.NotSet or isinstance( path, ( str, unicode ) ), path
- assert position is GithubObject.NotSet or isinstance( position, int ), position
+ def create_comment(self, body, line=GithubObject.NotSet, path=GithubObject.NotSet, position=GithubObject.NotSet):
+ assert isinstance(body, (str, unicode)), body
+ assert line is GithubObject.NotSet or isinstance(line, int), line
+ assert path is GithubObject.NotSet or isinstance(path, (str, unicode)), path
+ assert position is GithubObject.NotSet or isinstance(position, int), position
post_parameters = {
"body": body,
}
if line is not GithubObject.NotSet:
- post_parameters[ "line" ] = line
+ post_parameters["line"] = line
if path is not GithubObject.NotSet:
- post_parameters[ "path" ] = path
+ post_parameters["path"] = path
if position is not GithubObject.NotSet:
- post_parameters[ "position" ] = position
+ post_parameters["position"] = position
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/comments",
None,
post_parameters
)
- return CommitComment.CommitComment( self._requester, data, completed = True )
+ return CommitComment.CommitComment(self._requester, data, completed=True)
- def create_status( self, state, target_url = GithubObject.NotSet, description = 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
+ def create_status(self, state, target_url=GithubObject.NotSet, description=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
post_parameters = {
"state": state,
}
if target_url is not GithubObject.NotSet:
- post_parameters[ "target_url" ] = target_url
+ post_parameters["target_url"] = target_url
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
headers, data = self._requester.requestAndCheck(
"POST",
- self._parentUrl( self._parentUrl( self.url ) ) + "/statuses/" + self.sha,
+ self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha,
None,
post_parameters
)
- return CommitStatus.CommitStatus( self._requester, data, completed = True )
+ return CommitStatus.CommitStatus(self._requester, data, completed=True)
- def get_comments( self ):
+ def get_comments(self):
return PaginatedList.PaginatedList(
CommitComment.CommitComment,
self._requester,
@@ -112,19 +113,19 @@ class Commit( GithubObject.GithubObject ):
None
)
- def get_statuses( self ):
+ def get_statuses(self):
return PaginatedList.PaginatedList(
CommitStatus.CommitStatus,
self._requester,
- self._parentUrl( self._parentUrl( self.url ) ) + "/statuses/" + self.sha,
+ self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha,
None
)
@property
- def _identity( self ):
+ def _identity(self):
return self.sha
- def _initAttributes( self ):
+ def _initAttributes(self):
self._author = GithubObject.NotSet
self._commit = GithubObject.NotSet
self._committer = GithubObject.NotSet
@@ -134,34 +135,34 @@ class Commit( GithubObject.GithubObject ):
self._stats = GithubObject.NotSet
self._url = 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 )
- 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 )
- 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 )
- 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 )
- for element in attributes[ "files" ]
+ 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)
+ 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)
+ 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)
+ 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)
+ for element in attributes["files"]
]
- if "parents" in attributes: # pragma no branch
- assert attributes[ "parents" ] is None or all( isinstance( element, dict ) for element in attributes[ "parents" ] ), attributes[ "parents" ]
- self._parents = None if attributes[ "parents" ] is None else [
- Commit( self._requester, element, completed = False )
- for element in attributes[ "parents" ]
+ if "parents" in attributes: # pragma no branch
+ assert attributes["parents"] is None or all(isinstance(element, dict) for element in attributes["parents"]), attributes["parents"]
+ self._parents = None if attributes["parents"] is None else [
+ Commit(self._requester, element, completed=False)
+ for element in attributes["parents"]
]
- 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 "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 )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ 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 "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)
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/CommitComment.py b/github/CommitComment.py
index 1e42af84..53c09632 100644
--- a/github/CommitComment.py
+++ b/github/CommitComment.py
@@ -15,63 +15,64 @@ import GithubObject
import NamedUser
-class CommitComment( GithubObject.GithubObject ):
+
+class CommitComment(GithubObject.GithubObject):
@property
- def body( self ):
- self._completeIfNotSet( self._body )
- return self._NoneIfNotSet( self._body )
+ def body(self):
+ self._completeIfNotSet(self._body)
+ return self._NoneIfNotSet(self._body)
@property
- def commit_id( self ):
- self._completeIfNotSet( self._commit_id )
- return self._NoneIfNotSet( self._commit_id )
+ def commit_id(self):
+ self._completeIfNotSet(self._commit_id)
+ return self._NoneIfNotSet(self._commit_id)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def line( self ):
- self._completeIfNotSet( self._line )
- return self._NoneIfNotSet( self._line )
+ def line(self):
+ self._completeIfNotSet(self._line)
+ return self._NoneIfNotSet(self._line)
@property
- def path( self ):
- self._completeIfNotSet( self._path )
- return self._NoneIfNotSet( self._path )
+ def path(self):
+ self._completeIfNotSet(self._path)
+ return self._NoneIfNotSet(self._path)
@property
- def position( self ):
- self._completeIfNotSet( self._position )
- return self._NoneIfNotSet( self._position )
+ def position(self):
+ self._completeIfNotSet(self._position)
+ return self._NoneIfNotSet(self._position)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def user( self ):
- self._completeIfNotSet( self._user )
- return self._NoneIfNotSet( self._user )
+ def user(self):
+ self._completeIfNotSet(self._user)
+ return self._NoneIfNotSet(self._user)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -79,8 +80,8 @@ class CommitComment( GithubObject.GithubObject ):
None
)
- def edit( self, body ):
- assert isinstance( body, ( str, unicode ) ), body
+ def edit(self, body):
+ assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
}
@@ -90,9 +91,9 @@ class CommitComment( GithubObject.GithubObject ):
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._body = GithubObject.NotSet
self._commit_id = GithubObject.NotSet
self._created_at = GithubObject.NotSet
@@ -105,37 +106,37 @@ class CommitComment( GithubObject.GithubObject ):
self._url = GithubObject.NotSet
self._user = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "body" in attributes: # pragma no branch
- assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
- self._body = attributes[ "body" ]
- 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" ]
- 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" ] )
- 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" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "line" in attributes: # pragma no branch
- assert attributes[ "line" ] is None or isinstance( attributes[ "line" ], int ), attributes[ "line" ]
- self._line = attributes[ "line" ]
- if "path" in attributes: # pragma no branch
- assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ]
- self._path = attributes[ "path" ]
- if "position" in attributes: # pragma no branch
- assert attributes[ "position" ] is None or isinstance( attributes[ "position" ], int ), attributes[ "position" ]
- self._position = attributes[ "position" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- 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 )
+ def _useAttributes(self, attributes):
+ if "body" in attributes: # pragma no branch
+ assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
+ self._body = attributes["body"]
+ 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"]
+ 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"])
+ 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"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "line" in attributes: # pragma no branch
+ assert attributes["line"] is None or isinstance(attributes["line"], int), attributes["line"]
+ self._line = attributes["line"]
+ if "path" in attributes: # pragma no branch
+ assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"]
+ self._path = attributes["path"]
+ if "position" in attributes: # pragma no branch
+ assert attributes["position"] is None or isinstance(attributes["position"], int), attributes["position"]
+ self._position = attributes["position"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ 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)
diff --git a/github/CommitStats.py b/github/CommitStats.py
index c0217975..e5b3b6ba 100644
--- a/github/CommitStats.py
+++ b/github/CommitStats.py
@@ -13,31 +13,32 @@
import GithubObject
-class CommitStats( GithubObject.BasicGithubObject ):
+
+class CommitStats(GithubObject.BasicGithubObject):
@property
- def additions( self ):
- return self._NoneIfNotSet( self._additions )
+ def additions(self):
+ return self._NoneIfNotSet(self._additions)
@property
- def deletions( self ):
- return self._NoneIfNotSet( self._deletions )
+ def deletions(self):
+ return self._NoneIfNotSet(self._deletions)
@property
- def total( self ):
- return self._NoneIfNotSet( self._total )
+ def total(self):
+ return self._NoneIfNotSet(self._total)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._additions = GithubObject.NotSet
self._deletions = GithubObject.NotSet
self._total = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "additions" in attributes: # pragma no branch
- assert attributes[ "additions" ] is None or isinstance( attributes[ "additions" ], int ), attributes[ "additions" ]
- self._additions = attributes[ "additions" ]
- if "deletions" in attributes: # pragma no branch
- assert attributes[ "deletions" ] is None or isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ]
- self._deletions = attributes[ "deletions" ]
- if "total" in attributes: # pragma no branch
- assert attributes[ "total" ] is None or isinstance( attributes[ "total" ], int ), attributes[ "total" ]
- self._total = attributes[ "total" ]
+ def _useAttributes(self, attributes):
+ if "additions" in attributes: # pragma no branch
+ assert attributes["additions"] is None or isinstance(attributes["additions"], int), attributes["additions"]
+ self._additions = attributes["additions"]
+ if "deletions" in attributes: # pragma no branch
+ assert attributes["deletions"] is None or isinstance(attributes["deletions"], int), attributes["deletions"]
+ self._deletions = attributes["deletions"]
+ if "total" in attributes: # pragma no branch
+ assert attributes["total"] is None or isinstance(attributes["total"], int), attributes["total"]
+ self._total = attributes["total"]
diff --git a/github/CommitStatus.py b/github/CommitStatus.py
index c6f11679..715ceece 100644
--- a/github/CommitStatus.py
+++ b/github/CommitStatus.py
@@ -15,36 +15,37 @@ import GithubObject
import NamedUser
-class CommitStatus( GithubObject.BasicGithubObject ):
+
+class CommitStatus(GithubObject.BasicGithubObject):
@property
- def created_at( self ):
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ return self._NoneIfNotSet(self._created_at)
@property
- def creator( self ):
- return self._NoneIfNotSet( self._creator )
+ def creator(self):
+ return self._NoneIfNotSet(self._creator)
@property
- def description( self ):
- return self._NoneIfNotSet( self._description )
+ def description(self):
+ return self._NoneIfNotSet(self._description)
@property
- def id( self ):
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ return self._NoneIfNotSet(self._id)
@property
- def state( self ):
- return self._NoneIfNotSet( self._state )
+ def state(self):
+ return self._NoneIfNotSet(self._state)
@property
- def target_url( self ):
- return self._NoneIfNotSet( self._target_url )
+ def target_url(self):
+ return self._NoneIfNotSet(self._target_url)
@property
- def updated_at( self ):
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ return self._NoneIfNotSet(self._updated_at)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._created_at = GithubObject.NotSet
self._creator = GithubObject.NotSet
self._description = GithubObject.NotSet
@@ -53,25 +54,25 @@ class CommitStatus( GithubObject.BasicGithubObject ):
self._target_url = GithubObject.NotSet
self._updated_at = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- 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" ] )
- 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 )
- if "description" in attributes: # pragma no branch
- assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
- self._description = attributes[ "description" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "state" in attributes: # pragma no branch
- assert attributes[ "state" ] is None or isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ]
- self._state = attributes[ "state" ]
- if "target_url" in attributes: # pragma no branch
- assert attributes[ "target_url" ] is None or isinstance( attributes[ "target_url" ], ( str, unicode ) ), attributes[ "target_url" ]
- self._target_url = attributes[ "target_url" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
+ def _useAttributes(self, attributes):
+ 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"])
+ 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)
+ if "description" in attributes: # pragma no branch
+ assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"]
+ self._description = attributes["description"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "state" in attributes: # pragma no branch
+ assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"]
+ self._state = attributes["state"]
+ if "target_url" in attributes: # pragma no branch
+ assert attributes["target_url"] is None or isinstance(attributes["target_url"], (str, unicode)), attributes["target_url"]
+ self._target_url = attributes["target_url"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
diff --git a/github/Comparison.py b/github/Comparison.py
index 0961d60d..fe1622ea 100644
--- a/github/Comparison.py
+++ b/github/Comparison.py
@@ -16,68 +16,69 @@ import GithubObject
import Commit
import File
-class Comparison( GithubObject.GithubObject ):
+
+class Comparison(GithubObject.GithubObject):
@property
- def ahead_by( self ):
- self._completeIfNotSet( self._ahead_by )
- return self._NoneIfNotSet( self._ahead_by )
+ def ahead_by(self):
+ self._completeIfNotSet(self._ahead_by)
+ return self._NoneIfNotSet(self._ahead_by)
@property
- def base_commit( self ):
- self._completeIfNotSet( self._base_commit )
- return self._NoneIfNotSet( self._base_commit )
+ def base_commit(self):
+ self._completeIfNotSet(self._base_commit)
+ return self._NoneIfNotSet(self._base_commit)
@property
- def behind_by( self ):
- self._completeIfNotSet( self._behind_by )
- return self._NoneIfNotSet( self._behind_by )
+ def behind_by(self):
+ self._completeIfNotSet(self._behind_by)
+ return self._NoneIfNotSet(self._behind_by)
@property
- def commits( self ):
- self._completeIfNotSet( self._commits )
- return self._NoneIfNotSet( self._commits )
+ def commits(self):
+ self._completeIfNotSet(self._commits)
+ return self._NoneIfNotSet(self._commits)
@property
- def diff_url( self ):
- self._completeIfNotSet( self._diff_url )
- return self._NoneIfNotSet( self._diff_url )
+ def diff_url(self):
+ self._completeIfNotSet(self._diff_url)
+ return self._NoneIfNotSet(self._diff_url)
@property
- def files( self ):
- self._completeIfNotSet( self._files )
- return self._NoneIfNotSet( self._files )
+ def files(self):
+ self._completeIfNotSet(self._files)
+ return self._NoneIfNotSet(self._files)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def patch_url( self ):
- self._completeIfNotSet( self._patch_url )
- return self._NoneIfNotSet( self._patch_url )
+ def patch_url(self):
+ self._completeIfNotSet(self._patch_url)
+ return self._NoneIfNotSet(self._patch_url)
@property
- def permalink_url( self ):
- self._completeIfNotSet( self._permalink_url )
- return self._NoneIfNotSet( self._permalink_url )
+ def permalink_url(self):
+ self._completeIfNotSet(self._permalink_url)
+ return self._NoneIfNotSet(self._permalink_url)
@property
- def status( self ):
- self._completeIfNotSet( self._status )
- return self._NoneIfNotSet( self._status )
+ def status(self):
+ self._completeIfNotSet(self._status)
+ return self._NoneIfNotSet(self._status)
@property
- def total_commits( self ):
- self._completeIfNotSet( self._total_commits )
- return self._NoneIfNotSet( self._total_commits )
+ def total_commits(self):
+ self._completeIfNotSet(self._total_commits)
+ return self._NoneIfNotSet(self._total_commits)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._ahead_by = GithubObject.NotSet
self._base_commit = GithubObject.NotSet
self._behind_by = GithubObject.NotSet
@@ -91,46 +92,46 @@ class Comparison( GithubObject.GithubObject ):
self._total_commits = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "ahead_by" in attributes: # pragma no branch
- assert attributes[ "ahead_by" ] is None or isinstance( attributes[ "ahead_by" ], int ), attributes[ "ahead_by" ]
- 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 )
- if "behind_by" in attributes: # pragma no branch
- assert attributes[ "behind_by" ] is None or isinstance( attributes[ "behind_by" ], int ), 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 )
- for element in attributes[ "commits" ]
+ def _useAttributes(self, attributes):
+ if "ahead_by" in attributes: # pragma no branch
+ assert attributes["ahead_by"] is None or isinstance(attributes["ahead_by"], int), attributes["ahead_by"]
+ 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)
+ if "behind_by" in attributes: # pragma no branch
+ assert attributes["behind_by"] is None or isinstance(attributes["behind_by"], int), 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)
+ for element in attributes["commits"]
]
- if "diff_url" in attributes: # pragma no branch
- assert attributes[ "diff_url" ] is None or isinstance( attributes[ "diff_url" ], ( str, unicode ) ), attributes[ "diff_url" ]
- self._diff_url = attributes[ "diff_url" ]
- 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 )
- for element in attributes[ "files" ]
+ if "diff_url" in attributes: # pragma no branch
+ assert attributes["diff_url"] is None or isinstance(attributes["diff_url"], (str, unicode)), attributes["diff_url"]
+ self._diff_url = attributes["diff_url"]
+ 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)
+ for element in attributes["files"]
]
- 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" ]
- if "patch_url" in attributes: # pragma no branch
- assert attributes[ "patch_url" ] is None or isinstance( attributes[ "patch_url" ], ( str, unicode ) ), attributes[ "patch_url" ]
- self._patch_url = attributes[ "patch_url" ]
- if "permalink_url" in attributes: # pragma no branch
- assert attributes[ "permalink_url" ] is None or isinstance( attributes[ "permalink_url" ], ( str, unicode ) ), attributes[ "permalink_url" ]
- self._permalink_url = attributes[ "permalink_url" ]
- if "status" in attributes: # pragma no branch
- assert attributes[ "status" ] is None or isinstance( attributes[ "status" ], ( str, unicode ) ), attributes[ "status" ]
- self._status = attributes[ "status" ]
- if "total_commits" in attributes: # pragma no branch
- assert attributes[ "total_commits" ] is None or isinstance( attributes[ "total_commits" ], int ), attributes[ "total_commits" ]
- self._total_commits = attributes[ "total_commits" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ 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"]
+ if "patch_url" in attributes: # pragma no branch
+ assert attributes["patch_url"] is None or isinstance(attributes["patch_url"], (str, unicode)), attributes["patch_url"]
+ self._patch_url = attributes["patch_url"]
+ if "permalink_url" in attributes: # pragma no branch
+ assert attributes["permalink_url"] is None or isinstance(attributes["permalink_url"], (str, unicode)), attributes["permalink_url"]
+ self._permalink_url = attributes["permalink_url"]
+ if "status" in attributes: # pragma no branch
+ assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"]
+ self._status = attributes["status"]
+ if "total_commits" in attributes: # pragma no branch
+ assert attributes["total_commits"] is None or isinstance(attributes["total_commits"], int), attributes["total_commits"]
+ self._total_commits = attributes["total_commits"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/ContentFile.py b/github/ContentFile.py
index e1411596..b69b611b 100644
--- a/github/ContentFile.py
+++ b/github/ContentFile.py
@@ -13,36 +13,37 @@
import GithubObject
-class ContentFile( GithubObject.BasicGithubObject ):
+
+class ContentFile(GithubObject.BasicGithubObject):
@property
- def content( self ):
- return self._NoneIfNotSet( self._content )
+ def content(self):
+ return self._NoneIfNotSet(self._content)
@property
- def encoding( self ):
- return self._NoneIfNotSet( self._encoding )
+ def encoding(self):
+ return self._NoneIfNotSet(self._encoding)
@property
- def name( self ):
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ return self._NoneIfNotSet(self._name)
@property
- def path( self ):
- return self._NoneIfNotSet( self._path )
+ def path(self):
+ return self._NoneIfNotSet(self._path)
@property
- def sha( self ):
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ return self._NoneIfNotSet(self._sha)
@property
- def size( self ):
- return self._NoneIfNotSet( self._size )
+ def size(self):
+ return self._NoneIfNotSet(self._size)
@property
- def type( self ):
- return self._NoneIfNotSet( self._type )
+ def type(self):
+ return self._NoneIfNotSet(self._type)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._content = GithubObject.NotSet
self._encoding = GithubObject.NotSet
self._name = GithubObject.NotSet
@@ -51,25 +52,25 @@ class ContentFile( GithubObject.BasicGithubObject ):
self._size = GithubObject.NotSet
self._type = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "content" in attributes: # pragma no branch
- assert attributes[ "content" ] is None or isinstance( attributes[ "content" ], ( str, unicode ) ), attributes[ "content" ]
- self._content = attributes[ "content" ]
- if "encoding" in attributes: # pragma no branch
- assert attributes[ "encoding" ] is None or isinstance( attributes[ "encoding" ], ( str, unicode ) ), attributes[ "encoding" ]
- self._encoding = attributes[ "encoding" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "path" in attributes: # pragma no branch
- assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ]
- self._path = attributes[ "path" ]
- 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 "size" in attributes: # pragma no branch
- assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ]
- self._size = attributes[ "size" ]
- if "type" in attributes: # pragma no branch
- assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
- self._type = attributes[ "type" ]
+ def _useAttributes(self, attributes):
+ if "content" in attributes: # pragma no branch
+ assert attributes["content"] is None or isinstance(attributes["content"], (str, unicode)), attributes["content"]
+ self._content = attributes["content"]
+ if "encoding" in attributes: # pragma no branch
+ assert attributes["encoding"] is None or isinstance(attributes["encoding"], (str, unicode)), attributes["encoding"]
+ self._encoding = attributes["encoding"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "path" in attributes: # pragma no branch
+ assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"]
+ self._path = attributes["path"]
+ 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 "size" in attributes: # pragma no branch
+ assert attributes["size"] is None or isinstance(attributes["size"], int), attributes["size"]
+ self._size = attributes["size"]
+ if "type" in attributes: # pragma no branch
+ assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"]
+ self._type = attributes["type"]
diff --git a/github/Download.py b/github/Download.py
index 7cf040fc..8551d9b6 100644
--- a/github/Download.py
+++ b/github/Download.py
@@ -13,108 +13,109 @@
import GithubObject
-class Download( GithubObject.GithubObject ):
+
+class Download(GithubObject.GithubObject):
@property
- def accesskeyid( self ):
- self._completeIfNotSet( self._accesskeyid )
- return self._NoneIfNotSet( self._accesskeyid )
+ def accesskeyid(self):
+ self._completeIfNotSet(self._accesskeyid)
+ return self._NoneIfNotSet(self._accesskeyid)
@property
- def acl( self ):
- self._completeIfNotSet( self._acl )
- return self._NoneIfNotSet( self._acl )
+ def acl(self):
+ self._completeIfNotSet(self._acl)
+ return self._NoneIfNotSet(self._acl)
@property
- def bucket( self ):
- self._completeIfNotSet( self._bucket )
- return self._NoneIfNotSet( self._bucket )
+ def bucket(self):
+ self._completeIfNotSet(self._bucket)
+ return self._NoneIfNotSet(self._bucket)
@property
- def content_type( self ):
- self._completeIfNotSet( self._content_type )
- return self._NoneIfNotSet( self._content_type )
+ def content_type(self):
+ self._completeIfNotSet(self._content_type)
+ return self._NoneIfNotSet(self._content_type)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def description( self ):
- self._completeIfNotSet( self._description )
- return self._NoneIfNotSet( self._description )
+ def description(self):
+ self._completeIfNotSet(self._description)
+ return self._NoneIfNotSet(self._description)
@property
- def download_count( self ):
- self._completeIfNotSet( self._download_count )
- return self._NoneIfNotSet( self._download_count )
+ def download_count(self):
+ self._completeIfNotSet(self._download_count)
+ return self._NoneIfNotSet(self._download_count)
@property
- def expirationdate( self ):
- self._completeIfNotSet( self._expirationdate )
- return self._NoneIfNotSet( self._expirationdate )
+ def expirationdate(self):
+ self._completeIfNotSet(self._expirationdate)
+ return self._NoneIfNotSet(self._expirationdate)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def mime_type( self ):
- self._completeIfNotSet( self._mime_type )
- return self._NoneIfNotSet( self._mime_type )
+ def mime_type(self):
+ self._completeIfNotSet(self._mime_type)
+ return self._NoneIfNotSet(self._mime_type)
@property
- def name( self ):
- self._completeIfNotSet( self._name )
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ self._completeIfNotSet(self._name)
+ return self._NoneIfNotSet(self._name)
@property
- def path( self ):
- self._completeIfNotSet( self._path )
- return self._NoneIfNotSet( self._path )
+ def path(self):
+ self._completeIfNotSet(self._path)
+ return self._NoneIfNotSet(self._path)
@property
- def policy( self ):
- self._completeIfNotSet( self._policy )
- return self._NoneIfNotSet( self._policy )
+ def policy(self):
+ self._completeIfNotSet(self._policy)
+ return self._NoneIfNotSet(self._policy)
@property
- def prefix( self ):
- self._completeIfNotSet( self._prefix )
- return self._NoneIfNotSet( self._prefix )
+ def prefix(self):
+ self._completeIfNotSet(self._prefix)
+ return self._NoneIfNotSet(self._prefix)
@property
- def redirect( self ):
- self._completeIfNotSet( self._redirect )
- return self._NoneIfNotSet( self._redirect )
+ def redirect(self):
+ self._completeIfNotSet(self._redirect)
+ return self._NoneIfNotSet(self._redirect)
@property
- def s3_url( self ):
- self._completeIfNotSet( self._s3_url )
- return self._NoneIfNotSet( self._s3_url )
+ def s3_url(self):
+ self._completeIfNotSet(self._s3_url)
+ return self._NoneIfNotSet(self._s3_url)
@property
- def signature( self ):
- self._completeIfNotSet( self._signature )
- return self._NoneIfNotSet( self._signature )
+ def signature(self):
+ self._completeIfNotSet(self._signature)
+ return self._NoneIfNotSet(self._signature)
@property
- def size( self ):
- self._completeIfNotSet( self._size )
- return self._NoneIfNotSet( self._size )
+ def size(self):
+ self._completeIfNotSet(self._size)
+ return self._NoneIfNotSet(self._size)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -122,7 +123,7 @@ class Download( GithubObject.GithubObject ):
None
)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._accesskeyid = GithubObject.NotSet
self._acl = GithubObject.NotSet
self._bucket = GithubObject.NotSet
@@ -144,64 +145,64 @@ class Download( GithubObject.GithubObject ):
self._size = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "accesskeyid" in attributes: # pragma no branch
- assert attributes[ "accesskeyid" ] is None or isinstance( attributes[ "accesskeyid" ], ( str, unicode ) ), attributes[ "accesskeyid" ]
- self._accesskeyid = attributes[ "accesskeyid" ]
- if "acl" in attributes: # pragma no branch
- assert attributes[ "acl" ] is None or isinstance( attributes[ "acl" ], ( str, unicode ) ), attributes[ "acl" ]
- self._acl = attributes[ "acl" ]
- if "bucket" in attributes: # pragma no branch
- assert attributes[ "bucket" ] is None or isinstance( attributes[ "bucket" ], ( str, unicode ) ), attributes[ "bucket" ]
- self._bucket = attributes[ "bucket" ]
- if "content_type" in attributes: # pragma no branch
- assert attributes[ "content_type" ] is None or isinstance( attributes[ "content_type" ], ( str, unicode ) ), attributes[ "content_type" ]
- self._content_type = attributes[ "content_type" ]
- 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" ] )
- if "description" in attributes: # pragma no branch
- assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
- self._description = attributes[ "description" ]
- if "download_count" in attributes: # pragma no branch
- assert attributes[ "download_count" ] is None or isinstance( attributes[ "download_count" ], int ), attributes[ "download_count" ]
- self._download_count = attributes[ "download_count" ]
- if "expirationdate" in attributes: # pragma no branch
- assert attributes[ "expirationdate" ] is None or isinstance( attributes[ "expirationdate" ], ( str, unicode ) ), attributes[ "expirationdate" ]
- self._expirationdate = self._parseDatetime( attributes[ "expirationdate" ] )
- 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" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "mime_type" in attributes: # pragma no branch
- assert attributes[ "mime_type" ] is None or isinstance( attributes[ "mime_type" ], ( str, unicode ) ), attributes[ "mime_type" ]
- self._mime_type = attributes[ "mime_type" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "path" in attributes: # pragma no branch
- assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ]
- self._path = attributes[ "path" ]
- if "policy" in attributes: # pragma no branch
- assert attributes[ "policy" ] is None or isinstance( attributes[ "policy" ], ( str, unicode ) ), attributes[ "policy" ]
- self._policy = attributes[ "policy" ]
- if "prefix" in attributes: # pragma no branch
- assert attributes[ "prefix" ] is None or isinstance( attributes[ "prefix" ], ( str, unicode ) ), attributes[ "prefix" ]
- self._prefix = attributes[ "prefix" ]
- if "redirect" in attributes: # pragma no branch
- assert attributes[ "redirect" ] is None or isinstance( attributes[ "redirect" ], bool ), attributes[ "redirect" ]
- self._redirect = attributes[ "redirect" ]
- if "s3_url" in attributes: # pragma no branch
- assert attributes[ "s3_url" ] is None or isinstance( attributes[ "s3_url" ], ( str, unicode ) ), attributes[ "s3_url" ]
- self._s3_url = attributes[ "s3_url" ]
- if "signature" in attributes: # pragma no branch
- assert attributes[ "signature" ] is None or isinstance( attributes[ "signature" ], ( str, unicode ) ), attributes[ "signature" ]
- self._signature = attributes[ "signature" ]
- if "size" in attributes: # pragma no branch
- assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ]
- self._size = attributes[ "size" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "accesskeyid" in attributes: # pragma no branch
+ assert attributes["accesskeyid"] is None or isinstance(attributes["accesskeyid"], (str, unicode)), attributes["accesskeyid"]
+ self._accesskeyid = attributes["accesskeyid"]
+ if "acl" in attributes: # pragma no branch
+ assert attributes["acl"] is None or isinstance(attributes["acl"], (str, unicode)), attributes["acl"]
+ self._acl = attributes["acl"]
+ if "bucket" in attributes: # pragma no branch
+ assert attributes["bucket"] is None or isinstance(attributes["bucket"], (str, unicode)), attributes["bucket"]
+ self._bucket = attributes["bucket"]
+ if "content_type" in attributes: # pragma no branch
+ assert attributes["content_type"] is None or isinstance(attributes["content_type"], (str, unicode)), attributes["content_type"]
+ self._content_type = attributes["content_type"]
+ 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"])
+ if "description" in attributes: # pragma no branch
+ assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"]
+ self._description = attributes["description"]
+ if "download_count" in attributes: # pragma no branch
+ assert attributes["download_count"] is None or isinstance(attributes["download_count"], int), attributes["download_count"]
+ self._download_count = attributes["download_count"]
+ if "expirationdate" in attributes: # pragma no branch
+ assert attributes["expirationdate"] is None or isinstance(attributes["expirationdate"], (str, unicode)), attributes["expirationdate"]
+ self._expirationdate = self._parseDatetime(attributes["expirationdate"])
+ 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"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "mime_type" in attributes: # pragma no branch
+ assert attributes["mime_type"] is None or isinstance(attributes["mime_type"], (str, unicode)), attributes["mime_type"]
+ self._mime_type = attributes["mime_type"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "path" in attributes: # pragma no branch
+ assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"]
+ self._path = attributes["path"]
+ if "policy" in attributes: # pragma no branch
+ assert attributes["policy"] is None or isinstance(attributes["policy"], (str, unicode)), attributes["policy"]
+ self._policy = attributes["policy"]
+ if "prefix" in attributes: # pragma no branch
+ assert attributes["prefix"] is None or isinstance(attributes["prefix"], (str, unicode)), attributes["prefix"]
+ self._prefix = attributes["prefix"]
+ if "redirect" in attributes: # pragma no branch
+ assert attributes["redirect"] is None or isinstance(attributes["redirect"], bool), attributes["redirect"]
+ self._redirect = attributes["redirect"]
+ if "s3_url" in attributes: # pragma no branch
+ assert attributes["s3_url"] is None or isinstance(attributes["s3_url"], (str, unicode)), attributes["s3_url"]
+ self._s3_url = attributes["s3_url"]
+ if "signature" in attributes: # pragma no branch
+ assert attributes["signature"] is None or isinstance(attributes["signature"], (str, unicode)), attributes["signature"]
+ self._signature = attributes["signature"]
+ if "size" in attributes: # pragma no branch
+ assert attributes["size"] is None or isinstance(attributes["size"], int), attributes["size"]
+ self._size = attributes["size"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/Event.py b/github/Event.py
index c14485d7..496b660c 100644
--- a/github/Event.py
+++ b/github/Event.py
@@ -17,40 +17,41 @@ import Organization
import Repository
import NamedUser
-class Event( GithubObject.BasicGithubObject ):
+
+class Event(GithubObject.BasicGithubObject):
@property
- def actor( self ):
- return self._NoneIfNotSet( self._actor )
+ def actor(self):
+ return self._NoneIfNotSet(self._actor)
@property
- def created_at( self ):
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ return self._NoneIfNotSet(self._created_at)
@property
- def id( self ):
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ return self._NoneIfNotSet(self._id)
@property
- def org( self ):
- return self._NoneIfNotSet( self._org )
+ def org(self):
+ return self._NoneIfNotSet(self._org)
@property
- def payload( self ):
- return self._NoneIfNotSet( self._payload )
+ def payload(self):
+ return self._NoneIfNotSet(self._payload)
@property
- def public( self ):
- return self._NoneIfNotSet( self._public )
+ def public(self):
+ return self._NoneIfNotSet(self._public)
@property
- def repo( self ):
- return self._NoneIfNotSet( self._repo )
+ def repo(self):
+ return self._NoneIfNotSet(self._repo)
@property
- def type( self ):
- return self._NoneIfNotSet( self._type )
+ def type(self):
+ return self._NoneIfNotSet(self._type)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._actor = GithubObject.NotSet
self._created_at = GithubObject.NotSet
self._id = GithubObject.NotSet
@@ -60,28 +61,28 @@ class Event( GithubObject.BasicGithubObject ):
self._repo = GithubObject.NotSet
self._type = 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 )
- 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" ] )
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], ( str, unicode ) ), attributes[ "id" ]
- 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 )
- if "payload" in attributes: # pragma no branch
- assert attributes[ "payload" ] is None or isinstance( attributes[ "payload" ], dict ), attributes[ "payload" ]
- self._payload = attributes[ "payload" ]
- if "public" in attributes: # pragma no branch
- assert attributes[ "public" ] is None or isinstance( attributes[ "public" ], bool ), attributes[ "public" ]
- 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 )
- if "type" in attributes: # pragma no branch
- assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
- self._type = attributes[ "type" ]
+ 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)
+ 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"])
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], (str, unicode)), attributes["id"]
+ 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)
+ if "payload" in attributes: # pragma no branch
+ assert attributes["payload"] is None or isinstance(attributes["payload"], dict), attributes["payload"]
+ self._payload = attributes["payload"]
+ if "public" in attributes: # pragma no branch
+ assert attributes["public"] is None or isinstance(attributes["public"], bool), attributes["public"]
+ 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)
+ if "type" in attributes: # pragma no branch
+ assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"]
+ self._type = attributes["type"]
diff --git a/github/File.py b/github/File.py
index 9eb1af92..e3395910 100644
--- a/github/File.py
+++ b/github/File.py
@@ -13,44 +13,45 @@
import GithubObject
-class File( GithubObject.BasicGithubObject ):
+
+class File(GithubObject.BasicGithubObject):
@property
- def additions( self ):
- return self._NoneIfNotSet( self._additions )
+ def additions(self):
+ return self._NoneIfNotSet(self._additions)
@property
- def blob_url( self ):
- return self._NoneIfNotSet( self._blob_url )
+ def blob_url(self):
+ return self._NoneIfNotSet(self._blob_url)
@property
- def changes( self ):
- return self._NoneIfNotSet( self._changes )
+ def changes(self):
+ return self._NoneIfNotSet(self._changes)
@property
- def deletions( self ):
- return self._NoneIfNotSet( self._deletions )
+ def deletions(self):
+ return self._NoneIfNotSet(self._deletions)
@property
- def filename( self ):
- return self._NoneIfNotSet( self._filename )
+ def filename(self):
+ return self._NoneIfNotSet(self._filename)
@property
- def patch( self ):
- return self._NoneIfNotSet( self._patch )
+ def patch(self):
+ return self._NoneIfNotSet(self._patch)
@property
- def raw_url( self ):
- return self._NoneIfNotSet( self._raw_url )
+ def raw_url(self):
+ return self._NoneIfNotSet(self._raw_url)
@property
- def sha( self ):
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ return self._NoneIfNotSet(self._sha)
@property
- def status( self ):
- return self._NoneIfNotSet( self._status )
+ def status(self):
+ return self._NoneIfNotSet(self._status)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._additions = GithubObject.NotSet
self._blob_url = GithubObject.NotSet
self._changes = GithubObject.NotSet
@@ -61,31 +62,31 @@ class File( GithubObject.BasicGithubObject ):
self._sha = GithubObject.NotSet
self._status = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "additions" in attributes: # pragma no branch
- assert attributes[ "additions" ] is None or isinstance( attributes[ "additions" ], int ), attributes[ "additions" ]
- self._additions = attributes[ "additions" ]
- if "blob_url" in attributes: # pragma no branch
- assert attributes[ "blob_url" ] is None or isinstance( attributes[ "blob_url" ], ( str, unicode ) ), attributes[ "blob_url" ]
- self._blob_url = attributes[ "blob_url" ]
- if "changes" in attributes: # pragma no branch
- assert attributes[ "changes" ] is None or isinstance( attributes[ "changes" ], int ), attributes[ "changes" ]
- self._changes = attributes[ "changes" ]
- if "deletions" in attributes: # pragma no branch
- assert attributes[ "deletions" ] is None or isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ]
- self._deletions = attributes[ "deletions" ]
- if "filename" in attributes: # pragma no branch
- assert attributes[ "filename" ] is None or isinstance( attributes[ "filename" ], ( str, unicode ) ), attributes[ "filename" ]
- self._filename = attributes[ "filename" ]
- if "patch" in attributes: # pragma no branch
- assert attributes[ "patch" ] is None or isinstance( attributes[ "patch" ], ( str, unicode ) ), attributes[ "patch" ]
- self._patch = attributes[ "patch" ]
- if "raw_url" in attributes: # pragma no branch
- assert attributes[ "raw_url" ] is None or isinstance( attributes[ "raw_url" ], ( str, unicode ) ), attributes[ "raw_url" ]
- self._raw_url = attributes[ "raw_url" ]
- 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 "status" in attributes: # pragma no branch
- assert attributes[ "status" ] is None or isinstance( attributes[ "status" ], ( str, unicode ) ), attributes[ "status" ]
- self._status = attributes[ "status" ]
+ def _useAttributes(self, attributes):
+ if "additions" in attributes: # pragma no branch
+ assert attributes["additions"] is None or isinstance(attributes["additions"], int), attributes["additions"]
+ self._additions = attributes["additions"]
+ if "blob_url" in attributes: # pragma no branch
+ assert attributes["blob_url"] is None or isinstance(attributes["blob_url"], (str, unicode)), attributes["blob_url"]
+ self._blob_url = attributes["blob_url"]
+ if "changes" in attributes: # pragma no branch
+ assert attributes["changes"] is None or isinstance(attributes["changes"], int), attributes["changes"]
+ self._changes = attributes["changes"]
+ if "deletions" in attributes: # pragma no branch
+ assert attributes["deletions"] is None or isinstance(attributes["deletions"], int), attributes["deletions"]
+ self._deletions = attributes["deletions"]
+ if "filename" in attributes: # pragma no branch
+ assert attributes["filename"] is None or isinstance(attributes["filename"], (str, unicode)), attributes["filename"]
+ self._filename = attributes["filename"]
+ if "patch" in attributes: # pragma no branch
+ assert attributes["patch"] is None or isinstance(attributes["patch"], (str, unicode)), attributes["patch"]
+ self._patch = attributes["patch"]
+ if "raw_url" in attributes: # pragma no branch
+ assert attributes["raw_url"] is None or isinstance(attributes["raw_url"], (str, unicode)), attributes["raw_url"]
+ self._raw_url = attributes["raw_url"]
+ 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 "status" in attributes: # pragma no branch
+ assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"]
+ self._status = attributes["status"]
diff --git a/github/Gist.py b/github/Gist.py
index df20199d..c3b382a5 100644
--- a/github/Gist.py
+++ b/github/Gist.py
@@ -21,84 +21,85 @@ import GistFile
import InputFileContent
import GistHistoryState
-class Gist( GithubObject.GithubObject ):
+
+class Gist(GithubObject.GithubObject):
@property
- def comments( self ):
- self._completeIfNotSet( self._comments )
- return self._NoneIfNotSet( self._comments )
+ def comments(self):
+ self._completeIfNotSet(self._comments)
+ return self._NoneIfNotSet(self._comments)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def description( self ):
- self._completeIfNotSet( self._description )
- return self._NoneIfNotSet( self._description )
+ def description(self):
+ self._completeIfNotSet(self._description)
+ return self._NoneIfNotSet(self._description)
@property
- def files( self ):
- self._completeIfNotSet( self._files )
- return self._NoneIfNotSet( self._files )
+ def files(self):
+ self._completeIfNotSet(self._files)
+ return self._NoneIfNotSet(self._files)
@property
- def fork_of( self ):
- self._completeIfNotSet( self._fork_of )
- return self._NoneIfNotSet( self._fork_of )
+ def fork_of(self):
+ self._completeIfNotSet(self._fork_of)
+ return self._NoneIfNotSet(self._fork_of)
@property
- def forks( self ):
- self._completeIfNotSet( self._forks )
- return self._NoneIfNotSet( self._forks )
+ def forks(self):
+ self._completeIfNotSet(self._forks)
+ return self._NoneIfNotSet(self._forks)
@property
- def git_pull_url( self ):
- self._completeIfNotSet( self._git_pull_url )
- return self._NoneIfNotSet( self._git_pull_url )
+ def git_pull_url(self):
+ self._completeIfNotSet(self._git_pull_url)
+ return self._NoneIfNotSet(self._git_pull_url)
@property
- def git_push_url( self ):
- self._completeIfNotSet( self._git_push_url )
- return self._NoneIfNotSet( self._git_push_url )
+ def git_push_url(self):
+ self._completeIfNotSet(self._git_push_url)
+ return self._NoneIfNotSet(self._git_push_url)
@property
- def history( self ):
- self._completeIfNotSet( self._history )
- return self._NoneIfNotSet( self._history )
+ def history(self):
+ self._completeIfNotSet(self._history)
+ return self._NoneIfNotSet(self._history)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def public( self ):
- self._completeIfNotSet( self._public )
- return self._NoneIfNotSet( self._public )
+ def public(self):
+ self._completeIfNotSet(self._public)
+ return self._NoneIfNotSet(self._public)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def user( self ):
- self._completeIfNotSet( self._user )
- return self._NoneIfNotSet( self._user )
+ def user(self):
+ self._completeIfNotSet(self._user)
+ return self._NoneIfNotSet(self._user)
- def create_comment( self, body ):
- assert isinstance( body, ( str, unicode ) ), body
+ def create_comment(self, body):
+ assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
}
@@ -108,18 +109,18 @@ class Gist( GithubObject.GithubObject ):
None,
post_parameters
)
- return GistComment.GistComment( self._requester, data, completed = True )
+ return GistComment.GistComment(self._requester, data, completed=True)
- def create_fork( self ):
+ def create_fork(self):
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/fork",
None,
None
)
- return Gist( self._requester, data, completed = True )
+ return Gist(self._requester, data, completed=True)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -127,33 +128,33 @@ 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=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
post_parameters = dict()
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
if files is not GithubObject.NotSet:
- post_parameters[ "files" ] = dict( ( key, value._identity ) for key, value in files.iteritems() )
+ post_parameters["files"] = dict((key, value._identity) for key, value in files.iteritems())
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def get_comment( self, id ):
- assert isinstance( id, int ), id
+ def get_comment(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- "/gists/comments/" + str( id ),
+ "/gists/comments/" + str(id),
None,
None
)
- return GistComment.GistComment( self._requester, data, completed = True )
+ return GistComment.GistComment(self._requester, data, completed=True)
- def get_comments( self ):
+ def get_comments(self):
return PaginatedList.PaginatedList(
GistComment.GistComment,
self._requester,
@@ -161,7 +162,7 @@ class Gist( GithubObject.GithubObject ):
None
)
- def is_starred( self ):
+ def is_starred(self):
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/star",
@@ -170,7 +171,7 @@ class Gist( GithubObject.GithubObject ):
)
return status == 204
- def reset_starred( self ):
+ def reset_starred(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/star",
@@ -178,7 +179,7 @@ class Gist( GithubObject.GithubObject ):
None
)
- def set_starred( self ):
+ def set_starred(self):
headers, data = self._requester.requestAndCheck(
"PUT",
self.url + "/star",
@@ -186,7 +187,7 @@ class Gist( GithubObject.GithubObject ):
None
)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._comments = GithubObject.NotSet
self._created_at = GithubObject.NotSet
self._description = GithubObject.NotSet
@@ -203,58 +204,58 @@ class Gist( GithubObject.GithubObject ):
self._url = GithubObject.NotSet
self._user = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "comments" in attributes: # pragma no branch
- assert attributes[ "comments" ] is None or isinstance( attributes[ "comments" ], int ), attributes[ "comments" ]
- self._comments = attributes[ "comments" ]
- 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" ] )
- if "description" in attributes: # pragma no branch
- assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
- self._description = attributes[ "description" ]
- 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 ) )
- for key, element in attributes[ "files" ].iteritems()
+ def _useAttributes(self, attributes):
+ if "comments" in attributes: # pragma no branch
+ assert attributes["comments"] is None or isinstance(attributes["comments"], int), attributes["comments"]
+ self._comments = attributes["comments"]
+ 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"])
+ if "description" in attributes: # pragma no branch
+ assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"]
+ self._description = attributes["description"]
+ 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))
+ for key, element in attributes["files"].iteritems()
)
- if "fork_of" in attributes: # pragma no branch
- assert attributes[ "fork_of" ] is None or isinstance( attributes[ "fork_of" ], dict ), attributes[ "fork_of" ]
- self._fork_of = None if attributes[ "fork_of" ] is None else Gist( self._requester, attributes[ "fork_of" ], completed = False )
- if "forks" in attributes: # pragma no branch
- assert attributes[ "forks" ] is None or all( isinstance( element, dict ) for element in attributes[ "forks" ] ), attributes[ "forks" ]
- self._forks = None if attributes[ "forks" ] is None else [
- Gist( self._requester, element, completed = False )
- for element in attributes[ "forks" ]
+ if "fork_of" in attributes: # pragma no branch
+ assert attributes["fork_of"] is None or isinstance(attributes["fork_of"], dict), attributes["fork_of"]
+ self._fork_of = None if attributes["fork_of"] is None else Gist(self._requester, attributes["fork_of"], completed=False)
+ if "forks" in attributes: # pragma no branch
+ assert attributes["forks"] is None or all(isinstance(element, dict) for element in attributes["forks"]), attributes["forks"]
+ self._forks = None if attributes["forks"] is None else [
+ Gist(self._requester, element, completed=False)
+ for element in attributes["forks"]
]
- if "git_pull_url" in attributes: # pragma no branch
- assert attributes[ "git_pull_url" ] is None or isinstance( attributes[ "git_pull_url" ], ( str, unicode ) ), attributes[ "git_pull_url" ]
- self._git_pull_url = attributes[ "git_pull_url" ]
- if "git_push_url" in attributes: # pragma no branch
- assert attributes[ "git_push_url" ] is None or isinstance( attributes[ "git_push_url" ], ( str, unicode ) ), attributes[ "git_push_url" ]
- self._git_push_url = attributes[ "git_push_url" ]
- 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 )
- for element in attributes[ "history" ]
+ if "git_pull_url" in attributes: # pragma no branch
+ assert attributes["git_pull_url"] is None or isinstance(attributes["git_pull_url"], (str, unicode)), attributes["git_pull_url"]
+ self._git_pull_url = attributes["git_pull_url"]
+ if "git_push_url" in attributes: # pragma no branch
+ assert attributes["git_push_url"] is None or isinstance(attributes["git_push_url"], (str, unicode)), attributes["git_push_url"]
+ self._git_push_url = attributes["git_push_url"]
+ 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)
+ for element in attributes["history"]
]
- 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" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], ( str, unicode ) ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "public" in attributes: # pragma no branch
- assert attributes[ "public" ] is None or isinstance( attributes[ "public" ], bool ), attributes[ "public" ]
- self._public = attributes[ "public" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- 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 )
+ 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"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], (str, unicode)), attributes["id"]
+ self._id = attributes["id"]
+ if "public" in attributes: # pragma no branch
+ assert attributes["public"] is None or isinstance(attributes["public"], bool), attributes["public"]
+ self._public = attributes["public"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ 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)
diff --git a/github/GistComment.py b/github/GistComment.py
index bd4d7eaa..4273987b 100644
--- a/github/GistComment.py
+++ b/github/GistComment.py
@@ -15,38 +15,39 @@ import GithubObject
import NamedUser
-class GistComment( GithubObject.GithubObject ):
+
+class GistComment(GithubObject.GithubObject):
@property
- def body( self ):
- self._completeIfNotSet( self._body )
- return self._NoneIfNotSet( self._body )
+ def body(self):
+ self._completeIfNotSet(self._body)
+ return self._NoneIfNotSet(self._body)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def user( self ):
- self._completeIfNotSet( self._user )
- return self._NoneIfNotSet( self._user )
+ def user(self):
+ self._completeIfNotSet(self._user)
+ return self._NoneIfNotSet(self._user)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -54,8 +55,8 @@ class GistComment( GithubObject.GithubObject ):
None
)
- def edit( self, body ):
- assert isinstance( body, ( str, unicode ) ), body
+ def edit(self, body):
+ assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
}
@@ -65,9 +66,9 @@ class GistComment( GithubObject.GithubObject ):
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._body = GithubObject.NotSet
self._created_at = GithubObject.NotSet
self._id = GithubObject.NotSet
@@ -75,22 +76,22 @@ class GistComment( GithubObject.GithubObject ):
self._url = GithubObject.NotSet
self._user = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "body" in attributes: # pragma no branch
- assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
- self._body = attributes[ "body" ]
- 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" ] )
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- 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 )
+ def _useAttributes(self, attributes):
+ if "body" in attributes: # pragma no branch
+ assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
+ self._body = attributes["body"]
+ 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"])
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ 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)
diff --git a/github/GistFile.py b/github/GistFile.py
index 3b4e418b..194f64ed 100644
--- a/github/GistFile.py
+++ b/github/GistFile.py
@@ -13,47 +13,48 @@
import GithubObject
-class GistFile( GithubObject.BasicGithubObject ):
+
+class GistFile(GithubObject.BasicGithubObject):
@property
- def content( self ):
- return self._NoneIfNotSet( self._content )
+ def content(self):
+ return self._NoneIfNotSet(self._content)
@property
- def filename( self ):
- return self._NoneIfNotSet( self._filename )
+ def filename(self):
+ return self._NoneIfNotSet(self._filename)
@property
- def language( self ):
- return self._NoneIfNotSet( self._language )
+ def language(self):
+ return self._NoneIfNotSet(self._language)
@property
- def raw_url( self ):
- return self._NoneIfNotSet( self._raw_url )
+ def raw_url(self):
+ return self._NoneIfNotSet(self._raw_url)
@property
- def size( self ):
- return self._NoneIfNotSet( self._size )
+ def size(self):
+ return self._NoneIfNotSet(self._size)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._content = GithubObject.NotSet
self._filename = GithubObject.NotSet
self._language = GithubObject.NotSet
self._raw_url = GithubObject.NotSet
self._size = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "content" in attributes: # pragma no branch
- assert attributes[ "content" ] is None or isinstance( attributes[ "content" ], ( str, unicode ) ), attributes[ "content" ]
- self._content = attributes[ "content" ]
- if "filename" in attributes: # pragma no branch
- assert attributes[ "filename" ] is None or isinstance( attributes[ "filename" ], ( str, unicode ) ), attributes[ "filename" ]
- self._filename = attributes[ "filename" ]
- if "language" in attributes: # pragma no branch
- assert attributes[ "language" ] is None or isinstance( attributes[ "language" ], ( str, unicode ) ), attributes[ "language" ]
- self._language = attributes[ "language" ]
- if "raw_url" in attributes: # pragma no branch
- assert attributes[ "raw_url" ] is None or isinstance( attributes[ "raw_url" ], ( str, unicode ) ), attributes[ "raw_url" ]
- self._raw_url = attributes[ "raw_url" ]
- if "size" in attributes: # pragma no branch
- assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ]
- self._size = attributes[ "size" ]
+ def _useAttributes(self, attributes):
+ if "content" in attributes: # pragma no branch
+ assert attributes["content"] is None or isinstance(attributes["content"], (str, unicode)), attributes["content"]
+ self._content = attributes["content"]
+ if "filename" in attributes: # pragma no branch
+ assert attributes["filename"] is None or isinstance(attributes["filename"], (str, unicode)), attributes["filename"]
+ self._filename = attributes["filename"]
+ if "language" in attributes: # pragma no branch
+ assert attributes["language"] is None or isinstance(attributes["language"], (str, unicode)), attributes["language"]
+ self._language = attributes["language"]
+ if "raw_url" in attributes: # pragma no branch
+ assert attributes["raw_url"] is None or isinstance(attributes["raw_url"], (str, unicode)), attributes["raw_url"]
+ self._raw_url = attributes["raw_url"]
+ if "size" in attributes: # pragma no branch
+ assert attributes["size"] is None or isinstance(attributes["size"], int), attributes["size"]
+ self._size = attributes["size"]
diff --git a/github/GistHistoryState.py b/github/GistHistoryState.py
index 016694a7..19a46abc 100644
--- a/github/GistHistoryState.py
+++ b/github/GistHistoryState.py
@@ -16,52 +16,53 @@ import GithubObject
import NamedUser
import CommitStats
-class GistHistoryState( GithubObject.GithubObject ):
+
+class GistHistoryState(GithubObject.GithubObject):
@property
- def change_status( self ):
- self._completeIfNotSet( self._change_status )
- return self._NoneIfNotSet( self._change_status )
+ def change_status(self):
+ self._completeIfNotSet(self._change_status)
+ return self._NoneIfNotSet(self._change_status)
@property
- def committed_at( self ):
- self._completeIfNotSet( self._committed_at )
- return self._NoneIfNotSet( self._committed_at )
+ def committed_at(self):
+ self._completeIfNotSet(self._committed_at)
+ return self._NoneIfNotSet(self._committed_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def user( self ):
- self._completeIfNotSet( self._user )
- return self._NoneIfNotSet( self._user )
+ def user(self):
+ self._completeIfNotSet(self._user)
+ return self._NoneIfNotSet(self._user)
@property
- def version( self ):
- self._completeIfNotSet( self._version )
- return self._NoneIfNotSet( self._version )
+ def version(self):
+ self._completeIfNotSet(self._version)
+ return self._NoneIfNotSet(self._version)
- def _initAttributes( self ):
+ 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
- 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 )
- 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" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- 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 )
- if "version" in attributes: # pragma no branch
- assert attributes[ "version" ] is None or isinstance( attributes[ "version" ], ( str, unicode ) ), attributes[ "version" ]
- self._version = attributes[ "version" ]
+ 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)
+ 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"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ 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)
+ if "version" in attributes: # pragma no branch
+ assert attributes["version"] is None or isinstance(attributes["version"], (str, unicode)), attributes["version"]
+ self._version = attributes["version"]
diff --git a/github/GitAuthor.py b/github/GitAuthor.py
index 8542229b..4e99645b 100644
--- a/github/GitAuthor.py
+++ b/github/GitAuthor.py
@@ -13,31 +13,32 @@
import GithubObject
-class GitAuthor( GithubObject.BasicGithubObject ):
+
+class GitAuthor(GithubObject.BasicGithubObject):
@property
- def date( self ):
- return self._NoneIfNotSet( self._date )
+ def date(self):
+ return self._NoneIfNotSet(self._date)
@property
- def email( self ):
- return self._NoneIfNotSet( self._email )
+ def email(self):
+ return self._NoneIfNotSet(self._email)
@property
- def name( self ):
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ return self._NoneIfNotSet(self._name)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._date = GithubObject.NotSet
self._email = GithubObject.NotSet
self._name = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "date" in attributes: # pragma no branch
- assert attributes[ "date" ] is None or isinstance( attributes[ "date" ], ( str, unicode ) ), attributes[ "date" ]
- self._date = self._parseDatetime( attributes[ "date" ] )
- if "email" in attributes: # pragma no branch
- assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ]
- self._email = attributes[ "email" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
+ def _useAttributes(self, attributes):
+ if "date" in attributes: # pragma no branch
+ assert attributes["date"] is None or isinstance(attributes["date"], (str, unicode)), attributes["date"]
+ self._date = self._parseDatetime(attributes["date"])
+ if "email" in attributes: # pragma no branch
+ assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"]
+ self._email = attributes["email"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
diff --git a/github/GitBlob.py b/github/GitBlob.py
index 1a883c77..6e47584a 100644
--- a/github/GitBlob.py
+++ b/github/GitBlob.py
@@ -13,52 +13,53 @@
import GithubObject
-class GitBlob( GithubObject.GithubObject ):
+
+class GitBlob(GithubObject.GithubObject):
@property
- def content( self ):
- self._completeIfNotSet( self._content )
- return self._NoneIfNotSet( self._content )
+ def content(self):
+ self._completeIfNotSet(self._content)
+ return self._NoneIfNotSet(self._content)
@property
- def encoding( self ):
- self._completeIfNotSet( self._encoding )
- return self._NoneIfNotSet( self._encoding )
+ def encoding(self):
+ self._completeIfNotSet(self._encoding)
+ return self._NoneIfNotSet(self._encoding)
@property
- def sha( self ):
- self._completeIfNotSet( self._sha )
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ self._completeIfNotSet(self._sha)
+ return self._NoneIfNotSet(self._sha)
@property
- def size( self ):
- self._completeIfNotSet( self._size )
- return self._NoneIfNotSet( self._size )
+ def size(self):
+ self._completeIfNotSet(self._size)
+ return self._NoneIfNotSet(self._size)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._content = GithubObject.NotSet
self._encoding = GithubObject.NotSet
self._sha = GithubObject.NotSet
self._size = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "content" in attributes: # pragma no branch
- assert attributes[ "content" ] is None or isinstance( attributes[ "content" ], ( str, unicode ) ), attributes[ "content" ]
- self._content = attributes[ "content" ]
- if "encoding" in attributes: # pragma no branch
- assert attributes[ "encoding" ] is None or isinstance( attributes[ "encoding" ], ( str, unicode ) ), attributes[ "encoding" ]
- self._encoding = attributes[ "encoding" ]
- 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 "size" in attributes: # pragma no branch
- assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ]
- self._size = attributes[ "size" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "content" in attributes: # pragma no branch
+ assert attributes["content"] is None or isinstance(attributes["content"], (str, unicode)), attributes["content"]
+ self._content = attributes["content"]
+ if "encoding" in attributes: # pragma no branch
+ assert attributes["encoding"] is None or isinstance(attributes["encoding"], (str, unicode)), attributes["encoding"]
+ self._encoding = attributes["encoding"]
+ 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 "size" in attributes: # pragma no branch
+ assert attributes["size"] is None or isinstance(attributes["size"], int), attributes["size"]
+ self._size = attributes["size"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/GitCommit.py b/github/GitCommit.py
index 3feb4624..cd3a7057 100644
--- a/github/GitCommit.py
+++ b/github/GitCommit.py
@@ -17,47 +17,48 @@ import GitAuthor
import GitCommit
import GitTree
-class GitCommit( GithubObject.GithubObject ):
+
+class GitCommit(GithubObject.GithubObject):
@property
- def author( self ):
- self._completeIfNotSet( self._author )
- return self._NoneIfNotSet( self._author )
+ def author(self):
+ self._completeIfNotSet(self._author)
+ return self._NoneIfNotSet(self._author)
@property
- def committer( self ):
- self._completeIfNotSet( self._committer )
- return self._NoneIfNotSet( self._committer )
+ def committer(self):
+ self._completeIfNotSet(self._committer)
+ return self._NoneIfNotSet(self._committer)
@property
- def message( self ):
- self._completeIfNotSet( self._message )
- return self._NoneIfNotSet( self._message )
+ def message(self):
+ self._completeIfNotSet(self._message)
+ return self._NoneIfNotSet(self._message)
@property
- def parents( self ):
- self._completeIfNotSet( self._parents )
- return self._NoneIfNotSet( self._parents )
+ def parents(self):
+ self._completeIfNotSet(self._parents)
+ return self._NoneIfNotSet(self._parents)
@property
- def sha( self ):
- self._completeIfNotSet( self._sha )
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ self._completeIfNotSet(self._sha)
+ return self._NoneIfNotSet(self._sha)
@property
- def tree( self ):
- self._completeIfNotSet( self._tree )
- return self._NoneIfNotSet( self._tree )
+ def tree(self):
+ self._completeIfNotSet(self._tree)
+ return self._NoneIfNotSet(self._tree)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def _identity( self ):
+ def _identity(self):
return self.sha
- def _initAttributes( self ):
+ def _initAttributes(self):
self._author = GithubObject.NotSet
self._committer = GithubObject.NotSet
self._message = GithubObject.NotSet
@@ -66,28 +67,28 @@ class GitCommit( GithubObject.GithubObject ):
self._tree = GithubObject.NotSet
self._url = 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 )
- 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 )
- if "message" in attributes: # pragma no branch
- assert attributes[ "message" ] is None or isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ]
- self._message = attributes[ "message" ]
- if "parents" in attributes: # pragma no branch
- assert attributes[ "parents" ] is None or all( isinstance( element, dict ) for element in attributes[ "parents" ] ), attributes[ "parents" ]
- self._parents = None if attributes[ "parents" ] is None else [
- GitCommit( self._requester, element, completed = False )
- for element in attributes[ "parents" ]
+ 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)
+ 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)
+ if "message" in attributes: # pragma no branch
+ assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"]
+ self._message = attributes["message"]
+ if "parents" in attributes: # pragma no branch
+ assert attributes["parents"] is None or all(isinstance(element, dict) for element in attributes["parents"]), attributes["parents"]
+ self._parents = None if attributes["parents"] is None else [
+ GitCommit(self._requester, element, completed=False)
+ for element in attributes["parents"]
]
- 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 "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 )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ 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 "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)
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/GitObject.py b/github/GitObject.py
index 8e5126a0..15ed92b5 100644
--- a/github/GitObject.py
+++ b/github/GitObject.py
@@ -13,31 +13,32 @@
import GithubObject
-class GitObject( GithubObject.BasicGithubObject ):
+
+class GitObject(GithubObject.BasicGithubObject):
@property
- def sha( self ):
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ return self._NoneIfNotSet(self._sha)
@property
- def type( self ):
- return self._NoneIfNotSet( self._type )
+ def type(self):
+ return self._NoneIfNotSet(self._type)
@property
- def url( self ):
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ return self._NoneIfNotSet(self._url)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._sha = GithubObject.NotSet
self._type = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- 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 "type" in attributes: # pragma no branch
- assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
- self._type = attributes[ "type" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ 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 "type" in attributes: # pragma no branch
+ assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"]
+ self._type = attributes["type"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/GitRef.py b/github/GitRef.py
index b9cfee0c..eab64cc8 100644
--- a/github/GitRef.py
+++ b/github/GitRef.py
@@ -15,23 +15,24 @@ import GithubObject
import GitObject
-class GitRef( GithubObject.GithubObject ):
+
+class GitRef(GithubObject.GithubObject):
@property
- def object( self ):
- self._completeIfNotSet( self._object )
- return self._NoneIfNotSet( self._object )
+ def object(self):
+ self._completeIfNotSet(self._object)
+ return self._NoneIfNotSet(self._object)
@property
- def ref( self ):
- self._completeIfNotSet( self._ref )
- return self._NoneIfNotSet( self._ref )
+ def ref(self):
+ self._completeIfNotSet(self._ref)
+ return self._NoneIfNotSet(self._ref)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -39,34 +40,34 @@ class GitRef( GithubObject.GithubObject ):
None
)
- def edit( self, sha, force = GithubObject.NotSet ):
- assert isinstance( sha, ( str, unicode ) ), sha
- assert force is GithubObject.NotSet or isinstance( force, bool ), force
+ def edit(self, sha, force=GithubObject.NotSet):
+ assert isinstance(sha, (str, unicode)), sha
+ assert force is GithubObject.NotSet or isinstance(force, bool), force
post_parameters = {
"sha": sha,
}
if force is not GithubObject.NotSet:
- post_parameters[ "force" ] = force
+ post_parameters["force"] = force
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._object = GithubObject.NotSet
self._ref = GithubObject.NotSet
self._url = 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 )
- if "ref" in attributes: # pragma no branch
- assert attributes[ "ref" ] is None or isinstance( attributes[ "ref" ], ( str, unicode ) ), attributes[ "ref" ]
- self._ref = attributes[ "ref" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ 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)
+ if "ref" in attributes: # pragma no branch
+ assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"]
+ self._ref = attributes["ref"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/GitTag.py b/github/GitTag.py
index 01594b33..e8a030b1 100644
--- a/github/GitTag.py
+++ b/github/GitTag.py
@@ -16,38 +16,39 @@ import GithubObject
import GitAuthor
import GitObject
-class GitTag( GithubObject.GithubObject ):
+
+class GitTag(GithubObject.GithubObject):
@property
- def message( self ):
- self._completeIfNotSet( self._message )
- return self._NoneIfNotSet( self._message )
+ def message(self):
+ self._completeIfNotSet(self._message)
+ return self._NoneIfNotSet(self._message)
@property
- def object( self ):
- self._completeIfNotSet( self._object )
- return self._NoneIfNotSet( self._object )
+ def object(self):
+ self._completeIfNotSet(self._object)
+ return self._NoneIfNotSet(self._object)
@property
- def sha( self ):
- self._completeIfNotSet( self._sha )
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ self._completeIfNotSet(self._sha)
+ return self._NoneIfNotSet(self._sha)
@property
- def tag( self ):
- self._completeIfNotSet( self._tag )
- return self._NoneIfNotSet( self._tag )
+ def tag(self):
+ self._completeIfNotSet(self._tag)
+ return self._NoneIfNotSet(self._tag)
@property
- def tagger( self ):
- self._completeIfNotSet( self._tagger )
- return self._NoneIfNotSet( self._tagger )
+ def tagger(self):
+ self._completeIfNotSet(self._tagger)
+ return self._NoneIfNotSet(self._tagger)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._message = GithubObject.NotSet
self._object = GithubObject.NotSet
self._sha = GithubObject.NotSet
@@ -55,22 +56,22 @@ class GitTag( GithubObject.GithubObject ):
self._tagger = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "message" in attributes: # pragma no branch
- assert attributes[ "message" ] is None or isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ]
- 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 )
- 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 "tag" in attributes: # pragma no branch
- assert attributes[ "tag" ] is None or isinstance( attributes[ "tag" ], ( str, unicode ) ), attributes[ "tag" ]
- 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 )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "message" in attributes: # pragma no branch
+ assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"]
+ 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)
+ 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 "tag" in attributes: # pragma no branch
+ assert attributes["tag"] is None or isinstance(attributes["tag"], (str, unicode)), attributes["tag"]
+ 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)
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/GitTree.py b/github/GitTree.py
index 690cb6c7..70c5b64e 100644
--- a/github/GitTree.py
+++ b/github/GitTree.py
@@ -15,41 +15,42 @@ import GithubObject
import GitTreeElement
-class GitTree( GithubObject.GithubObject ):
+
+class GitTree(GithubObject.GithubObject):
@property
- def sha( self ):
- self._completeIfNotSet( self._sha )
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ self._completeIfNotSet(self._sha)
+ return self._NoneIfNotSet(self._sha)
@property
- def tree( self ):
- self._completeIfNotSet( self._tree )
- return self._NoneIfNotSet( self._tree )
+ def tree(self):
+ self._completeIfNotSet(self._tree)
+ return self._NoneIfNotSet(self._tree)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def _identity( self ):
+ def _identity(self):
return self.sha
- def _initAttributes( self ):
+ def _initAttributes(self):
self._sha = GithubObject.NotSet
self._tree = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- 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 "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 )
- for element in attributes[ "tree" ]
+ def _useAttributes(self, attributes):
+ 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 "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)
+ for element in attributes["tree"]
]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py
index bb075cd3..6c5c463b 100644
--- a/github/GitTreeElement.py
+++ b/github/GitTreeElement.py
@@ -13,32 +13,33 @@
import GithubObject
-class GitTreeElement( GithubObject.BasicGithubObject ):
+
+class GitTreeElement(GithubObject.BasicGithubObject):
@property
- def mode( self ):
- return self._NoneIfNotSet( self._mode )
+ def mode(self):
+ return self._NoneIfNotSet(self._mode)
@property
- def path( self ):
- return self._NoneIfNotSet( self._path )
+ def path(self):
+ return self._NoneIfNotSet(self._path)
@property
- def sha( self ):
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ return self._NoneIfNotSet(self._sha)
@property
- def size( self ):
- return self._NoneIfNotSet( self._size )
+ def size(self):
+ return self._NoneIfNotSet(self._size)
@property
- def type( self ):
- return self._NoneIfNotSet( self._type )
+ def type(self):
+ return self._NoneIfNotSet(self._type)
@property
- def url( self ):
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ return self._NoneIfNotSet(self._url)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._mode = GithubObject.NotSet
self._path = GithubObject.NotSet
self._sha = GithubObject.NotSet
@@ -46,22 +47,22 @@ class GitTreeElement( GithubObject.BasicGithubObject ):
self._type = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "mode" in attributes: # pragma no branch
- assert attributes[ "mode" ] is None or isinstance( attributes[ "mode" ], ( str, unicode ) ), attributes[ "mode" ]
- self._mode = attributes[ "mode" ]
- if "path" in attributes: # pragma no branch
- assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ]
- self._path = attributes[ "path" ]
- 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 "size" in attributes: # pragma no branch
- assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ]
- self._size = attributes[ "size" ]
- if "type" in attributes: # pragma no branch
- assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
- self._type = attributes[ "type" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "mode" in attributes: # pragma no branch
+ assert attributes["mode"] is None or isinstance(attributes["mode"], (str, unicode)), attributes["mode"]
+ self._mode = attributes["mode"]
+ if "path" in attributes: # pragma no branch
+ assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"]
+ self._path = attributes["path"]
+ 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 "size" in attributes: # pragma no branch
+ assert attributes["size"] is None or isinstance(attributes["size"], int), attributes["size"]
+ self._size = attributes["size"]
+ if "type" in attributes: # pragma no branch
+ assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"]
+ self._type = attributes["type"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/Github.py b/github/Github.py
index fa8b63e7..4ae6c60a 100644
--- a/github/Github.py
+++ b/github/Github.py
@@ -24,21 +24,23 @@ import Legacy
import GithubObject
import HookDescription
+
DEFAULT_BASE_URL = "https://api.github.com"
DEFAULT_TIMEOUT = 10
-class Github( object ):
- def __init__( self, login_or_token = None, password = None, base_url = DEFAULT_BASE_URL, timeout = DEFAULT_TIMEOUT):
- self.__requester = Requester( login_or_token, password, base_url, timeout )
+
+class Github(object):
+ def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL, timeout=DEFAULT_TIMEOUT):
+ self.__requester = Requester(login_or_token, password, base_url, timeout)
@property
- def rate_limiting( self ):
+ 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
+ def get_user(self, login=GithubObject.NotSet):
+ assert login is GithubObject.NotSet or isinstance(login, (str, unicode)), login
if login is GithubObject.NotSet:
- return AuthenticatedUser.AuthenticatedUser( self.__requester, { "url": "/user" }, completed = False )
+ return AuthenticatedUser.AuthenticatedUser(self.__requester, {"url": "/user"}, completed=False)
else:
headers, data = self.__requester.requestAndCheck(
"GET",
@@ -46,29 +48,29 @@ class Github( object ):
None,
None
)
- return NamedUser.NamedUser( self.__requester, data, completed = True )
+ return NamedUser.NamedUser(self.__requester, data, completed=True)
- def get_organization( self, login ):
- assert isinstance( login, ( str, unicode ) ), login
+ def get_organization(self, login):
+ assert isinstance(login, (str, unicode)), login
headers, data = self.__requester.requestAndCheck(
"GET",
"/orgs/" + login,
None,
None
)
- return Organization.Organization( self.__requester, data, completed = True )
+ return Organization.Organization(self.__requester, data, completed=True)
- def get_gist( self, id ):
- assert isinstance( id, ( str, unicode ) ), id
+ def get_gist(self, id):
+ assert isinstance(id, (str, unicode)), id
headers, data = self.__requester.requestAndCheck(
"GET",
"/gists/" + id,
None,
None
)
- return Gist.Gist( self.__requester, data, completed = True )
+ return Gist.Gist(self.__requester, data, completed=True)
- def get_gists( self ):
+ def get_gists(self):
return PaginatedList.PaginatedList(
Gist.Gist,
self.__requester,
@@ -76,12 +78,12 @@ class Github( object ):
None
)
- def legacy_search_repos( self, keyword, language = 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 }
+ def legacy_search_repos(self, keyword, language=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}
return Legacy.PaginatedList(
- "/legacy/repos/search/" + urllib.quote( keyword ),
+ "/legacy/repos/search/" + urllib.quote(keyword),
args,
self.__requester,
"repositories",
@@ -89,10 +91,10 @@ class Github( object ):
Repository.Repository,
)
- def legacy_search_users( self, keyword ):
- assert isinstance( keyword, ( str, unicode ) ), keyword
+ def legacy_search_users(self, keyword):
+ assert isinstance(keyword, (str, unicode)), keyword
return Legacy.PaginatedList(
- "/legacy/user/search/" + urllib.quote( keyword ),
+ "/legacy/user/search/" + urllib.quote(keyword),
{},
self.__requester,
"users",
@@ -100,25 +102,25 @@ class Github( object ):
NamedUser.NamedUser,
)
- def legacy_search_user_by_email( self, email ):
- assert isinstance( email, ( str, unicode ) ), email
+ def legacy_search_user_by_email(self, email):
+ assert isinstance(email, (str, unicode)), email
headers, data = self.__requester.requestAndCheck(
"GET",
"/legacy/user/email/" + email,
None,
None
)
- return NamedUser.NamedUser( self.__requester, Legacy.convertUser( data[ "user" ] ), completed = False )
+ return NamedUser.NamedUser(self.__requester, Legacy.convertUser(data["user"]), completed=False)
- def render_markdown( self, text, context = GithubObject.NotSet ):
- assert isinstance( text, ( str, unicode ) ), text
- assert context is GithubObject.NotSet or isinstance( context, Repository.Repository ), context
+ def render_markdown(self, text, context=GithubObject.NotSet):
+ assert isinstance(text, (str, unicode)), text
+ assert context is GithubObject.NotSet or isinstance(context, Repository.Repository), context
post_parameters = {
"text": text
}
if context is not GithubObject.NotSet:
- post_parameters[ "mode" ] = "gfm"
- post_parameters[ "context" ] = context._identity
+ post_parameters["mode"] = "gfm"
+ post_parameters["context"] = context._identity
status, headers, data = self.__requester.requestRaw(
"POST",
"/markdown",
@@ -127,11 +129,11 @@ class Github( object ):
)
return data
- def get_hooks( self ):
+ def get_hooks(self):
headers, data = self.__requester.requestAndCheck(
"GET",
"/hooks",
None,
None
)
- return [ HookDescription.HookDescription( self.__requester, attributes, completed = True ) for attributes in data ]
+ return [HookDescription.HookDescription(self.__requester, attributes, completed=True) for attributes in data]
diff --git a/github/GithubException.py b/github/GithubException.py
index daeb6463..626ab238 100644
--- a/github/GithubException.py
+++ b/github/GithubException.py
@@ -11,11 +11,12 @@
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-class GithubException( Exception ):
- def __init__( self, status, data ):
- Exception.__init__( self )
+
+class GithubException(Exception):
+ def __init__(self, status, data):
+ Exception.__init__(self)
self.status = status
self.data = data
- def __str__( self ):
- return str( self.status ) + " " + str( self.data )
+ def __str__(self):
+ return str(self.status) + " " + str(self.data)
diff --git a/github/GithubObject.py b/github/GithubObject.py
index 10d2f789..8448e70d 100644
--- a/github/GithubObject.py
+++ b/github/GithubObject.py
@@ -15,53 +15,56 @@ import datetime
import GithubException
+
class _NotSetType:
pass
NotSet = _NotSetType()
-class BasicGithubObject( object ):
- def __init__( self, requester, attributes, completed ): ### 'completed' may be removed if I find a way
+
+class BasicGithubObject(object):
+ def __init__(self, requester, attributes, completed): # 'completed' may be removed if I find a way
self._requester = requester
self._initAttributes()
- self._useAttributes( attributes )
+ self._useAttributes(attributes)
@staticmethod
- def _parentUrl( url ):
- return "/".join( url.split( "/" )[ : -1 ] )
+ def _parentUrl(url):
+ return "/".join(url.split("/")[: -1])
@staticmethod
- def _NoneIfNotSet( value ):
+ def _NoneIfNotSet(value):
if value is NotSet:
return None
else:
return value
@staticmethod
- def _parseDatetime( s ):
+ def _parseDatetime(s):
if s is None:
return None
- elif len( s ) == 24:
- return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%S.000Z" )
- elif len( s ) == 25:
- return datetime.datetime.strptime( s[ : 19 ], "%Y-%m-%dT%H:%M:%S" ) + ( 1 if s[ 19 ] == '-' else -1 ) * datetime.timedelta( hours = int( s[ 20 : 22 ] ), minutes = int( s[ 23 : 25 ] ) )
+ elif len(s) == 24:
+ return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z")
+ elif len(s) == 25:
+ return datetime.datetime.strptime(s[:19], "%Y-%m-%dT%H:%M:%S") + (1 if s[19] == '-' else -1) * datetime.timedelta(hours=int(s[20:22]), minutes=int(s[23:25]))
else:
- return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%SZ" )
+ return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ")
-class GithubObject( BasicGithubObject ):
- def __init__( self, requester, attributes, completed ):
- BasicGithubObject.__init__( self, requester, attributes, completed )
+
+class GithubObject(BasicGithubObject):
+ def __init__(self, requester, attributes, completed):
+ BasicGithubObject.__init__(self, requester, attributes, completed)
self.__completed = completed
- def _completeIfNotSet( self, value ):
+ def _completeIfNotSet(self, value):
if not self.__completed and value is NotSet:
self.__complete()
- def __complete( self ):
+ def __complete(self):
headers, data = self._requester.requestAndCheck(
"GET",
self._url,
None,
None
)
- self._useAttributes( data )
+ self._useAttributes(data)
self._completed = True
diff --git a/github/Hook.py b/github/Hook.py
index ad7f49f2..cabc5f5a 100644
--- a/github/Hook.py
+++ b/github/Hook.py
@@ -15,53 +15,54 @@ import GithubObject
import HookResponse
-class Hook( GithubObject.GithubObject ):
+
+class Hook(GithubObject.GithubObject):
@property
- def active( self ):
- self._completeIfNotSet( self._active )
- return self._NoneIfNotSet( self._active )
+ def active(self):
+ self._completeIfNotSet(self._active)
+ return self._NoneIfNotSet(self._active)
@property
- def config( self ):
- self._completeIfNotSet( self._config )
- return self._NoneIfNotSet( self._config )
+ def config(self):
+ self._completeIfNotSet(self._config)
+ return self._NoneIfNotSet(self._config)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def events( self ):
- self._completeIfNotSet( self._events )
- return self._NoneIfNotSet( self._events )
+ def events(self):
+ self._completeIfNotSet(self._events)
+ return self._NoneIfNotSet(self._events)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def last_response( self ):
- self._completeIfNotSet( self._last_response )
- return self._NoneIfNotSet( self._last_response )
+ def last_response(self):
+ self._completeIfNotSet(self._last_response)
+ return self._NoneIfNotSet(self._last_response)
@property
- def name( self ):
- self._completeIfNotSet( self._name )
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ self._completeIfNotSet(self._name)
+ return self._NoneIfNotSet(self._name)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -69,34 +70,34 @@ class Hook( GithubObject.GithubObject ):
None
)
- def edit( self, name, config, events = GithubObject.NotSet, add_events = GithubObject.NotSet, remove_events = GithubObject.NotSet, active = 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
+ def edit(self, name, config, events=GithubObject.NotSet, add_events=GithubObject.NotSet, remove_events=GithubObject.NotSet, active=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
post_parameters = {
"name": name,
"config": config,
}
if events is not GithubObject.NotSet:
- post_parameters[ "events" ] = events
+ post_parameters["events"] = events
if add_events is not GithubObject.NotSet:
- post_parameters[ "add_events" ] = add_events
+ post_parameters["add_events"] = add_events
if remove_events is not GithubObject.NotSet:
- post_parameters[ "remove_events" ] = remove_events
+ post_parameters["remove_events"] = remove_events
if active is not GithubObject.NotSet:
- post_parameters[ "active" ] = active
+ post_parameters["active"] = active
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def test( self ):
+ def test(self):
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/test",
@@ -104,7 +105,7 @@ class Hook( GithubObject.GithubObject ):
None
)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._active = GithubObject.NotSet
self._config = GithubObject.NotSet
self._created_at = GithubObject.NotSet
@@ -115,31 +116,31 @@ class Hook( GithubObject.GithubObject ):
self._updated_at = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "active" in attributes: # pragma no branch
- assert attributes[ "active" ] is None or isinstance( attributes[ "active" ], bool ), attributes[ "active" ]
- self._active = attributes[ "active" ]
- if "config" in attributes: # pragma no branch
- assert attributes[ "config" ] is None or isinstance( attributes[ "config" ], dict ), attributes[ "config" ]
- self._config = attributes[ "config" ]
- 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" ] )
- if "events" in attributes: # pragma no branch
- assert attributes[ "events" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "events" ] ), attributes[ "events" ]
- self._events = attributes[ "events" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- 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 )
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "active" in attributes: # pragma no branch
+ assert attributes["active"] is None or isinstance(attributes["active"], bool), attributes["active"]
+ self._active = attributes["active"]
+ if "config" in attributes: # pragma no branch
+ assert attributes["config"] is None or isinstance(attributes["config"], dict), attributes["config"]
+ self._config = attributes["config"]
+ 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"])
+ if "events" in attributes: # pragma no branch
+ assert attributes["events"] is None or all(isinstance(element, (str, unicode)) for element in attributes["events"]), attributes["events"]
+ self._events = attributes["events"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ 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)
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/HookDescription.py b/github/HookDescription.py
index eb329fd4..6dd0d143 100644
--- a/github/HookDescription.py
+++ b/github/HookDescription.py
@@ -13,39 +13,40 @@
import GithubObject
-class HookDescription( GithubObject.BasicGithubObject ):
+
+class HookDescription(GithubObject.BasicGithubObject):
@property
- def events( self ):
- return self._NoneIfNotSet( self._events )
+ def events(self):
+ return self._NoneIfNotSet(self._events)
@property
- def name( self ):
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ return self._NoneIfNotSet(self._name)
@property
- def schema( self ):
- return self._NoneIfNotSet( self._schema )
+ def schema(self):
+ return self._NoneIfNotSet(self._schema)
@property
- def supported_events( self ):
- return self._NoneIfNotSet( self._supported_events )
+ def supported_events(self):
+ return self._NoneIfNotSet(self._supported_events)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._events = GithubObject.NotSet
self._name = GithubObject.NotSet
self._schema = GithubObject.NotSet
self._supported_events = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "events" in attributes: # pragma no branch
- assert attributes[ "events" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "events" ] ), attributes[ "events" ]
- self._events = attributes[ "events" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "schema" in attributes: # pragma no branch
- assert attributes[ "schema" ] is None or all( isinstance( element, list ) for element in attributes[ "schema" ] ), attributes[ "schema" ]
- self._schema = attributes[ "schema" ]
- if "supported_events" in attributes: # pragma no branch
- assert attributes[ "supported_events" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "supported_events" ] ), attributes[ "supported_events" ]
- self._supported_events = attributes[ "supported_events" ]
+ def _useAttributes(self, attributes):
+ if "events" in attributes: # pragma no branch
+ assert attributes["events"] is None or all(isinstance(element, (str, unicode)) for element in attributes["events"]), attributes["events"]
+ self._events = attributes["events"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "schema" in attributes: # pragma no branch
+ assert attributes["schema"] is None or all(isinstance(element, list) for element in attributes["schema"]), attributes["schema"]
+ self._schema = attributes["schema"]
+ if "supported_events" in attributes: # pragma no branch
+ assert attributes["supported_events"] is None or all(isinstance(element, (str, unicode)) for element in attributes["supported_events"]), attributes["supported_events"]
+ self._supported_events = attributes["supported_events"]
diff --git a/github/HookResponse.py b/github/HookResponse.py
index 158bfb85..c09cfc86 100644
--- a/github/HookResponse.py
+++ b/github/HookResponse.py
@@ -13,31 +13,32 @@
import GithubObject
-class HookResponse( GithubObject.BasicGithubObject ):
+
+class HookResponse(GithubObject.BasicGithubObject):
@property
- def code( self ):
- return self._NoneIfNotSet( self._code )
+ def code(self):
+ return self._NoneIfNotSet(self._code)
@property
- def message( self ):
- return self._NoneIfNotSet( self._message )
+ def message(self):
+ return self._NoneIfNotSet(self._message)
@property
- def status( self ):
- return self._NoneIfNotSet( self._status )
+ def status(self):
+ return self._NoneIfNotSet(self._status)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._code = GithubObject.NotSet
self._message = GithubObject.NotSet
self._status = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "code" in attributes: # pragma no branch
- assert attributes[ "code" ] is None or isinstance( attributes[ "code" ], int ), attributes[ "code" ]
- self._code = attributes[ "code" ]
- if "message" in attributes: # pragma no branch
- assert attributes[ "message" ] is None or isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ]
- self._message = attributes[ "message" ]
- if "status" in attributes: # pragma no branch
- assert attributes[ "status" ] is None or isinstance( attributes[ "status" ], ( str, unicode ) ), attributes[ "status" ]
- self._status = attributes[ "status" ]
+ def _useAttributes(self, attributes):
+ if "code" in attributes: # pragma no branch
+ assert attributes["code"] is None or isinstance(attributes["code"], int), attributes["code"]
+ self._code = attributes["code"]
+ if "message" in attributes: # pragma no branch
+ assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"]
+ self._message = attributes["message"]
+ if "status" in attributes: # pragma no branch
+ assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"]
+ self._status = attributes["status"]
diff --git a/github/InputFileContent.py b/github/InputFileContent.py
index 2977b2fa..f46ab975 100644
--- a/github/InputFileContent.py
+++ b/github/InputFileContent.py
@@ -11,12 +11,13 @@
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-class InputFileContent( object ):
- def __init__( self, content ):
+
+class InputFileContent(object):
+ def __init__(self, content):
self.__content = content
@property
- def _identity( self ):
+ def _identity(self):
return {
"content": self.__content,
}
diff --git a/github/InputGitAuthor.py b/github/InputGitAuthor.py
index 24e340fd..c2cf8d9d 100644
--- a/github/InputGitAuthor.py
+++ b/github/InputGitAuthor.py
@@ -11,14 +11,15 @@
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see .
-class InputGitAuthor( object ):
- def __init__( self, name, email, date ):
+
+class InputGitAuthor(object):
+ def __init__(self, name, email, date):
self.__name = name
self.__email = email
self.__date = date
@property
- def _identity( self ):
+ def _identity(self):
return {
"name": self.__name,
"email": self.__email,
diff --git a/github/InputGitTreeElement.py b/github/InputGitTreeElement.py
index 96274487..290d3793 100644
--- a/github/InputGitTreeElement.py
+++ b/github/InputGitTreeElement.py
@@ -13,8 +13,9 @@
import GithubObject
-class InputGitTreeElement( object ):
- def __init__( self, path, mode, type, content = GithubObject.NotSet, sha = GithubObject.NotSet ):
+
+class InputGitTreeElement(object):
+ def __init__(self, path, mode, type, content=GithubObject.NotSet, sha=GithubObject.NotSet):
self.__path = path
self.__mode = mode
self.__type = type
@@ -22,14 +23,14 @@ class InputGitTreeElement( object ):
self.__sha = sha
@property
- def _identity( self ):
+ def _identity(self):
identity = {
"path": self.__path,
"mode": self.__mode,
"type": self.__type,
}
if self.__sha is not GithubObject.NotSet:
- identity[ "sha" ] = self.__sha
+ identity["sha"] = self.__sha
if self.__content is not GithubObject.NotSet:
- identity[ "content" ] = self.__content
+ identity["content"] = self.__content
return identity
diff --git a/github/Issue.py b/github/Issue.py
index 0a6288cb..859c8097 100644
--- a/github/Issue.py
+++ b/github/Issue.py
@@ -22,100 +22,101 @@ import Milestone
import IssueComment
import IssuePullRequest
-class Issue( GithubObject.GithubObject ):
+
+class Issue(GithubObject.GithubObject):
@property
- def assignee( self ):
- self._completeIfNotSet( self._assignee )
- return self._NoneIfNotSet( self._assignee )
+ def assignee(self):
+ self._completeIfNotSet(self._assignee)
+ return self._NoneIfNotSet(self._assignee)
@property
- def body( self ):
- self._completeIfNotSet( self._body )
- return self._NoneIfNotSet( self._body )
+ def body(self):
+ self._completeIfNotSet(self._body)
+ return self._NoneIfNotSet(self._body)
@property
- def closed_at( self ):
- self._completeIfNotSet( self._closed_at )
- return self._NoneIfNotSet( self._closed_at )
+ def closed_at(self):
+ self._completeIfNotSet(self._closed_at)
+ return self._NoneIfNotSet(self._closed_at)
@property
- def closed_by( self ):
- self._completeIfNotSet( self._closed_by )
- return self._NoneIfNotSet( self._closed_by )
+ def closed_by(self):
+ self._completeIfNotSet(self._closed_by)
+ return self._NoneIfNotSet(self._closed_by)
@property
- def comments( self ):
- self._completeIfNotSet( self._comments )
- return self._NoneIfNotSet( self._comments )
+ def comments(self):
+ self._completeIfNotSet(self._comments)
+ return self._NoneIfNotSet(self._comments)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def labels( self ):
- self._completeIfNotSet( self._labels )
- return self._NoneIfNotSet( self._labels )
+ def labels(self):
+ self._completeIfNotSet(self._labels)
+ return self._NoneIfNotSet(self._labels)
@property
- def milestone( self ):
- self._completeIfNotSet( self._milestone )
- return self._NoneIfNotSet( self._milestone )
+ def milestone(self):
+ self._completeIfNotSet(self._milestone)
+ return self._NoneIfNotSet(self._milestone)
@property
- def number( self ):
- self._completeIfNotSet( self._number )
- return self._NoneIfNotSet( self._number )
+ def number(self):
+ self._completeIfNotSet(self._number)
+ return self._NoneIfNotSet(self._number)
@property
- def pull_request( self ):
- self._completeIfNotSet( self._pull_request )
- return self._NoneIfNotSet( self._pull_request )
+ def pull_request(self):
+ self._completeIfNotSet(self._pull_request)
+ return self._NoneIfNotSet(self._pull_request)
@property
- def repository( self ):
- self._completeIfNotSet( self._repository )
- return self._NoneIfNotSet( self._repository )
+ def repository(self):
+ self._completeIfNotSet(self._repository)
+ return self._NoneIfNotSet(self._repository)
@property
- def state( self ):
- self._completeIfNotSet( self._state )
- return self._NoneIfNotSet( self._state )
+ def state(self):
+ self._completeIfNotSet(self._state)
+ return self._NoneIfNotSet(self._state)
@property
- def title( self ):
- self._completeIfNotSet( self._title )
- return self._NoneIfNotSet( self._title )
+ def title(self):
+ self._completeIfNotSet(self._title)
+ return self._NoneIfNotSet(self._title)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def user( self ):
- self._completeIfNotSet( self._user )
- return self._NoneIfNotSet( self._user )
+ def user(self):
+ self._completeIfNotSet(self._user)
+ return self._NoneIfNotSet(self._user)
- def add_to_labels( self, *labels ):
- assert all( isinstance( element, Label.Label ) for element in labels ), labels
- post_parameters = [ label.name for label in labels ]
+ def add_to_labels(self, *labels):
+ assert all(isinstance(element, Label.Label) for element in labels), labels
+ post_parameters = [label.name for label in labels]
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/labels",
@@ -123,8 +124,8 @@ class Issue( GithubObject.GithubObject ):
post_parameters
)
- def create_comment( self, body ):
- assert isinstance( body, ( str, unicode ) ), body
+ def create_comment(self, body):
+ assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
}
@@ -134,9 +135,9 @@ class Issue( GithubObject.GithubObject ):
None,
post_parameters
)
- return IssueComment.IssueComment( self._requester, data, completed = True )
+ return IssueComment.IssueComment(self._requester, data, completed=True)
- def delete_labels( self ):
+ def delete_labels(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/labels",
@@ -144,45 +145,45 @@ 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=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
post_parameters = dict()
if title is not GithubObject.NotSet:
- post_parameters[ "title" ] = title
+ post_parameters["title"] = title
if body is not GithubObject.NotSet:
- post_parameters[ "body" ] = body
+ post_parameters["body"] = body
if assignee is not GithubObject.NotSet:
- post_parameters[ "assignee" ] = assignee._identity if assignee else ''
+ post_parameters["assignee"] = assignee._identity if assignee else ''
if state is not GithubObject.NotSet:
- post_parameters[ "state" ] = state
+ post_parameters["state"] = state
if milestone is not GithubObject.NotSet:
- post_parameters[ "milestone" ] = milestone._identity if milestone else ''
+ post_parameters["milestone"] = milestone._identity if milestone else ''
if labels is not GithubObject.NotSet:
- post_parameters[ "labels" ] = labels
+ post_parameters["labels"] = labels
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def get_comment( self, id ):
- assert isinstance( id, int ), id
+ def get_comment(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- self._parentUrl( self.url ) + "/comments/" + str( id ),
+ self._parentUrl(self.url) + "/comments/" + str(id),
None,
None
)
- return IssueComment.IssueComment( self._requester, data, completed = True )
+ return IssueComment.IssueComment(self._requester, data, completed=True)
- def get_comments( self ):
+ def get_comments(self):
return PaginatedList.PaginatedList(
IssueComment.IssueComment,
self._requester,
@@ -190,7 +191,7 @@ class Issue( GithubObject.GithubObject ):
None
)
- def get_events( self ):
+ def get_events(self):
return PaginatedList.PaginatedList(
IssueEvent.IssueEvent,
self._requester,
@@ -198,7 +199,7 @@ class Issue( GithubObject.GithubObject ):
None
)
- def get_labels( self ):
+ def get_labels(self):
return PaginatedList.PaginatedList(
Label.Label,
self._requester,
@@ -206,8 +207,8 @@ class Issue( GithubObject.GithubObject ):
None
)
- def remove_from_labels( self, label ):
- assert isinstance( label, Label.Label ), label
+ def remove_from_labels(self, label):
+ assert isinstance(label, Label.Label), label
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/labels/" + label._identity,
@@ -215,9 +216,9 @@ class Issue( GithubObject.GithubObject ):
None
)
- def set_labels( self, *labels ):
- assert all( isinstance( element, Label.Label ) for element in labels ), labels
- post_parameters = [ label.name for label in labels ]
+ def set_labels(self, *labels):
+ assert all(isinstance(element, Label.Label) for element in labels), labels
+ post_parameters = [label.name for label in labels]
headers, data = self._requester.requestAndCheck(
"PUT",
self.url + "/labels",
@@ -226,10 +227,10 @@ class Issue( GithubObject.GithubObject ):
)
@property
- def _identity( self ):
+ def _identity(self):
return self.number
- def _initAttributes( self ):
+ def _initAttributes(self):
self._assignee = GithubObject.NotSet
self._body = GithubObject.NotSet
self._closed_at = GithubObject.NotSet
@@ -249,61 +250,61 @@ class Issue( GithubObject.GithubObject ):
self._url = GithubObject.NotSet
self._user = 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 )
- if "body" in attributes: # pragma no branch
- assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
- self._body = attributes[ "body" ]
- if "closed_at" in attributes: # pragma no branch
- assert attributes[ "closed_at" ] is None or isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ]
- 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 )
- if "comments" in attributes: # pragma no branch
- assert attributes[ "comments" ] is None or isinstance( attributes[ "comments" ], int ), attributes[ "comments" ]
- self._comments = attributes[ "comments" ]
- 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" ] )
- 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" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- 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 )
- for element in attributes[ "labels" ]
+ 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)
+ if "body" in attributes: # pragma no branch
+ assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
+ self._body = attributes["body"]
+ if "closed_at" in attributes: # pragma no branch
+ assert attributes["closed_at"] is None or isinstance(attributes["closed_at"], (str, unicode)), attributes["closed_at"]
+ 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)
+ if "comments" in attributes: # pragma no branch
+ assert attributes["comments"] is None or isinstance(attributes["comments"], int), attributes["comments"]
+ self._comments = attributes["comments"]
+ 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"])
+ 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"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ 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)
+ 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 )
- if "number" in attributes: # pragma no branch
- assert attributes[ "number" ] is None or isinstance( attributes[ "number" ], int ), 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 )
- 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 )
- if "state" in attributes: # pragma no branch
- assert attributes[ "state" ] is None or isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ]
- self._state = attributes[ "state" ]
- if "title" in attributes: # pragma no branch
- assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
- self._title = attributes[ "title" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- 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 )
+ 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)
+ if "number" in attributes: # pragma no branch
+ assert attributes["number"] is None or isinstance(attributes["number"], int), 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)
+ 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)
+ if "state" in attributes: # pragma no branch
+ assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"]
+ self._state = attributes["state"]
+ if "title" in attributes: # pragma no branch
+ assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"]
+ self._title = attributes["title"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ 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)
diff --git a/github/IssueComment.py b/github/IssueComment.py
index d94e7d14..18f72557 100644
--- a/github/IssueComment.py
+++ b/github/IssueComment.py
@@ -15,38 +15,39 @@ import GithubObject
import NamedUser
-class IssueComment( GithubObject.GithubObject ):
+
+class IssueComment(GithubObject.GithubObject):
@property
- def body( self ):
- self._completeIfNotSet( self._body )
- return self._NoneIfNotSet( self._body )
+ def body(self):
+ self._completeIfNotSet(self._body)
+ return self._NoneIfNotSet(self._body)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def user( self ):
- self._completeIfNotSet( self._user )
- return self._NoneIfNotSet( self._user )
+ def user(self):
+ self._completeIfNotSet(self._user)
+ return self._NoneIfNotSet(self._user)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -54,8 +55,8 @@ class IssueComment( GithubObject.GithubObject ):
None
)
- def edit( self, body ):
- assert isinstance( body, ( str, unicode ) ), body
+ def edit(self, body):
+ assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
}
@@ -65,9 +66,9 @@ class IssueComment( GithubObject.GithubObject ):
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._body = GithubObject.NotSet
self._created_at = GithubObject.NotSet
self._id = GithubObject.NotSet
@@ -75,22 +76,22 @@ class IssueComment( GithubObject.GithubObject ):
self._url = GithubObject.NotSet
self._user = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "body" in attributes: # pragma no branch
- assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
- self._body = attributes[ "body" ]
- 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" ] )
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- 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 )
+ def _useAttributes(self, attributes):
+ if "body" in attributes: # pragma no branch
+ assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
+ self._body = attributes["body"]
+ 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"])
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ 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)
diff --git a/github/IssueEvent.py b/github/IssueEvent.py
index c95b28e1..ba658efd 100644
--- a/github/IssueEvent.py
+++ b/github/IssueEvent.py
@@ -16,43 +16,44 @@ import GithubObject
import Issue
import NamedUser
-class IssueEvent( GithubObject.GithubObject ):
+
+class IssueEvent(GithubObject.GithubObject):
@property
- def actor( self ):
- self._completeIfNotSet( self._actor )
- return self._NoneIfNotSet( self._actor )
+ def actor(self):
+ self._completeIfNotSet(self._actor)
+ return self._NoneIfNotSet(self._actor)
@property
- def commit_id( self ):
- self._completeIfNotSet( self._commit_id )
- return self._NoneIfNotSet( self._commit_id )
+ def commit_id(self):
+ self._completeIfNotSet(self._commit_id)
+ return self._NoneIfNotSet(self._commit_id)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def event( self ):
- self._completeIfNotSet( self._event )
- return self._NoneIfNotSet( self._event )
+ def event(self):
+ self._completeIfNotSet(self._event)
+ return self._NoneIfNotSet(self._event)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def issue( self ):
- self._completeIfNotSet( self._issue )
- return self._NoneIfNotSet( self._issue )
+ def issue(self):
+ self._completeIfNotSet(self._issue)
+ return self._NoneIfNotSet(self._issue)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._actor = GithubObject.NotSet
self._commit_id = GithubObject.NotSet
self._created_at = GithubObject.NotSet
@@ -61,25 +62,25 @@ class IssueEvent( GithubObject.GithubObject ):
self._issue = GithubObject.NotSet
self._url = 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 )
- 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" ]
- 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" ] )
- if "event" in attributes: # pragma no branch
- assert attributes[ "event" ] is None or isinstance( attributes[ "event" ], ( str, unicode ) ), attributes[ "event" ]
- self._event = attributes[ "event" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- 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 )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ 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)
+ 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"]
+ 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"])
+ if "event" in attributes: # pragma no branch
+ assert attributes["event"] is None or isinstance(attributes["event"], (str, unicode)), attributes["event"]
+ self._event = attributes["event"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ 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)
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/IssuePullRequest.py b/github/IssuePullRequest.py
index 2228e2a9..6f94cb23 100644
--- a/github/IssuePullRequest.py
+++ b/github/IssuePullRequest.py
@@ -13,31 +13,32 @@
import GithubObject
-class IssuePullRequest( GithubObject.BasicGithubObject ):
+
+class IssuePullRequest(GithubObject.BasicGithubObject):
@property
- def diff_url( self ):
- return self._NoneIfNotSet( self._diff_url )
+ def diff_url(self):
+ return self._NoneIfNotSet(self._diff_url)
@property
- def html_url( self ):
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ return self._NoneIfNotSet(self._html_url)
@property
- def patch_url( self ):
- return self._NoneIfNotSet( self._patch_url )
+ def patch_url(self):
+ return self._NoneIfNotSet(self._patch_url)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._diff_url = GithubObject.NotSet
self._html_url = GithubObject.NotSet
self._patch_url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "diff_url" in attributes: # pragma no branch
- assert attributes[ "diff_url" ] is None or isinstance( attributes[ "diff_url" ], ( str, unicode ) ), attributes[ "diff_url" ]
- self._diff_url = attributes[ "diff_url" ]
- 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" ]
- if "patch_url" in attributes: # pragma no branch
- assert attributes[ "patch_url" ] is None or isinstance( attributes[ "patch_url" ], ( str, unicode ) ), attributes[ "patch_url" ]
- self._patch_url = attributes[ "patch_url" ]
+ def _useAttributes(self, attributes):
+ if "diff_url" in attributes: # pragma no branch
+ assert attributes["diff_url"] is None or isinstance(attributes["diff_url"], (str, unicode)), attributes["diff_url"]
+ self._diff_url = attributes["diff_url"]
+ 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"]
+ if "patch_url" in attributes: # pragma no branch
+ assert attributes["patch_url"] is None or isinstance(attributes["patch_url"], (str, unicode)), attributes["patch_url"]
+ self._patch_url = attributes["patch_url"]
diff --git a/github/Label.py b/github/Label.py
index c3baf858..3dcc0d5a 100644
--- a/github/Label.py
+++ b/github/Label.py
@@ -15,23 +15,24 @@ import urllib
import GithubObject
-class Label( GithubObject.GithubObject ):
+
+class Label(GithubObject.GithubObject):
@property
- def color( self ):
- self._completeIfNotSet( self._color )
- return self._NoneIfNotSet( self._color )
+ def color(self):
+ self._completeIfNotSet(self._color)
+ return self._NoneIfNotSet(self._color)
@property
- def name( self ):
- self._completeIfNotSet( self._name )
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ self._completeIfNotSet(self._name)
+ return self._NoneIfNotSet(self._name)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -39,9 +40,9 @@ class Label( GithubObject.GithubObject ):
None
)
- def edit( self, name, color ):
- assert isinstance( name, ( str, unicode ) ), name
- assert isinstance( color, ( str, unicode ) ), color
+ def edit(self, name, color):
+ assert isinstance(name, (str, unicode)), name
+ assert isinstance(color, (str, unicode)), color
post_parameters = {
"name": name,
"color": color,
@@ -52,24 +53,24 @@ class Label( GithubObject.GithubObject ):
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
@property
- def _identity( self ):
- return urllib.quote( self.name )
+ def _identity(self):
+ return urllib.quote(self.name)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._color = GithubObject.NotSet
self._name = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "color" in attributes: # pragma no branch
- assert attributes[ "color" ] is None or isinstance( attributes[ "color" ], ( str, unicode ) ), attributes[ "color" ]
- self._color = attributes[ "color" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "color" in attributes: # pragma no branch
+ assert attributes["color"] is None or isinstance(attributes["color"], (str, unicode)), attributes["color"]
+ self._color = attributes["color"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/Legacy.py b/github/Legacy.py
index c266c3d2..de55eb61 100644
--- a/github/Legacy.py
+++ b/github/Legacy.py
@@ -15,9 +15,10 @@ import urlparse
from PaginatedList import PaginatedListBase
-class PaginatedList( PaginatedListBase ):
- def __init__( self, url, args, requester, key, convert, contentClass ):
- PaginatedListBase.__init__( self )
+
+class PaginatedList(PaginatedListBase):
+ def __init__(self, url, args, requester, key, convert, contentClass):
+ PaginatedListBase.__init__(self)
self.__url = url
self.__args = args
self.__requester = requester
@@ -27,77 +28,108 @@ class PaginatedList( PaginatedListBase ):
self.__nextPage = 0
self.__continue = True
- def _couldGrow( self ):
+ def _couldGrow(self):
return self.__continue
- def _fetchNextPage( self ):
+ def _fetchNextPage(self):
page = self.__nextPage
self.__nextPage += 1
- return self.get_page( page )
+ return self.get_page(page)
- def get_page( self, page ):
- assert isinstance( page, int ), page
- args = dict( self.__args )
+ def get_page(self, page):
+ assert isinstance(page, int), page
+ args = dict(self.__args)
if page != 0:
- args[ "start_page" ] = page + 1
+ args["start_page"] = page + 1
headers, data = self.__requester.requestAndCheck(
"GET",
self.__url,
args,
None
)
- self.__continue = len( data[ self.__key ] ) > 0
+ self.__continue = len(data[self.__key]) > 0
return [
- self.__contentClass( self.__requester, self.__convert( element ), completed = False )
- for element in data[ self.__key ]
+ self.__contentClass(self.__requester, self.__convert(element), completed=False)
+ for element in data[self.__key]
]
-def convertUser( attributes ):
+
+def convertUser(attributes):
convertedAttributes = {
- "login": attributes[ "login" ],
- "url": "/users/" + attributes[ "login" ],
+ "login": attributes["login"],
+ "url": "/users/" + attributes["login"],
}
- if "gravatar_id" in attributes: convertedAttributes[ "gravatar_id" ] = attributes[ "gravatar_id" ]
- if "followers" in attributes: convertedAttributes[ "followers" ] = attributes[ "followers" ]
- if "repos" in attributes: convertedAttributes[ "public_repos" ] = attributes[ "repos" ]
- if "name" in attributes: convertedAttributes[ "name" ] = attributes[ "name" ]
- if "created_at" in attributes: convertedAttributes[ "created_at" ] = attributes[ "created_at" ]
- if "location" in attributes: convertedAttributes[ "location" ] = attributes[ "location" ]
+ if "gravatar_id" in attributes:
+ convertedAttributes["gravatar_id"] = attributes["gravatar_id"]
+ if "followers" in attributes:
+ convertedAttributes["followers"] = attributes["followers"]
+ if "repos" in attributes:
+ convertedAttributes["public_repos"] = attributes["repos"]
+ if "name" in attributes:
+ convertedAttributes["name"] = attributes["name"]
+ if "created_at" in attributes:
+ convertedAttributes["created_at"] = attributes["created_at"]
+ if "location" in attributes:
+ convertedAttributes["location"] = attributes["location"]
return convertedAttributes
-def convertRepo( attributes ):
+
+def convertRepo(attributes):
convertedAttributes = {
- "owner": { "login": attributes[ "owner" ], "url": "/users/" + attributes[ "owner" ] },
- "url": "/repos/" + attributes[ "owner" ] + "/" + attributes[ "name" ],
+ "owner": {"login": attributes["owner"], "url": "/users/" + attributes["owner"]},
+ "url": "/repos/" + attributes["owner"] + "/" + attributes["name"],
}
- if "pushed_at" in attributes: convertedAttributes[ "pushed_at" ] = attributes[ "pushed_at" ]
- if "homepage" in attributes: convertedAttributes[ "homepage" ] = attributes[ "homepage" ]
- if "created_at" in attributes: convertedAttributes[ "created_at" ] = attributes[ "created_at" ]
- if "watchers" in attributes: convertedAttributes[ "watchers" ] = attributes[ "watchers" ]
- if "has_downloads" in attributes: convertedAttributes[ "has_downloads" ] = attributes[ "has_downloads" ]
- if "fork" in attributes: convertedAttributes[ "fork" ] = attributes[ "fork" ]
- if "has_issues" in attributes: convertedAttributes[ "has_issues" ] = attributes[ "has_issues" ]
- if "has_wiki" in attributes: convertedAttributes[ "has_wiki" ] = attributes[ "has_wiki" ]
- if "forks" in attributes: convertedAttributes[ "forks" ] = attributes[ "forks" ]
- if "size" in attributes: convertedAttributes[ "size" ] = attributes[ "size" ]
- if "private" in attributes: convertedAttributes[ "private" ] = attributes[ "private" ]
- if "open_issues" in attributes: convertedAttributes[ "open_issues" ] = attributes[ "open_issues" ]
- if "description" in attributes: convertedAttributes[ "description" ] = attributes[ "description" ]
- if "language" in attributes: convertedAttributes[ "language" ] = attributes[ "language" ]
- if "name" in attributes: convertedAttributes[ "name" ] = attributes[ "name" ]
+ if "pushed_at" in attributes:
+ convertedAttributes["pushed_at"] = attributes["pushed_at"]
+ if "homepage" in attributes:
+ convertedAttributes["homepage"] = attributes["homepage"]
+ if "created_at" in attributes:
+ convertedAttributes["created_at"] = attributes["created_at"]
+ if "watchers" in attributes:
+ convertedAttributes["watchers"] = attributes["watchers"]
+ if "has_downloads" in attributes:
+ convertedAttributes["has_downloads"] = attributes["has_downloads"]
+ if "fork" in attributes:
+ convertedAttributes["fork"] = attributes["fork"]
+ if "has_issues" in attributes:
+ convertedAttributes["has_issues"] = attributes["has_issues"]
+ if "has_wiki" in attributes:
+ convertedAttributes["has_wiki"] = attributes["has_wiki"]
+ if "forks" in attributes:
+ convertedAttributes["forks"] = attributes["forks"]
+ if "size" in attributes:
+ convertedAttributes["size"] = attributes["size"]
+ if "private" in attributes:
+ convertedAttributes["private"] = attributes["private"]
+ if "open_issues" in attributes:
+ convertedAttributes["open_issues"] = attributes["open_issues"]
+ if "description" in attributes:
+ convertedAttributes["description"] = attributes["description"]
+ if "language" in attributes:
+ convertedAttributes["language"] = attributes["language"]
+ if "name" in attributes:
+ convertedAttributes["name"] = attributes["name"]
return convertedAttributes
-def convertIssue( attributes ):
+
+def convertIssue(attributes):
convertedAttributes = {
- "number": attributes[ "number" ],
- "url": "/repos" + urlparse.urlparse( attributes[ "html_url" ] ).path,
- "user": { "login": attributes[ "user" ], "url": "/users/" + attributes[ "user" ] },
+ "number": attributes["number"],
+ "url": "/repos" + urlparse.urlparse(attributes["html_url"]).path,
+ "user": {"login": attributes["user"], "url": "/users/" + attributes["user"]},
}
- if "labels" in attributes: convertedAttributes[ "labels" ] = [ { "name": label } for label in attributes[ "labels" ] ]
- if "title" in attributes: convertedAttributes[ "title" ] = attributes[ "title" ]
- if "created_at" in attributes: convertedAttributes[ "created_at" ] = attributes[ "created_at" ]
- if "comments" in attributes: convertedAttributes[ "comments" ] = attributes[ "comments" ]
- if "body" in attributes: convertedAttributes[ "body" ] = attributes[ "body" ]
- if "updated_at" in attributes: convertedAttributes[ "updated_at" ] = attributes[ "updated_at" ]
- if "state" in attributes: convertedAttributes[ "state" ] = attributes[ "state" ]
+ if "labels" in attributes:
+ convertedAttributes["labels"] = [{"name": label} for label in attributes["labels"]]
+ if "title" in attributes:
+ convertedAttributes["title"] = attributes["title"]
+ if "created_at" in attributes:
+ convertedAttributes["created_at"] = attributes["created_at"]
+ if "comments" in attributes:
+ convertedAttributes["comments"] = attributes["comments"]
+ if "body" in attributes:
+ convertedAttributes["body"] = attributes["body"]
+ if "updated_at" in attributes:
+ convertedAttributes["updated_at"] = attributes["updated_at"]
+ if "state" in attributes:
+ convertedAttributes["state"] = attributes["state"]
return convertedAttributes
diff --git a/github/Logging.py b/github/Logging.py
index 043fde0d..284ccba5 100644
--- a/github/Logging.py
+++ b/github/Logging.py
@@ -1,4 +1,5 @@
-import logging
-
-def get_logger():
- return logging.getLogger('github')
+import logging
+
+
+def get_logger():
+ return logging.getLogger('github')
diff --git a/github/Milestone.py b/github/Milestone.py
index 47afe173..7a0c2262 100644
--- a/github/Milestone.py
+++ b/github/Milestone.py
@@ -19,63 +19,64 @@ import PaginatedList
import NamedUser
import Label
-class Milestone( GithubObject.GithubObject ):
+
+class Milestone(GithubObject.GithubObject):
@property
- def closed_issues( self ):
- self._completeIfNotSet( self._closed_issues )
- return self._NoneIfNotSet( self._closed_issues )
+ def closed_issues(self):
+ self._completeIfNotSet(self._closed_issues)
+ return self._NoneIfNotSet(self._closed_issues)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def creator( self ):
- self._completeIfNotSet( self._creator )
- return self._NoneIfNotSet( self._creator )
+ def creator(self):
+ self._completeIfNotSet(self._creator)
+ return self._NoneIfNotSet(self._creator)
@property
- def description( self ):
- self._completeIfNotSet( self._description )
- return self._NoneIfNotSet( self._description )
+ def description(self):
+ self._completeIfNotSet(self._description)
+ return self._NoneIfNotSet(self._description)
@property
- def due_on( self ):
- self._completeIfNotSet( self._due_on )
- return self._NoneIfNotSet( self._due_on )
+ def due_on(self):
+ self._completeIfNotSet(self._due_on)
+ return self._NoneIfNotSet(self._due_on)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def number( self ):
- self._completeIfNotSet( self._number )
- return self._NoneIfNotSet( self._number )
+ def number(self):
+ self._completeIfNotSet(self._number)
+ return self._NoneIfNotSet(self._number)
@property
- def open_issues( self ):
- self._completeIfNotSet( self._open_issues )
- return self._NoneIfNotSet( self._open_issues )
+ def open_issues(self):
+ self._completeIfNotSet(self._open_issues)
+ return self._NoneIfNotSet(self._open_issues)
@property
- def state( self ):
- self._completeIfNotSet( self._state )
- return self._NoneIfNotSet( self._state )
+ def state(self):
+ self._completeIfNotSet(self._state)
+ return self._NoneIfNotSet(self._state)
@property
- def title( self ):
- self._completeIfNotSet( self._title )
- return self._NoneIfNotSet( self._title )
+ def title(self):
+ self._completeIfNotSet(self._title)
+ return self._NoneIfNotSet(self._title)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -83,29 +84,29 @@ class Milestone( GithubObject.GithubObject ):
None
)
- def edit( self, title, state = GithubObject.NotSet, description = GithubObject.NotSet, due_on = 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
+ def edit(self, title, state=GithubObject.NotSet, description=GithubObject.NotSet, due_on=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
post_parameters = {
"title": title,
}
if state is not GithubObject.NotSet:
- post_parameters[ "state" ] = state
+ post_parameters["state"] = state
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
if due_on is not GithubObject.NotSet:
- post_parameters[ "due_on" ] = due_on.strftime( "%Y-%m-%d" )
+ post_parameters["due_on"] = due_on.strftime("%Y-%m-%d")
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def get_labels( self ):
+ def get_labels(self):
return PaginatedList.PaginatedList(
Label.Label,
self._requester,
@@ -114,10 +115,10 @@ class Milestone( GithubObject.GithubObject ):
)
@property
- def _identity( self ):
+ def _identity(self):
return self.number
- def _initAttributes( self ):
+ def _initAttributes(self):
self._closed_issues = GithubObject.NotSet
self._created_at = GithubObject.NotSet
self._creator = GithubObject.NotSet
@@ -130,37 +131,37 @@ class Milestone( GithubObject.GithubObject ):
self._title = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "closed_issues" in attributes: # pragma no branch
- assert attributes[ "closed_issues" ] is None or isinstance( attributes[ "closed_issues" ], int ), attributes[ "closed_issues" ]
- self._closed_issues = attributes[ "closed_issues" ]
- 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" ] )
- 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 )
- if "description" in attributes: # pragma no branch
- assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
- self._description = attributes[ "description" ]
- if "due_on" in attributes: # pragma no branch
- assert attributes[ "due_on" ] is None or isinstance( attributes[ "due_on" ], ( str, unicode ) ), attributes[ "due_on" ]
- self._due_on = self._parseDatetime( attributes[ "due_on" ] )
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "number" in attributes: # pragma no branch
- assert attributes[ "number" ] is None or isinstance( attributes[ "number" ], int ), attributes[ "number" ]
- self._number = attributes[ "number" ]
- if "open_issues" in attributes: # pragma no branch
- assert attributes[ "open_issues" ] is None or isinstance( attributes[ "open_issues" ], int ), attributes[ "open_issues" ]
- self._open_issues = attributes[ "open_issues" ]
- if "state" in attributes: # pragma no branch
- assert attributes[ "state" ] is None or isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ]
- self._state = attributes[ "state" ]
- if "title" in attributes: # pragma no branch
- assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
- self._title = attributes[ "title" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "closed_issues" in attributes: # pragma no branch
+ assert attributes["closed_issues"] is None or isinstance(attributes["closed_issues"], int), attributes["closed_issues"]
+ self._closed_issues = attributes["closed_issues"]
+ 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"])
+ 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)
+ if "description" in attributes: # pragma no branch
+ assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"]
+ self._description = attributes["description"]
+ if "due_on" in attributes: # pragma no branch
+ assert attributes["due_on"] is None or isinstance(attributes["due_on"], (str, unicode)), attributes["due_on"]
+ self._due_on = self._parseDatetime(attributes["due_on"])
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "number" in attributes: # pragma no branch
+ assert attributes["number"] is None or isinstance(attributes["number"], int), attributes["number"]
+ self._number = attributes["number"]
+ if "open_issues" in attributes: # pragma no branch
+ assert attributes["open_issues"] is None or isinstance(attributes["open_issues"], int), attributes["open_issues"]
+ self._open_issues = attributes["open_issues"]
+ if "state" in attributes: # pragma no branch
+ assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"]
+ self._state = attributes["state"]
+ if "title" in attributes: # pragma no branch
+ assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"]
+ self._title = attributes["title"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/NamedUser.py b/github/NamedUser.py
index 03a66e4b..e8666187 100644
--- a/github/NamedUser.py
+++ b/github/NamedUser.py
@@ -22,156 +22,157 @@ import Organization
import InputFileContent
import Event
-class NamedUser( GithubObject.GithubObject ):
+
+class NamedUser(GithubObject.GithubObject):
@property
- def avatar_url( self ):
- self._completeIfNotSet( self._avatar_url )
- return self._NoneIfNotSet( self._avatar_url )
+ def avatar_url(self):
+ self._completeIfNotSet(self._avatar_url)
+ return self._NoneIfNotSet(self._avatar_url)
@property
- def bio( self ):
- self._completeIfNotSet( self._bio )
- return self._NoneIfNotSet( self._bio )
+ def bio(self):
+ self._completeIfNotSet(self._bio)
+ return self._NoneIfNotSet(self._bio)
@property
- def blog( self ):
- self._completeIfNotSet( self._blog )
- return self._NoneIfNotSet( self._blog )
+ def blog(self):
+ self._completeIfNotSet(self._blog)
+ return self._NoneIfNotSet(self._blog)
@property
- def collaborators( self ):
- self._completeIfNotSet( self._collaborators )
- return self._NoneIfNotSet( self._collaborators )
+ def collaborators(self):
+ self._completeIfNotSet(self._collaborators)
+ return self._NoneIfNotSet(self._collaborators)
@property
- def company( self ):
- self._completeIfNotSet( self._company )
- return self._NoneIfNotSet( self._company )
+ def company(self):
+ self._completeIfNotSet(self._company)
+ return self._NoneIfNotSet(self._company)
@property
- def contributions( self ):
- self._completeIfNotSet( self._contributions )
- return self._NoneIfNotSet( self._contributions )
+ def contributions(self):
+ self._completeIfNotSet(self._contributions)
+ return self._NoneIfNotSet(self._contributions)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def disk_usage( self ):
- self._completeIfNotSet( self._disk_usage )
- return self._NoneIfNotSet( self._disk_usage )
+ def disk_usage(self):
+ self._completeIfNotSet(self._disk_usage)
+ return self._NoneIfNotSet(self._disk_usage)
@property
- def email( self ):
- self._completeIfNotSet( self._email )
- return self._NoneIfNotSet( self._email )
+ def email(self):
+ self._completeIfNotSet(self._email)
+ return self._NoneIfNotSet(self._email)
@property
- def followers( self ):
- self._completeIfNotSet( self._followers )
- return self._NoneIfNotSet( self._followers )
+ def followers(self):
+ self._completeIfNotSet(self._followers)
+ return self._NoneIfNotSet(self._followers)
@property
- def following( self ):
- self._completeIfNotSet( self._following )
- return self._NoneIfNotSet( self._following )
+ def following(self):
+ self._completeIfNotSet(self._following)
+ return self._NoneIfNotSet(self._following)
@property
- def gravatar_id( self ):
- self._completeIfNotSet( self._gravatar_id )
- return self._NoneIfNotSet( self._gravatar_id )
+ def gravatar_id(self):
+ self._completeIfNotSet(self._gravatar_id)
+ return self._NoneIfNotSet(self._gravatar_id)
@property
- def hireable( self ):
- self._completeIfNotSet( self._hireable )
- return self._NoneIfNotSet( self._hireable )
+ def hireable(self):
+ self._completeIfNotSet(self._hireable)
+ return self._NoneIfNotSet(self._hireable)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def location( self ):
- self._completeIfNotSet( self._location )
- return self._NoneIfNotSet( self._location )
+ def location(self):
+ self._completeIfNotSet(self._location)
+ return self._NoneIfNotSet(self._location)
@property
- def login( self ):
- self._completeIfNotSet( self._login )
- return self._NoneIfNotSet( self._login )
+ def login(self):
+ self._completeIfNotSet(self._login)
+ return self._NoneIfNotSet(self._login)
@property
- def name( self ):
- self._completeIfNotSet( self._name )
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ self._completeIfNotSet(self._name)
+ return self._NoneIfNotSet(self._name)
@property
- def owned_private_repos( self ):
- self._completeIfNotSet( self._owned_private_repos )
- return self._NoneIfNotSet( self._owned_private_repos )
+ def owned_private_repos(self):
+ self._completeIfNotSet(self._owned_private_repos)
+ return self._NoneIfNotSet(self._owned_private_repos)
@property
- def plan( self ):
- self._completeIfNotSet( self._plan )
- return self._NoneIfNotSet( self._plan )
+ def plan(self):
+ self._completeIfNotSet(self._plan)
+ return self._NoneIfNotSet(self._plan)
@property
- def private_gists( self ):
- self._completeIfNotSet( self._private_gists )
- return self._NoneIfNotSet( self._private_gists )
+ def private_gists(self):
+ self._completeIfNotSet(self._private_gists)
+ return self._NoneIfNotSet(self._private_gists)
@property
- def public_gists( self ):
- self._completeIfNotSet( self._public_gists )
- return self._NoneIfNotSet( self._public_gists )
+ def public_gists(self):
+ self._completeIfNotSet(self._public_gists)
+ return self._NoneIfNotSet(self._public_gists)
@property
- def public_repos( self ):
- self._completeIfNotSet( self._public_repos )
- return self._NoneIfNotSet( self._public_repos )
+ def public_repos(self):
+ self._completeIfNotSet(self._public_repos)
+ return self._NoneIfNotSet(self._public_repos)
@property
- def total_private_repos( self ):
- self._completeIfNotSet( self._total_private_repos )
- return self._NoneIfNotSet( self._total_private_repos )
+ def total_private_repos(self):
+ self._completeIfNotSet(self._total_private_repos)
+ return self._NoneIfNotSet(self._total_private_repos)
@property
- def type( self ):
- self._completeIfNotSet( self._type )
- return self._NoneIfNotSet( self._type )
+ def type(self):
+ self._completeIfNotSet(self._type)
+ return self._NoneIfNotSet(self._type)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def create_gist( self, public, files, description = 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
+ def create_gist(self, public, files, description=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
post_parameters = {
"public": public,
- "files": dict( ( key, value._identity ) for key, value in files.iteritems() ),
+ "files": dict((key, value._identity) for key, value in files.iteritems()),
}
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/gists",
None,
post_parameters
)
- return Gist.Gist( self._requester, data, completed = True )
+ return Gist.Gist(self._requester, data, completed=True)
- def get_events( self ):
+ def get_events(self):
return PaginatedList.PaginatedList(
Event.Event,
self._requester,
@@ -179,7 +180,7 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_followers( self ):
+ def get_followers(self):
return PaginatedList.PaginatedList(
NamedUser,
self._requester,
@@ -187,7 +188,7 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_following( self ):
+ def get_following(self):
return PaginatedList.PaginatedList(
NamedUser,
self._requester,
@@ -195,7 +196,7 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_gists( self ):
+ def get_gists(self):
return PaginatedList.PaginatedList(
Gist.Gist,
self._requester,
@@ -203,7 +204,7 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_orgs( self ):
+ def get_orgs(self):
return PaginatedList.PaginatedList(
Organization.Organization,
self._requester,
@@ -211,7 +212,7 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_public_events( self ):
+ def get_public_events(self):
return PaginatedList.PaginatedList(
Event.Event,
self._requester,
@@ -219,7 +220,7 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_public_received_events( self ):
+ def get_public_received_events(self):
return PaginatedList.PaginatedList(
Event.Event,
self._requester,
@@ -227,7 +228,7 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_received_events( self ):
+ def get_received_events(self):
return PaginatedList.PaginatedList(
Event.Event,
self._requester,
@@ -235,21 +236,21 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_repo( self, name ):
- assert isinstance( name, ( str, unicode ) ), name
+ def get_repo(self, name):
+ assert isinstance(name, (str, unicode)), name
headers, data = self._requester.requestAndCheck(
"GET",
"/repos/" + self.login + "/" + name,
None,
None
)
- return Repository.Repository( self._requester, data, completed = True )
+ return 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=GithubObject.NotSet):
+ assert type is GithubObject.NotSet or isinstance(type, (str, unicode)), type
url_parameters = dict()
if type is not GithubObject.NotSet:
- url_parameters[ "type" ] = type
+ url_parameters["type"] = type
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -257,7 +258,7 @@ class NamedUser( GithubObject.GithubObject ):
url_parameters
)
- def get_starred( self ):
+ def get_starred(self):
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -265,7 +266,7 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_subscriptions( self ):
+ def get_subscriptions(self):
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -273,7 +274,7 @@ class NamedUser( GithubObject.GithubObject ):
None
)
- def get_watched( self ):
+ def get_watched(self):
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -282,10 +283,10 @@ class NamedUser( GithubObject.GithubObject ):
)
@property
- def _identity( self ):
+ def _identity(self):
return self.login
- def _initAttributes( self ):
+ def _initAttributes(self):
self._avatar_url = GithubObject.NotSet
self._bio = GithubObject.NotSet
self._blog = GithubObject.NotSet
@@ -313,82 +314,82 @@ class NamedUser( GithubObject.GithubObject ):
self._type = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "avatar_url" in attributes: # pragma no branch
- assert attributes[ "avatar_url" ] is None or isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ]
- self._avatar_url = attributes[ "avatar_url" ]
- if "bio" in attributes: # pragma no branch
- assert attributes[ "bio" ] is None or isinstance( attributes[ "bio" ], ( str, unicode ) ), attributes[ "bio" ]
- self._bio = attributes[ "bio" ]
- if "blog" in attributes: # pragma no branch
- assert attributes[ "blog" ] is None or isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ]
- self._blog = attributes[ "blog" ]
- if "collaborators" in attributes: # pragma no branch
- assert attributes[ "collaborators" ] is None or isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ]
- self._collaborators = attributes[ "collaborators" ]
- if "company" in attributes: # pragma no branch
- assert attributes[ "company" ] is None or isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ]
- self._company = attributes[ "company" ]
- if "contributions" in attributes: # pragma no branch
- assert attributes[ "contributions" ] is None or isinstance( attributes[ "contributions" ], int ), attributes[ "contributions" ]
- self._contributions = attributes[ "contributions" ]
- 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" ] )
- if "disk_usage" in attributes: # pragma no branch
- assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ]
- self._disk_usage = attributes[ "disk_usage" ]
- if "email" in attributes: # pragma no branch
- assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ]
- self._email = attributes[ "email" ]
- if "followers" in attributes: # pragma no branch
- assert attributes[ "followers" ] is None or isinstance( attributes[ "followers" ], int ), attributes[ "followers" ]
- self._followers = attributes[ "followers" ]
- if "following" in attributes: # pragma no branch
- assert attributes[ "following" ] is None or isinstance( attributes[ "following" ], int ), attributes[ "following" ]
- self._following = attributes[ "following" ]
- if "gravatar_id" in attributes: # pragma no branch
- assert attributes[ "gravatar_id" ] is None or isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ]
- self._gravatar_id = attributes[ "gravatar_id" ]
- if "hireable" in attributes: # pragma no branch
- assert attributes[ "hireable" ] is None or isinstance( attributes[ "hireable" ], bool ), attributes[ "hireable" ]
- self._hireable = attributes[ "hireable" ]
- 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" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "location" in attributes: # pragma no branch
- assert attributes[ "location" ] is None or isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ]
- self._location = attributes[ "location" ]
- if "login" in attributes: # pragma no branch
- assert attributes[ "login" ] is None or isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ]
- self._login = attributes[ "login" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "owned_private_repos" in attributes: # pragma no branch
- assert attributes[ "owned_private_repos" ] is None or isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ]
- 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 )
- if "private_gists" in attributes: # pragma no branch
- assert attributes[ "private_gists" ] is None or isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ]
- self._private_gists = attributes[ "private_gists" ]
- if "public_gists" in attributes: # pragma no branch
- assert attributes[ "public_gists" ] is None or isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ]
- self._public_gists = attributes[ "public_gists" ]
- if "public_repos" in attributes: # pragma no branch
- assert attributes[ "public_repos" ] is None or isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ]
- self._public_repos = attributes[ "public_repos" ]
- if "total_private_repos" in attributes: # pragma no branch
- assert attributes[ "total_private_repos" ] is None or isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ]
- self._total_private_repos = attributes[ "total_private_repos" ]
- if "type" in attributes: # pragma no branch
- assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
- self._type = attributes[ "type" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "avatar_url" in attributes: # pragma no branch
+ assert attributes["avatar_url"] is None or isinstance(attributes["avatar_url"], (str, unicode)), attributes["avatar_url"]
+ self._avatar_url = attributes["avatar_url"]
+ if "bio" in attributes: # pragma no branch
+ assert attributes["bio"] is None or isinstance(attributes["bio"], (str, unicode)), attributes["bio"]
+ self._bio = attributes["bio"]
+ if "blog" in attributes: # pragma no branch
+ assert attributes["blog"] is None or isinstance(attributes["blog"], (str, unicode)), attributes["blog"]
+ self._blog = attributes["blog"]
+ if "collaborators" in attributes: # pragma no branch
+ assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], int), attributes["collaborators"]
+ self._collaborators = attributes["collaborators"]
+ if "company" in attributes: # pragma no branch
+ assert attributes["company"] is None or isinstance(attributes["company"], (str, unicode)), attributes["company"]
+ self._company = attributes["company"]
+ if "contributions" in attributes: # pragma no branch
+ assert attributes["contributions"] is None or isinstance(attributes["contributions"], int), attributes["contributions"]
+ self._contributions = attributes["contributions"]
+ 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"])
+ if "disk_usage" in attributes: # pragma no branch
+ assert attributes["disk_usage"] is None or isinstance(attributes["disk_usage"], int), attributes["disk_usage"]
+ self._disk_usage = attributes["disk_usage"]
+ if "email" in attributes: # pragma no branch
+ assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"]
+ self._email = attributes["email"]
+ if "followers" in attributes: # pragma no branch
+ assert attributes["followers"] is None or isinstance(attributes["followers"], int), attributes["followers"]
+ self._followers = attributes["followers"]
+ if "following" in attributes: # pragma no branch
+ assert attributes["following"] is None or isinstance(attributes["following"], int), attributes["following"]
+ self._following = attributes["following"]
+ if "gravatar_id" in attributes: # pragma no branch
+ assert attributes["gravatar_id"] is None or isinstance(attributes["gravatar_id"], (str, unicode)), attributes["gravatar_id"]
+ self._gravatar_id = attributes["gravatar_id"]
+ if "hireable" in attributes: # pragma no branch
+ assert attributes["hireable"] is None or isinstance(attributes["hireable"], bool), attributes["hireable"]
+ self._hireable = attributes["hireable"]
+ 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"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "location" in attributes: # pragma no branch
+ assert attributes["location"] is None or isinstance(attributes["location"], (str, unicode)), attributes["location"]
+ self._location = attributes["location"]
+ if "login" in attributes: # pragma no branch
+ assert attributes["login"] is None or isinstance(attributes["login"], (str, unicode)), attributes["login"]
+ self._login = attributes["login"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "owned_private_repos" in attributes: # pragma no branch
+ assert attributes["owned_private_repos"] is None or isinstance(attributes["owned_private_repos"], int), attributes["owned_private_repos"]
+ 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)
+ if "private_gists" in attributes: # pragma no branch
+ assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], int), attributes["private_gists"]
+ self._private_gists = attributes["private_gists"]
+ if "public_gists" in attributes: # pragma no branch
+ assert attributes["public_gists"] is None or isinstance(attributes["public_gists"], int), attributes["public_gists"]
+ self._public_gists = attributes["public_gists"]
+ if "public_repos" in attributes: # pragma no branch
+ assert attributes["public_repos"] is None or isinstance(attributes["public_repos"], int), attributes["public_repos"]
+ self._public_repos = attributes["public_repos"]
+ if "total_private_repos" in attributes: # pragma no branch
+ assert attributes["total_private_repos"] is None or isinstance(attributes["total_private_repos"], int), attributes["total_private_repos"]
+ self._total_private_repos = attributes["total_private_repos"]
+ if "type" in attributes: # pragma no branch
+ assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"]
+ self._type = attributes["type"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/Organization.py b/github/Organization.py
index 896d99cf..90cd93e5 100644
--- a/github/Organization.py
+++ b/github/Organization.py
@@ -20,129 +20,130 @@ import Event
import Repository
import NamedUser
-class Organization( GithubObject.GithubObject ):
+
+class Organization(GithubObject.GithubObject):
@property
- def avatar_url( self ):
- self._completeIfNotSet( self._avatar_url )
- return self._NoneIfNotSet( self._avatar_url )
+ def avatar_url(self):
+ self._completeIfNotSet(self._avatar_url)
+ return self._NoneIfNotSet(self._avatar_url)
@property
- def billing_email( self ):
- self._completeIfNotSet( self._billing_email )
- return self._NoneIfNotSet( self._billing_email )
+ def billing_email(self):
+ self._completeIfNotSet(self._billing_email)
+ return self._NoneIfNotSet(self._billing_email)
@property
- def blog( self ):
- self._completeIfNotSet( self._blog )
- return self._NoneIfNotSet( self._blog )
+ def blog(self):
+ self._completeIfNotSet(self._blog)
+ return self._NoneIfNotSet(self._blog)
@property
- def collaborators( self ):
- self._completeIfNotSet( self._collaborators )
- return self._NoneIfNotSet( self._collaborators )
+ def collaborators(self):
+ self._completeIfNotSet(self._collaborators)
+ return self._NoneIfNotSet(self._collaborators)
@property
- def company( self ):
- self._completeIfNotSet( self._company )
- return self._NoneIfNotSet( self._company )
+ def company(self):
+ self._completeIfNotSet(self._company)
+ return self._NoneIfNotSet(self._company)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def disk_usage( self ):
- self._completeIfNotSet( self._disk_usage )
- return self._NoneIfNotSet( self._disk_usage )
+ def disk_usage(self):
+ self._completeIfNotSet(self._disk_usage)
+ return self._NoneIfNotSet(self._disk_usage)
@property
- def email( self ):
- self._completeIfNotSet( self._email )
- return self._NoneIfNotSet( self._email )
+ def email(self):
+ self._completeIfNotSet(self._email)
+ return self._NoneIfNotSet(self._email)
@property
- def followers( self ):
- self._completeIfNotSet( self._followers )
- return self._NoneIfNotSet( self._followers )
+ def followers(self):
+ self._completeIfNotSet(self._followers)
+ return self._NoneIfNotSet(self._followers)
@property
- def following( self ):
- self._completeIfNotSet( self._following )
- return self._NoneIfNotSet( self._following )
+ def following(self):
+ self._completeIfNotSet(self._following)
+ return self._NoneIfNotSet(self._following)
@property
- def gravatar_id( self ):
- self._completeIfNotSet( self._gravatar_id )
- return self._NoneIfNotSet( self._gravatar_id )
+ def gravatar_id(self):
+ self._completeIfNotSet(self._gravatar_id)
+ return self._NoneIfNotSet(self._gravatar_id)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def location( self ):
- self._completeIfNotSet( self._location )
- return self._NoneIfNotSet( self._location )
+ def location(self):
+ self._completeIfNotSet(self._location)
+ return self._NoneIfNotSet(self._location)
@property
- def login( self ):
- self._completeIfNotSet( self._login )
- return self._NoneIfNotSet( self._login )
+ def login(self):
+ self._completeIfNotSet(self._login)
+ return self._NoneIfNotSet(self._login)
@property
- def name( self ):
- self._completeIfNotSet( self._name )
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ self._completeIfNotSet(self._name)
+ return self._NoneIfNotSet(self._name)
@property
- def owned_private_repos( self ):
- self._completeIfNotSet( self._owned_private_repos )
- return self._NoneIfNotSet( self._owned_private_repos )
+ def owned_private_repos(self):
+ self._completeIfNotSet(self._owned_private_repos)
+ return self._NoneIfNotSet(self._owned_private_repos)
@property
- def plan( self ):
- self._completeIfNotSet( self._plan )
- return self._NoneIfNotSet( self._plan )
+ def plan(self):
+ self._completeIfNotSet(self._plan)
+ return self._NoneIfNotSet(self._plan)
@property
- def private_gists( self ):
- self._completeIfNotSet( self._private_gists )
- return self._NoneIfNotSet( self._private_gists )
+ def private_gists(self):
+ self._completeIfNotSet(self._private_gists)
+ return self._NoneIfNotSet(self._private_gists)
@property
- def public_gists( self ):
- self._completeIfNotSet( self._public_gists )
- return self._NoneIfNotSet( self._public_gists )
+ def public_gists(self):
+ self._completeIfNotSet(self._public_gists)
+ return self._NoneIfNotSet(self._public_gists)
@property
- def public_repos( self ):
- self._completeIfNotSet( self._public_repos )
- return self._NoneIfNotSet( self._public_repos )
+ def public_repos(self):
+ self._completeIfNotSet(self._public_repos)
+ return self._NoneIfNotSet(self._public_repos)
@property
- def total_private_repos( self ):
- self._completeIfNotSet( self._total_private_repos )
- return self._NoneIfNotSet( self._total_private_repos )
+ def total_private_repos(self):
+ self._completeIfNotSet(self._total_private_repos)
+ return self._NoneIfNotSet(self._total_private_repos)
@property
- def type( self ):
- self._completeIfNotSet( self._type )
- return self._NoneIfNotSet( self._type )
+ def type(self):
+ self._completeIfNotSet(self._type)
+ return self._NoneIfNotSet(self._type)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def add_to_public_members( self, public_member ):
- assert isinstance( public_member, NamedUser.NamedUser ), public_member
+ def add_to_public_members(self, public_member):
+ assert isinstance(public_member, NamedUser.NamedUser), public_member
headers, data = self._requester.requestAndCheck(
"PUT",
self.url + "/public_members/" + public_member._identity,
@@ -150,8 +151,8 @@ class Organization( GithubObject.GithubObject ):
None
)
- def create_fork( self, repo ):
- assert isinstance( repo, Repository.Repository ), repo
+ def create_fork(self, repo):
+ assert isinstance(repo, Repository.Repository), repo
url_parameters = {
"org": self.login,
}
@@ -161,90 +162,90 @@ class Organization( GithubObject.GithubObject ):
url_parameters,
None
)
- return Repository.Repository( self._requester, data, completed = True )
+ return 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 ):
- 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
+ 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):
+ 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
post_parameters = {
"name": name,
}
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
if homepage is not GithubObject.NotSet:
- post_parameters[ "homepage" ] = homepage
+ post_parameters["homepage"] = homepage
if private is not GithubObject.NotSet:
- post_parameters[ "private" ] = private
+ post_parameters["private"] = private
if has_issues is not GithubObject.NotSet:
- post_parameters[ "has_issues" ] = has_issues
+ post_parameters["has_issues"] = has_issues
if has_wiki is not GithubObject.NotSet:
- post_parameters[ "has_wiki" ] = has_wiki
+ post_parameters["has_wiki"] = has_wiki
if has_downloads is not GithubObject.NotSet:
- post_parameters[ "has_downloads" ] = has_downloads
+ post_parameters["has_downloads"] = has_downloads
if team_id is not GithubObject.NotSet:
- post_parameters[ "team_id" ] = team_id._identity
+ post_parameters["team_id"] = team_id._identity
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/repos",
None,
post_parameters
)
- return Repository.Repository( self._requester, data, completed = True )
+ return Repository.Repository(self._requester, data, completed=True)
- def create_team( self, name, repo_names = GithubObject.NotSet, permission = 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
+ def create_team(self, name, repo_names=GithubObject.NotSet, permission=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
post_parameters = {
"name": name,
}
if repo_names is not GithubObject.NotSet:
- post_parameters[ "repo_names" ] = [ element._identity for element in repo_names ]
+ post_parameters["repo_names"] = [element._identity for element in repo_names]
if permission is not GithubObject.NotSet:
- post_parameters[ "permission" ] = permission
+ post_parameters["permission"] = permission
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/teams",
None,
post_parameters
)
- return Team.Team( self._requester, data, completed = True )
+ return 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=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
post_parameters = dict()
if billing_email is not GithubObject.NotSet:
- post_parameters[ "billing_email" ] = billing_email
+ post_parameters["billing_email"] = billing_email
if blog is not GithubObject.NotSet:
- post_parameters[ "blog" ] = blog
+ post_parameters["blog"] = blog
if company is not GithubObject.NotSet:
- post_parameters[ "company" ] = company
+ post_parameters["company"] = company
if email is not GithubObject.NotSet:
- post_parameters[ "email" ] = email
+ post_parameters["email"] = email
if location is not GithubObject.NotSet:
- post_parameters[ "location" ] = location
+ post_parameters["location"] = location
if name is not GithubObject.NotSet:
- post_parameters[ "name" ] = name
+ post_parameters["name"] = name
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def get_events( self ):
+ def get_events(self):
return PaginatedList.PaginatedList(
Event.Event,
self._requester,
@@ -252,7 +253,7 @@ class Organization( GithubObject.GithubObject ):
None
)
- def get_members( self ):
+ def get_members(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -260,7 +261,7 @@ class Organization( GithubObject.GithubObject ):
None
)
- def get_public_members( self ):
+ def get_public_members(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -268,21 +269,21 @@ class Organization( GithubObject.GithubObject ):
None
)
- def get_repo( self, name ):
- assert isinstance( name, ( str, unicode ) ), name
+ def get_repo(self, name):
+ assert isinstance(name, (str, unicode)), name
headers, data = self._requester.requestAndCheck(
"GET",
"/repos/" + self.login + "/" + name,
None,
None
)
- return Repository.Repository( self._requester, data, completed = True )
+ return 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=GithubObject.NotSet):
+ assert type is GithubObject.NotSet or isinstance(type, (str, unicode)), type
url_parameters = dict()
if type is not GithubObject.NotSet:
- url_parameters[ "type" ] = type
+ url_parameters["type"] = type
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -290,17 +291,17 @@ class Organization( GithubObject.GithubObject ):
url_parameters
)
- def get_team( self, id ):
- assert isinstance( id, int ), id
+ def get_team(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- "/teams/" + str( id ),
+ "/teams/" + str(id),
None,
None
)
- return Team.Team( self._requester, data, completed = True )
+ return Team.Team(self._requester, data, completed=True)
- def get_teams( self ):
+ def get_teams(self):
return PaginatedList.PaginatedList(
Team.Team,
self._requester,
@@ -308,8 +309,8 @@ class Organization( GithubObject.GithubObject ):
None
)
- def has_in_members( self, member ):
- assert isinstance( member, NamedUser.NamedUser ), member
+ def has_in_members(self, member):
+ assert isinstance(member, NamedUser.NamedUser), member
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/members/" + member._identity,
@@ -318,8 +319,8 @@ class Organization( GithubObject.GithubObject ):
)
return status == 204
- def has_in_public_members( self, public_member ):
- assert isinstance( public_member, NamedUser.NamedUser ), public_member
+ def has_in_public_members(self, public_member):
+ assert isinstance(public_member, NamedUser.NamedUser), public_member
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/public_members/" + public_member._identity,
@@ -328,8 +329,8 @@ class Organization( GithubObject.GithubObject ):
)
return status == 204
- def remove_from_members( self, member ):
- assert isinstance( member, NamedUser.NamedUser ), member
+ def remove_from_members(self, member):
+ assert isinstance(member, NamedUser.NamedUser), member
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/members/" + member._identity,
@@ -337,8 +338,8 @@ class Organization( GithubObject.GithubObject ):
None
)
- def remove_from_public_members( self, public_member ):
- assert isinstance( public_member, NamedUser.NamedUser ), public_member
+ def remove_from_public_members(self, public_member):
+ assert isinstance(public_member, NamedUser.NamedUser), public_member
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/public_members/" + public_member._identity,
@@ -346,7 +347,7 @@ class Organization( GithubObject.GithubObject ):
None
)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._avatar_url = GithubObject.NotSet
self._billing_email = GithubObject.NotSet
self._blog = GithubObject.NotSet
@@ -372,76 +373,76 @@ class Organization( GithubObject.GithubObject ):
self._type = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "avatar_url" in attributes: # pragma no branch
- assert attributes[ "avatar_url" ] is None or isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ]
- self._avatar_url = attributes[ "avatar_url" ]
- if "billing_email" in attributes: # pragma no branch
- assert attributes[ "billing_email" ] is None or isinstance( attributes[ "billing_email" ], ( str, unicode ) ), attributes[ "billing_email" ]
- self._billing_email = attributes[ "billing_email" ]
- if "blog" in attributes: # pragma no branch
- assert attributes[ "blog" ] is None or isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ]
- self._blog = attributes[ "blog" ]
- if "collaborators" in attributes: # pragma no branch
- assert attributes[ "collaborators" ] is None or isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ]
- self._collaborators = attributes[ "collaborators" ]
- if "company" in attributes: # pragma no branch
- assert attributes[ "company" ] is None or isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ]
- self._company = attributes[ "company" ]
- 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" ] )
- if "disk_usage" in attributes: # pragma no branch
- assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ]
- self._disk_usage = attributes[ "disk_usage" ]
- if "email" in attributes: # pragma no branch
- assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ]
- self._email = attributes[ "email" ]
- if "followers" in attributes: # pragma no branch
- assert attributes[ "followers" ] is None or isinstance( attributes[ "followers" ], int ), attributes[ "followers" ]
- self._followers = attributes[ "followers" ]
- if "following" in attributes: # pragma no branch
- assert attributes[ "following" ] is None or isinstance( attributes[ "following" ], int ), attributes[ "following" ]
- self._following = attributes[ "following" ]
- if "gravatar_id" in attributes: # pragma no branch
- assert attributes[ "gravatar_id" ] is None or isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ]
- self._gravatar_id = attributes[ "gravatar_id" ]
- 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" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "location" in attributes: # pragma no branch
- assert attributes[ "location" ] is None or isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ]
- self._location = attributes[ "location" ]
- if "login" in attributes: # pragma no branch
- assert attributes[ "login" ] is None or isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ]
- self._login = attributes[ "login" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "owned_private_repos" in attributes: # pragma no branch
- assert attributes[ "owned_private_repos" ] is None or isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ]
- 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 )
- if "private_gists" in attributes: # pragma no branch
- assert attributes[ "private_gists" ] is None or isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ]
- self._private_gists = attributes[ "private_gists" ]
- if "public_gists" in attributes: # pragma no branch
- assert attributes[ "public_gists" ] is None or isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ]
- self._public_gists = attributes[ "public_gists" ]
- if "public_repos" in attributes: # pragma no branch
- assert attributes[ "public_repos" ] is None or isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ]
- self._public_repos = attributes[ "public_repos" ]
- if "total_private_repos" in attributes: # pragma no branch
- assert attributes[ "total_private_repos" ] is None or isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ]
- self._total_private_repos = attributes[ "total_private_repos" ]
- if "type" in attributes: # pragma no branch
- assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
- self._type = attributes[ "type" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "avatar_url" in attributes: # pragma no branch
+ assert attributes["avatar_url"] is None or isinstance(attributes["avatar_url"], (str, unicode)), attributes["avatar_url"]
+ self._avatar_url = attributes["avatar_url"]
+ if "billing_email" in attributes: # pragma no branch
+ assert attributes["billing_email"] is None or isinstance(attributes["billing_email"], (str, unicode)), attributes["billing_email"]
+ self._billing_email = attributes["billing_email"]
+ if "blog" in attributes: # pragma no branch
+ assert attributes["blog"] is None or isinstance(attributes["blog"], (str, unicode)), attributes["blog"]
+ self._blog = attributes["blog"]
+ if "collaborators" in attributes: # pragma no branch
+ assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], int), attributes["collaborators"]
+ self._collaborators = attributes["collaborators"]
+ if "company" in attributes: # pragma no branch
+ assert attributes["company"] is None or isinstance(attributes["company"], (str, unicode)), attributes["company"]
+ self._company = attributes["company"]
+ 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"])
+ if "disk_usage" in attributes: # pragma no branch
+ assert attributes["disk_usage"] is None or isinstance(attributes["disk_usage"], int), attributes["disk_usage"]
+ self._disk_usage = attributes["disk_usage"]
+ if "email" in attributes: # pragma no branch
+ assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"]
+ self._email = attributes["email"]
+ if "followers" in attributes: # pragma no branch
+ assert attributes["followers"] is None or isinstance(attributes["followers"], int), attributes["followers"]
+ self._followers = attributes["followers"]
+ if "following" in attributes: # pragma no branch
+ assert attributes["following"] is None or isinstance(attributes["following"], int), attributes["following"]
+ self._following = attributes["following"]
+ if "gravatar_id" in attributes: # pragma no branch
+ assert attributes["gravatar_id"] is None or isinstance(attributes["gravatar_id"], (str, unicode)), attributes["gravatar_id"]
+ self._gravatar_id = attributes["gravatar_id"]
+ 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"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "location" in attributes: # pragma no branch
+ assert attributes["location"] is None or isinstance(attributes["location"], (str, unicode)), attributes["location"]
+ self._location = attributes["location"]
+ if "login" in attributes: # pragma no branch
+ assert attributes["login"] is None or isinstance(attributes["login"], (str, unicode)), attributes["login"]
+ self._login = attributes["login"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "owned_private_repos" in attributes: # pragma no branch
+ assert attributes["owned_private_repos"] is None or isinstance(attributes["owned_private_repos"], int), attributes["owned_private_repos"]
+ 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)
+ if "private_gists" in attributes: # pragma no branch
+ assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], int), attributes["private_gists"]
+ self._private_gists = attributes["private_gists"]
+ if "public_gists" in attributes: # pragma no branch
+ assert attributes["public_gists"] is None or isinstance(attributes["public_gists"], int), attributes["public_gists"]
+ self._public_gists = attributes["public_gists"]
+ if "public_repos" in attributes: # pragma no branch
+ assert attributes["public_repos"] is None or isinstance(attributes["public_repos"], int), attributes["public_repos"]
+ self._public_repos = attributes["public_repos"]
+ if "total_private_repos" in attributes: # pragma no branch
+ assert attributes["total_private_repos"] is None or isinstance(attributes["total_private_repos"], int), attributes["total_private_repos"]
+ self._total_private_repos = attributes["total_private_repos"]
+ if "type" in attributes: # pragma no branch
+ assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"]
+ self._type = attributes["type"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/PaginatedList.py b/github/PaginatedList.py
index f04d1540..24a14b8a 100644
--- a/github/PaginatedList.py
+++ b/github/PaginatedList.py
@@ -13,19 +13,20 @@
import GithubObject
+
class PaginatedListBase:
- def __init__( self ):
+ def __init__(self):
self.__elements = list()
- def __getitem__( self, index ):
- assert isinstance( index, ( int, slice ) )
- if isinstance( index, int ):
- self.__fetchToIndex( index )
- return self.__elements[ index ]
+ def __getitem__(self, index):
+ assert isinstance(index, (int, slice))
+ if isinstance(index, int):
+ self.__fetchToIndex(index)
+ return self.__elements[index]
else:
- return self._Slice( self, index )
+ return self._Slice(self, index)
- def __iter__( self ):
+ def __iter__(self):
for element in self.__elements:
yield element
while self._couldGrow():
@@ -33,40 +34,41 @@ class PaginatedListBase:
for element in newElements:
yield element
- def _isBiggerThan( self, index ):
- return len( self.__elements ) > index or self._couldGrow()
+ def _isBiggerThan(self, index):
+ return len(self.__elements) > index or self._couldGrow()
- def __fetchToIndex( self, index ):
- while len( self.__elements ) <= index and self._couldGrow():
+ def __fetchToIndex(self, index):
+ while len(self.__elements) <= index and self._couldGrow():
self.__grow()
- def __grow( self ):
+ def __grow(self):
newElements = self._fetchNextPage()
self.__elements += newElements
return newElements
class _Slice:
- def __init__( self, theList, theSlice ):
+ def __init__(self, theList, theSlice):
self.__list = theList
self.__start = theSlice.start or 0
self.__stop = theSlice.stop
self.__step = theSlice.step or 1
- def __iter__( self ):
+ def __iter__(self):
index = self.__start
- while not self.__finished( index ) :
- if self.__list._isBiggerThan( index ):
- yield self.__list[ index ]
+ while not self.__finished(index):
+ if self.__list._isBiggerThan(index):
+ yield self.__list[index]
index += self.__step
else:
return
- def __finished( self, index ):
+ def __finished(self, index):
return self.__stop is not None and index >= self.__stop
-class PaginatedList( PaginatedListBase ):
- def __init__( self, contentClass, requester, firstUrl, firstParams ):
- PaginatedListBase.__init__( self )
+
+class PaginatedList(PaginatedListBase):
+ def __init__(self, contentClass, requester, firstUrl, firstParams):
+ PaginatedListBase.__init__(self)
self.__requester = requester
self.__contentClass = contentClass
self.__firstUrl = firstUrl
@@ -74,42 +76,42 @@ class PaginatedList( PaginatedListBase ):
self.__nextUrl = firstUrl
self.__nextParams = firstParams
- def _couldGrow( self ):
+ def _couldGrow(self):
return self.__nextUrl is not None
- def _fetchNextPage( self ):
- headers, data = self.__requester.requestAndCheck( "GET", self.__nextUrl, self.__nextParams, None )
+ def _fetchNextPage(self):
+ headers, data = self.__requester.requestAndCheck("GET", self.__nextUrl, self.__nextParams, None)
- links = self.__parseLinkHeader( headers )
- if len( data ) > 0 and "next" in links:
- self.__nextUrl = links[ "next" ]
+ links = self.__parseLinkHeader(headers)
+ if len(data) > 0 and "next" in links:
+ self.__nextUrl = links["next"]
else:
self.__nextUrl = None
self.__nextParams = None
return [
- self.__contentClass( self.__requester, element, completed = False )
+ self.__contentClass(self.__requester, element, completed=False)
for element in data
]
- def __parseLinkHeader( self, headers ):
+ def __parseLinkHeader(self, headers):
links = {}
if "link" in headers:
- linkHeaders = headers[ "link" ].split( "," )
+ linkHeaders = headers["link"].split(",")
for linkHeader in linkHeaders:
- ( url, rel ) = linkHeader.split( "; " )
- url = url[ 1 : -1 ]
- rel = rel[ 5 : -1 ]
- links[ rel ] = url
+ (url, rel) = linkHeader.split("; ")
+ url = url[1:-1]
+ rel = rel[5:-1]
+ links[rel] = url
return links
- def get_page( self, page ):
- params = dict( self.__firstParams )
+ def get_page(self, page):
+ params = dict(self.__firstParams)
if page != 0:
- params[ "page" ] = page + 1
- headers, data = self.__requester.requestAndCheck( "GET", self.__firstUrl, params, None )
+ params["page"] = page + 1
+ headers, data = self.__requester.requestAndCheck("GET", self.__firstUrl, params, None)
return [
- self.__contentClass( self.__requester, element, completed = False )
+ self.__contentClass(self.__requester, element, completed=False)
for element in data
]
diff --git a/github/Permissions.py b/github/Permissions.py
index a0782c43..0c776469 100644
--- a/github/Permissions.py
+++ b/github/Permissions.py
@@ -13,31 +13,32 @@
import GithubObject
-class Permissions( GithubObject.BasicGithubObject ):
+
+class Permissions(GithubObject.BasicGithubObject):
@property
- def admin( self ):
- return self._NoneIfNotSet( self._admin )
+ def admin(self):
+ return self._NoneIfNotSet(self._admin)
@property
- def pull( self ):
- return self._NoneIfNotSet( self._pull )
+ def pull(self):
+ return self._NoneIfNotSet(self._pull)
@property
- def push( self ):
- return self._NoneIfNotSet( self._push )
+ def push(self):
+ return self._NoneIfNotSet(self._push)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._admin = GithubObject.NotSet
self._pull = GithubObject.NotSet
self._push = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "admin" in attributes: # pragma no branch
- assert attributes[ "admin" ] is None or isinstance( attributes[ "admin" ], bool ), attributes[ "admin" ]
- self._admin = attributes[ "admin" ]
- if "pull" in attributes: # pragma no branch
- assert attributes[ "pull" ] is None or isinstance( attributes[ "pull" ], bool ), attributes[ "pull" ]
- self._pull = attributes[ "pull" ]
- if "push" in attributes: # pragma no branch
- assert attributes[ "push" ] is None or isinstance( attributes[ "push" ], bool ), attributes[ "push" ]
- self._push = attributes[ "push" ]
+ def _useAttributes(self, attributes):
+ if "admin" in attributes: # pragma no branch
+ assert attributes["admin"] is None or isinstance(attributes["admin"], bool), attributes["admin"]
+ self._admin = attributes["admin"]
+ if "pull" in attributes: # pragma no branch
+ assert attributes["pull"] is None or isinstance(attributes["pull"], bool), attributes["pull"]
+ self._pull = attributes["pull"]
+ if "push" in attributes: # pragma no branch
+ assert attributes["push"] is None or isinstance(attributes["push"], bool), attributes["push"]
+ self._push = attributes["push"]
diff --git a/github/Plan.py b/github/Plan.py
index 5eb0d435..76f801be 100644
--- a/github/Plan.py
+++ b/github/Plan.py
@@ -13,39 +13,40 @@
import GithubObject
-class Plan( GithubObject.BasicGithubObject ):
+
+class Plan(GithubObject.BasicGithubObject):
@property
- def collaborators( self ):
- return self._NoneIfNotSet( self._collaborators )
+ def collaborators(self):
+ return self._NoneIfNotSet(self._collaborators)
@property
- def name( self ):
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ return self._NoneIfNotSet(self._name)
@property
- def private_repos( self ):
- return self._NoneIfNotSet( self._private_repos )
+ def private_repos(self):
+ return self._NoneIfNotSet(self._private_repos)
@property
- def space( self ):
- return self._NoneIfNotSet( self._space )
+ def space(self):
+ return self._NoneIfNotSet(self._space)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._collaborators = GithubObject.NotSet
self._name = GithubObject.NotSet
self._private_repos = GithubObject.NotSet
self._space = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "collaborators" in attributes: # pragma no branch
- assert attributes[ "collaborators" ] is None or isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ]
- self._collaborators = attributes[ "collaborators" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "private_repos" in attributes: # pragma no branch
- assert attributes[ "private_repos" ] is None or isinstance( attributes[ "private_repos" ], int ), attributes[ "private_repos" ]
- self._private_repos = attributes[ "private_repos" ]
- if "space" in attributes: # pragma no branch
- assert attributes[ "space" ] is None or isinstance( attributes[ "space" ], int ), attributes[ "space" ]
- self._space = attributes[ "space" ]
+ def _useAttributes(self, attributes):
+ if "collaborators" in attributes: # pragma no branch
+ assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], int), attributes["collaborators"]
+ self._collaborators = attributes["collaborators"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "private_repos" in attributes: # pragma no branch
+ assert attributes["private_repos"] is None or isinstance(attributes["private_repos"], int), attributes["private_repos"]
+ self._private_repos = attributes["private_repos"]
+ if "space" in attributes: # pragma no branch
+ assert attributes["space"] is None or isinstance(attributes["space"], int), attributes["space"]
+ self._space = attributes["space"]
diff --git a/github/PullRequest.py b/github/PullRequest.py
index 6fb604b5..a31b4a45 100644
--- a/github/PullRequest.py
+++ b/github/PullRequest.py
@@ -22,145 +22,146 @@ import File
import IssueComment
import Commit
-class PullRequest( GithubObject.GithubObject ):
+
+class PullRequest(GithubObject.GithubObject):
@property
- def additions( self ):
- self._completeIfNotSet( self._additions )
- return self._NoneIfNotSet( self._additions )
+ def additions(self):
+ self._completeIfNotSet(self._additions)
+ return self._NoneIfNotSet(self._additions)
@property
- def base( self ):
- self._completeIfNotSet( self._base )
- return self._NoneIfNotSet( self._base )
+ def base(self):
+ self._completeIfNotSet(self._base)
+ return self._NoneIfNotSet(self._base)
@property
- def body( self ):
- self._completeIfNotSet( self._body )
- return self._NoneIfNotSet( self._body )
+ def body(self):
+ self._completeIfNotSet(self._body)
+ return self._NoneIfNotSet(self._body)
@property
- def changed_files( self ):
- self._completeIfNotSet( self._changed_files )
- return self._NoneIfNotSet( self._changed_files )
+ def changed_files(self):
+ self._completeIfNotSet(self._changed_files)
+ return self._NoneIfNotSet(self._changed_files)
@property
- def closed_at( self ):
- self._completeIfNotSet( self._closed_at )
- return self._NoneIfNotSet( self._closed_at )
+ def closed_at(self):
+ self._completeIfNotSet(self._closed_at)
+ return self._NoneIfNotSet(self._closed_at)
@property
- def comments( self ):
- self._completeIfNotSet( self._comments )
- return self._NoneIfNotSet( self._comments )
+ def comments(self):
+ self._completeIfNotSet(self._comments)
+ return self._NoneIfNotSet(self._comments)
@property
- def commits( self ):
- self._completeIfNotSet( self._commits )
- return self._NoneIfNotSet( self._commits )
+ def commits(self):
+ self._completeIfNotSet(self._commits)
+ return self._NoneIfNotSet(self._commits)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def deletions( self ):
- self._completeIfNotSet( self._deletions )
- return self._NoneIfNotSet( self._deletions )
+ def deletions(self):
+ self._completeIfNotSet(self._deletions)
+ return self._NoneIfNotSet(self._deletions)
@property
- def diff_url( self ):
- self._completeIfNotSet( self._diff_url )
- return self._NoneIfNotSet( self._diff_url )
+ def diff_url(self):
+ self._completeIfNotSet(self._diff_url)
+ return self._NoneIfNotSet(self._diff_url)
@property
- def head( self ):
- self._completeIfNotSet( self._head )
- return self._NoneIfNotSet( self._head )
+ def head(self):
+ self._completeIfNotSet(self._head)
+ return self._NoneIfNotSet(self._head)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def issue_url( self ):
- self._completeIfNotSet( self._issue_url )
- return self._NoneIfNotSet( self._issue_url )
+ def issue_url(self):
+ self._completeIfNotSet(self._issue_url)
+ return self._NoneIfNotSet(self._issue_url)
@property
- def mergeable( self ):
- self._completeIfNotSet( self._mergeable )
- return self._NoneIfNotSet( self._mergeable )
+ def mergeable(self):
+ self._completeIfNotSet(self._mergeable)
+ return self._NoneIfNotSet(self._mergeable)
@property
- def merged( self ):
- self._completeIfNotSet( self._merged )
- return self._NoneIfNotSet( self._merged )
+ def merged(self):
+ self._completeIfNotSet(self._merged)
+ return self._NoneIfNotSet(self._merged)
@property
- def merged_at( self ):
- self._completeIfNotSet( self._merged_at )
- return self._NoneIfNotSet( self._merged_at )
+ def merged_at(self):
+ self._completeIfNotSet(self._merged_at)
+ return self._NoneIfNotSet(self._merged_at)
@property
- def merged_by( self ):
- self._completeIfNotSet( self._merged_by )
- return self._NoneIfNotSet( self._merged_by )
+ def merged_by(self):
+ self._completeIfNotSet(self._merged_by)
+ return self._NoneIfNotSet(self._merged_by)
@property
- def number( self ):
- self._completeIfNotSet( self._number )
- return self._NoneIfNotSet( self._number )
+ def number(self):
+ self._completeIfNotSet(self._number)
+ return self._NoneIfNotSet(self._number)
@property
- def patch_url( self ):
- self._completeIfNotSet( self._patch_url )
- return self._NoneIfNotSet( self._patch_url )
+ def patch_url(self):
+ self._completeIfNotSet(self._patch_url)
+ return self._NoneIfNotSet(self._patch_url)
@property
- def review_comments( self ):
- self._completeIfNotSet( self._review_comments )
- return self._NoneIfNotSet( self._review_comments )
+ def review_comments(self):
+ self._completeIfNotSet(self._review_comments)
+ return self._NoneIfNotSet(self._review_comments)
@property
- def state( self ):
- self._completeIfNotSet( self._state )
- return self._NoneIfNotSet( self._state )
+ def state(self):
+ self._completeIfNotSet(self._state)
+ return self._NoneIfNotSet(self._state)
@property
- def title( self ):
- self._completeIfNotSet( self._title )
- return self._NoneIfNotSet( self._title )
+ def title(self):
+ self._completeIfNotSet(self._title)
+ return self._NoneIfNotSet(self._title)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def user( self ):
- self._completeIfNotSet( self._user )
- return self._NoneIfNotSet( self._user )
+ def user(self):
+ self._completeIfNotSet(self._user)
+ return self._NoneIfNotSet(self._user)
- def create_comment( self, body, commit_id, path, position ):
- return self.create_review_comment( body, commit_id, path, position )
+ def create_comment(self, body, commit_id, path, position):
+ return self.create_review_comment(body, commit_id, path, position)
- 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( path, ( str, unicode ) ), path
- assert isinstance( position, int ), position
+ 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(path, (str, unicode)), path
+ assert isinstance(position, int), position
post_parameters = {
"body": body,
"commit_id": commit_id._identity,
@@ -173,57 +174,57 @@ class PullRequest( GithubObject.GithubObject ):
None,
post_parameters
)
- return PullRequestComment.PullRequestComment( self._requester, data, completed = True )
+ return PullRequestComment.PullRequestComment(self._requester, data, completed=True)
- def create_issue_comment( self, body ):
- assert isinstance( body, ( str, unicode ) ), body
+ def create_issue_comment(self, body):
+ assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
}
headers, data = self._requester.requestAndCheck(
"POST",
- self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments",
+ self._parentUrl(self._parentUrl(self.url)) + "/issues/" + str(self.number) + "/comments",
None,
post_parameters
)
- return IssueComment.IssueComment( self._requester, data, completed = True )
+ return 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=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
post_parameters = dict()
if title is not GithubObject.NotSet:
- post_parameters[ "title" ] = title
+ post_parameters["title"] = title
if body is not GithubObject.NotSet:
- post_parameters[ "body" ] = body
+ post_parameters["body"] = body
if state is not GithubObject.NotSet:
- post_parameters[ "state" ] = state
+ post_parameters["state"] = state
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def get_comment( self, id ):
- return self.get_review_comment( id )
+ def get_comment(self, id):
+ return self.get_review_comment(id)
- def get_review_comment( self, id ):
- assert isinstance( id, int ), id
+ def get_review_comment(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- self._parentUrl( self.url ) + "/comments/" + str( id ),
+ self._parentUrl(self.url) + "/comments/" + str(id),
None,
None
)
- return PullRequestComment.PullRequestComment( self._requester, data, completed = True )
+ return PullRequestComment.PullRequestComment(self._requester, data, completed=True)
- def get_comments( self ):
+ def get_comments(self):
return self.get_review_comments()
- def get_review_comments( self ):
+ def get_review_comments(self):
return PaginatedList.PaginatedList(
PullRequestComment.PullRequestComment,
self._requester,
@@ -231,7 +232,7 @@ class PullRequest( GithubObject.GithubObject ):
None
)
- def get_commits( self ):
+ def get_commits(self):
return PaginatedList.PaginatedList(
Commit.Commit,
self._requester,
@@ -239,7 +240,7 @@ class PullRequest( GithubObject.GithubObject ):
None
)
- def get_files( self ):
+ def get_files(self):
return PaginatedList.PaginatedList(
File.File,
self._requester,
@@ -247,25 +248,25 @@ class PullRequest( GithubObject.GithubObject ):
None
)
- def get_issue_comment( self, id ):
- assert isinstance( id, int ), id
+ def get_issue_comment(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- self._parentUrl( self._parentUrl( self.url ) ) + "/issues/comments/" + str( id ),
+ self._parentUrl(self._parentUrl(self.url)) + "/issues/comments/" + str(id),
None,
None
)
- return IssueComment.IssueComment( self._requester, data, completed = True )
+ return IssueComment.IssueComment(self._requester, data, completed=True)
- def get_issue_comments( self ):
+ def get_issue_comments(self):
return PaginatedList.PaginatedList(
IssueComment.IssueComment,
self._requester,
- self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments",
+ self._parentUrl(self._parentUrl(self.url)) + "/issues/" + str(self.number) + "/comments",
None
)
- def is_merged( self ):
+ def is_merged(self):
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/merge",
@@ -274,20 +275,20 @@ 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=GithubObject.NotSet):
+ assert commit_message is GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message
post_parameters = dict()
if commit_message is not GithubObject.NotSet:
- post_parameters[ "commit_message" ] = commit_message
+ post_parameters["commit_message"] = commit_message
headers, data = self._requester.requestAndCheck(
"PUT",
self.url + "/merge",
None,
post_parameters
)
- return PullRequestMergeStatus.PullRequestMergeStatus( self._requester, data, completed = True )
+ return PullRequestMergeStatus.PullRequestMergeStatus(self._requester, data, completed=True)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._additions = GithubObject.NotSet
self._base = GithubObject.NotSet
self._body = GithubObject.NotSet
@@ -315,82 +316,82 @@ class PullRequest( GithubObject.GithubObject ):
self._url = GithubObject.NotSet
self._user = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "additions" in attributes: # pragma no branch
- assert attributes[ "additions" ] is None or isinstance( attributes[ "additions" ], int ), attributes[ "additions" ]
- self._additions = attributes[ "additions" ]
- 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 )
- if "body" in attributes: # pragma no branch
- assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
- self._body = attributes[ "body" ]
- if "changed_files" in attributes: # pragma no branch
- assert attributes[ "changed_files" ] is None or isinstance( attributes[ "changed_files" ], int ), attributes[ "changed_files" ]
- self._changed_files = attributes[ "changed_files" ]
- if "closed_at" in attributes: # pragma no branch
- assert attributes[ "closed_at" ] is None or isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ]
- self._closed_at = self._parseDatetime( attributes[ "closed_at" ] )
- if "comments" in attributes: # pragma no branch
- assert attributes[ "comments" ] is None or isinstance( attributes[ "comments" ], int ), attributes[ "comments" ]
- self._comments = attributes[ "comments" ]
- if "commits" in attributes: # pragma no branch
- assert attributes[ "commits" ] is None or isinstance( attributes[ "commits" ], int ), attributes[ "commits" ]
- self._commits = attributes[ "commits" ]
- 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" ] )
- if "deletions" in attributes: # pragma no branch
- assert attributes[ "deletions" ] is None or isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ]
- self._deletions = attributes[ "deletions" ]
- if "diff_url" in attributes: # pragma no branch
- assert attributes[ "diff_url" ] is None or isinstance( attributes[ "diff_url" ], ( str, unicode ) ), attributes[ "diff_url" ]
- 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 )
- 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" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "issue_url" in attributes: # pragma no branch
- assert attributes[ "issue_url" ] is None or isinstance( attributes[ "issue_url" ], ( str, unicode ) ), attributes[ "issue_url" ]
- self._issue_url = attributes[ "issue_url" ]
- if "mergeable" in attributes: # pragma no branch
- assert attributes[ "mergeable" ] is None or isinstance( attributes[ "mergeable" ], bool ), attributes[ "mergeable" ]
- self._mergeable = attributes[ "mergeable" ]
- if "merged" in attributes: # pragma no branch
- assert attributes[ "merged" ] is None or isinstance( attributes[ "merged" ], bool ), attributes[ "merged" ]
- self._merged = attributes[ "merged" ]
- if "merged_at" in attributes: # pragma no branch
- assert attributes[ "merged_at" ] is None or isinstance( attributes[ "merged_at" ], ( str, unicode ) ), attributes[ "merged_at" ]
- 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 )
- if "number" in attributes: # pragma no branch
- assert attributes[ "number" ] is None or isinstance( attributes[ "number" ], int ), attributes[ "number" ]
- self._number = attributes[ "number" ]
- if "patch_url" in attributes: # pragma no branch
- assert attributes[ "patch_url" ] is None or isinstance( attributes[ "patch_url" ], ( str, unicode ) ), attributes[ "patch_url" ]
- self._patch_url = attributes[ "patch_url" ]
- if "review_comments" in attributes: # pragma no branch
- assert attributes[ "review_comments" ] is None or isinstance( attributes[ "review_comments" ], int ), attributes[ "review_comments" ]
- self._review_comments = attributes[ "review_comments" ]
- if "state" in attributes: # pragma no branch
- assert attributes[ "state" ] is None or isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ]
- self._state = attributes[ "state" ]
- if "title" in attributes: # pragma no branch
- assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
- self._title = attributes[ "title" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- 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 )
+ def _useAttributes(self, attributes):
+ if "additions" in attributes: # pragma no branch
+ assert attributes["additions"] is None or isinstance(attributes["additions"], int), attributes["additions"]
+ self._additions = attributes["additions"]
+ 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)
+ if "body" in attributes: # pragma no branch
+ assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
+ self._body = attributes["body"]
+ if "changed_files" in attributes: # pragma no branch
+ assert attributes["changed_files"] is None or isinstance(attributes["changed_files"], int), attributes["changed_files"]
+ self._changed_files = attributes["changed_files"]
+ if "closed_at" in attributes: # pragma no branch
+ assert attributes["closed_at"] is None or isinstance(attributes["closed_at"], (str, unicode)), attributes["closed_at"]
+ self._closed_at = self._parseDatetime(attributes["closed_at"])
+ if "comments" in attributes: # pragma no branch
+ assert attributes["comments"] is None or isinstance(attributes["comments"], int), attributes["comments"]
+ self._comments = attributes["comments"]
+ if "commits" in attributes: # pragma no branch
+ assert attributes["commits"] is None or isinstance(attributes["commits"], int), attributes["commits"]
+ self._commits = attributes["commits"]
+ 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"])
+ if "deletions" in attributes: # pragma no branch
+ assert attributes["deletions"] is None or isinstance(attributes["deletions"], int), attributes["deletions"]
+ self._deletions = attributes["deletions"]
+ if "diff_url" in attributes: # pragma no branch
+ assert attributes["diff_url"] is None or isinstance(attributes["diff_url"], (str, unicode)), attributes["diff_url"]
+ 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)
+ 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"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "issue_url" in attributes: # pragma no branch
+ assert attributes["issue_url"] is None or isinstance(attributes["issue_url"], (str, unicode)), attributes["issue_url"]
+ self._issue_url = attributes["issue_url"]
+ if "mergeable" in attributes: # pragma no branch
+ assert attributes["mergeable"] is None or isinstance(attributes["mergeable"], bool), attributes["mergeable"]
+ self._mergeable = attributes["mergeable"]
+ if "merged" in attributes: # pragma no branch
+ assert attributes["merged"] is None or isinstance(attributes["merged"], bool), attributes["merged"]
+ self._merged = attributes["merged"]
+ if "merged_at" in attributes: # pragma no branch
+ assert attributes["merged_at"] is None or isinstance(attributes["merged_at"], (str, unicode)), attributes["merged_at"]
+ 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)
+ if "number" in attributes: # pragma no branch
+ assert attributes["number"] is None or isinstance(attributes["number"], int), attributes["number"]
+ self._number = attributes["number"]
+ if "patch_url" in attributes: # pragma no branch
+ assert attributes["patch_url"] is None or isinstance(attributes["patch_url"], (str, unicode)), attributes["patch_url"]
+ self._patch_url = attributes["patch_url"]
+ if "review_comments" in attributes: # pragma no branch
+ assert attributes["review_comments"] is None or isinstance(attributes["review_comments"], int), attributes["review_comments"]
+ self._review_comments = attributes["review_comments"]
+ if "state" in attributes: # pragma no branch
+ assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"]
+ self._state = attributes["state"]
+ if "title" in attributes: # pragma no branch
+ assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"]
+ self._title = attributes["title"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ 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)
diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py
index eb042a3c..04525b01 100644
--- a/github/PullRequestComment.py
+++ b/github/PullRequestComment.py
@@ -15,63 +15,64 @@ import GithubObject
import NamedUser
-class PullRequestComment( GithubObject.GithubObject ):
+
+class PullRequestComment(GithubObject.GithubObject):
@property
- def body( self ):
- self._completeIfNotSet( self._body )
- return self._NoneIfNotSet( self._body )
+ def body(self):
+ self._completeIfNotSet(self._body)
+ return self._NoneIfNotSet(self._body)
@property
- def commit_id( self ):
- self._completeIfNotSet( self._commit_id )
- return self._NoneIfNotSet( self._commit_id )
+ def commit_id(self):
+ self._completeIfNotSet(self._commit_id)
+ return self._NoneIfNotSet(self._commit_id)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def original_commit_id( self ):
- self._completeIfNotSet( self._original_commit_id )
- return self._NoneIfNotSet( self._original_commit_id )
+ def original_commit_id(self):
+ self._completeIfNotSet(self._original_commit_id)
+ return self._NoneIfNotSet(self._original_commit_id)
@property
- def original_position( self ):
- self._completeIfNotSet( self._original_position )
- return self._NoneIfNotSet( self._original_position )
+ def original_position(self):
+ self._completeIfNotSet(self._original_position)
+ return self._NoneIfNotSet(self._original_position)
@property
- def path( self ):
- self._completeIfNotSet( self._path )
- return self._NoneIfNotSet( self._path )
+ def path(self):
+ self._completeIfNotSet(self._path)
+ return self._NoneIfNotSet(self._path)
@property
- def position( self ):
- self._completeIfNotSet( self._position )
- return self._NoneIfNotSet( self._position )
+ def position(self):
+ self._completeIfNotSet(self._position)
+ return self._NoneIfNotSet(self._position)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def user( self ):
- self._completeIfNotSet( self._user )
- return self._NoneIfNotSet( self._user )
+ def user(self):
+ self._completeIfNotSet(self._user)
+ return self._NoneIfNotSet(self._user)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -79,8 +80,8 @@ class PullRequestComment( GithubObject.GithubObject ):
None
)
- def edit( self, body ):
- assert isinstance( body, ( str, unicode ) ), body
+ def edit(self, body):
+ assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
}
@@ -90,9 +91,9 @@ class PullRequestComment( GithubObject.GithubObject ):
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._body = GithubObject.NotSet
self._commit_id = GithubObject.NotSet
self._created_at = GithubObject.NotSet
@@ -105,37 +106,37 @@ class PullRequestComment( GithubObject.GithubObject ):
self._url = GithubObject.NotSet
self._user = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "body" in attributes: # pragma no branch
- assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
- self._body = attributes[ "body" ]
- 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" ]
- 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" ] )
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "original_commit_id" in attributes: # pragma no branch
- assert attributes[ "original_commit_id" ] is None or isinstance( attributes[ "original_commit_id" ], ( str, unicode ) ), attributes[ "original_commit_id" ]
- self._original_commit_id = attributes[ "original_commit_id" ]
- if "original_position" in attributes: # pragma no branch
- assert attributes[ "original_position" ] is None or isinstance( attributes[ "original_position" ], int ), attributes[ "original_position" ]
- self._original_position = attributes[ "original_position" ]
- if "path" in attributes: # pragma no branch
- assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ]
- self._path = attributes[ "path" ]
- if "position" in attributes: # pragma no branch
- assert attributes[ "position" ] is None or isinstance( attributes[ "position" ], int ), attributes[ "position" ]
- self._position = attributes[ "position" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- 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 )
+ def _useAttributes(self, attributes):
+ if "body" in attributes: # pragma no branch
+ assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"]
+ self._body = attributes["body"]
+ 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"]
+ 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"])
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "original_commit_id" in attributes: # pragma no branch
+ assert attributes["original_commit_id"] is None or isinstance(attributes["original_commit_id"], (str, unicode)), attributes["original_commit_id"]
+ self._original_commit_id = attributes["original_commit_id"]
+ if "original_position" in attributes: # pragma no branch
+ assert attributes["original_position"] is None or isinstance(attributes["original_position"], int), attributes["original_position"]
+ self._original_position = attributes["original_position"]
+ if "path" in attributes: # pragma no branch
+ assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"]
+ self._path = attributes["path"]
+ if "position" in attributes: # pragma no branch
+ assert attributes["position"] is None or isinstance(attributes["position"], int), attributes["position"]
+ self._position = attributes["position"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ 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)
diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py
index c1e8c859..3117b003 100644
--- a/github/PullRequestMergeStatus.py
+++ b/github/PullRequestMergeStatus.py
@@ -13,31 +13,32 @@
import GithubObject
-class PullRequestMergeStatus( GithubObject.BasicGithubObject ):
+
+class PullRequestMergeStatus(GithubObject.BasicGithubObject):
@property
- def merged( self ):
- return self._NoneIfNotSet( self._merged )
+ def merged(self):
+ return self._NoneIfNotSet(self._merged)
@property
- def message( self ):
- return self._NoneIfNotSet( self._message )
+ def message(self):
+ return self._NoneIfNotSet(self._message)
@property
- def sha( self ):
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ return self._NoneIfNotSet(self._sha)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._merged = GithubObject.NotSet
self._message = GithubObject.NotSet
self._sha = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "merged" in attributes: # pragma no branch
- assert attributes[ "merged" ] is None or isinstance( attributes[ "merged" ], bool ), attributes[ "merged" ]
- self._merged = attributes[ "merged" ]
- if "message" in attributes: # pragma no branch
- assert attributes[ "message" ] is None or isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ]
- self._message = attributes[ "message" ]
- if "sha" in attributes: # pragma no branch
- assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
- self._sha = attributes[ "sha" ]
+ def _useAttributes(self, attributes):
+ if "merged" in attributes: # pragma no branch
+ assert attributes["merged"] is None or isinstance(attributes["merged"], bool), attributes["merged"]
+ self._merged = attributes["merged"]
+ if "message" in attributes: # pragma no branch
+ assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"]
+ self._message = attributes["message"]
+ if "sha" in attributes: # pragma no branch
+ assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"]
+ self._sha = attributes["sha"]
diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py
index 877a8a49..f7695e85 100644
--- a/github/PullRequestPart.py
+++ b/github/PullRequestPart.py
@@ -16,47 +16,48 @@ import GithubObject
import Repository
import NamedUser
-class PullRequestPart( GithubObject.BasicGithubObject ):
+
+class PullRequestPart(GithubObject.BasicGithubObject):
@property
- def label( self ):
- return self._NoneIfNotSet( self._label )
+ def label(self):
+ return self._NoneIfNotSet(self._label)
@property
- def ref( self ):
- return self._NoneIfNotSet( self._ref )
+ def ref(self):
+ return self._NoneIfNotSet(self._ref)
@property
- def repo( self ):
- return self._NoneIfNotSet( self._repo )
+ def repo(self):
+ return self._NoneIfNotSet(self._repo)
@property
- def sha( self ):
- return self._NoneIfNotSet( self._sha )
+ def sha(self):
+ return self._NoneIfNotSet(self._sha)
@property
- def user( self ):
- return self._NoneIfNotSet( self._user )
+ def user(self):
+ return self._NoneIfNotSet(self._user)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._label = GithubObject.NotSet
self._ref = GithubObject.NotSet
self._repo = GithubObject.NotSet
self._sha = GithubObject.NotSet
self._user = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "label" in attributes: # pragma no branch
- assert attributes[ "label" ] is None or isinstance( attributes[ "label" ], ( str, unicode ) ), attributes[ "label" ]
- self._label = attributes[ "label" ]
- if "ref" in attributes: # pragma no branch
- assert attributes[ "ref" ] is None or isinstance( attributes[ "ref" ], ( str, unicode ) ), attributes[ "ref" ]
- 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 )
- 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 )
+ def _useAttributes(self, attributes):
+ if "label" in attributes: # pragma no branch
+ assert attributes["label"] is None or isinstance(attributes["label"], (str, unicode)), attributes["label"]
+ self._label = attributes["label"]
+ if "ref" in attributes: # pragma no branch
+ assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"]
+ 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)
+ 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)
diff --git a/github/Repository.py b/github/Repository.py
index 811ffbc9..b2c81c80 100644
--- a/github/Repository.py
+++ b/github/Repository.py
@@ -46,159 +46,160 @@ import Permissions
import Event
import Legacy
-class Repository( GithubObject.GithubObject ):
+
+class Repository(GithubObject.GithubObject):
@property
- def clone_url( self ):
- self._completeIfNotSet( self._clone_url )
- return self._NoneIfNotSet( self._clone_url )
+ def clone_url(self):
+ self._completeIfNotSet(self._clone_url)
+ return self._NoneIfNotSet(self._clone_url)
@property
- def created_at( self ):
- self._completeIfNotSet( self._created_at )
- return self._NoneIfNotSet( self._created_at )
+ def created_at(self):
+ self._completeIfNotSet(self._created_at)
+ return self._NoneIfNotSet(self._created_at)
@property
- def description( self ):
- self._completeIfNotSet( self._description )
- return self._NoneIfNotSet( self._description )
+ def description(self):
+ self._completeIfNotSet(self._description)
+ return self._NoneIfNotSet(self._description)
@property
- def fork( self ):
- self._completeIfNotSet( self._fork )
- return self._NoneIfNotSet( self._fork )
+ def fork(self):
+ self._completeIfNotSet(self._fork)
+ return self._NoneIfNotSet(self._fork)
@property
- def forks( self ):
- self._completeIfNotSet( self._forks )
- return self._NoneIfNotSet( self._forks )
+ def forks(self):
+ self._completeIfNotSet(self._forks)
+ return self._NoneIfNotSet(self._forks)
@property
- def full_name( self ):
- self._completeIfNotSet( self._full_name )
- return self._NoneIfNotSet( self._full_name )
+ def full_name(self):
+ self._completeIfNotSet(self._full_name)
+ return self._NoneIfNotSet(self._full_name)
@property
- def git_url( self ):
- self._completeIfNotSet( self._git_url )
- return self._NoneIfNotSet( self._git_url )
+ def git_url(self):
+ self._completeIfNotSet(self._git_url)
+ return self._NoneIfNotSet(self._git_url)
@property
- def has_downloads( self ):
- self._completeIfNotSet( self._has_downloads )
- return self._NoneIfNotSet( self._has_downloads )
+ def has_downloads(self):
+ self._completeIfNotSet(self._has_downloads)
+ return self._NoneIfNotSet(self._has_downloads)
@property
- def has_issues( self ):
- self._completeIfNotSet( self._has_issues )
- return self._NoneIfNotSet( self._has_issues )
+ def has_issues(self):
+ self._completeIfNotSet(self._has_issues)
+ return self._NoneIfNotSet(self._has_issues)
@property
- def has_wiki( self ):
- self._completeIfNotSet( self._has_wiki )
- return self._NoneIfNotSet( self._has_wiki )
+ def has_wiki(self):
+ self._completeIfNotSet(self._has_wiki)
+ return self._NoneIfNotSet(self._has_wiki)
@property
- def homepage( self ):
- self._completeIfNotSet( self._homepage )
- return self._NoneIfNotSet( self._homepage )
+ def homepage(self):
+ self._completeIfNotSet(self._homepage)
+ return self._NoneIfNotSet(self._homepage)
@property
- def html_url( self ):
- self._completeIfNotSet( self._html_url )
- return self._NoneIfNotSet( self._html_url )
+ def html_url(self):
+ self._completeIfNotSet(self._html_url)
+ return self._NoneIfNotSet(self._html_url)
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def language( self ):
- self._completeIfNotSet( self._language )
- return self._NoneIfNotSet( self._language )
+ def language(self):
+ self._completeIfNotSet(self._language)
+ return self._NoneIfNotSet(self._language)
@property
- def master_branch( self ):
- self._completeIfNotSet( self._master_branch )
- return self._NoneIfNotSet( self._master_branch )
+ def master_branch(self):
+ self._completeIfNotSet(self._master_branch)
+ return self._NoneIfNotSet(self._master_branch)
@property
- def name( self ):
- self._completeIfNotSet( self._name )
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ self._completeIfNotSet(self._name)
+ return self._NoneIfNotSet(self._name)
@property
- def open_issues( self ):
- self._completeIfNotSet( self._open_issues )
- return self._NoneIfNotSet( self._open_issues )
+ def open_issues(self):
+ self._completeIfNotSet(self._open_issues)
+ return self._NoneIfNotSet(self._open_issues)
@property
- def organization( self ):
- self._completeIfNotSet( self._organization )
- return self._NoneIfNotSet( self._organization )
+ def organization(self):
+ self._completeIfNotSet(self._organization)
+ return self._NoneIfNotSet(self._organization)
@property
- def owner( self ):
- self._completeIfNotSet( self._owner )
- return self._NoneIfNotSet( self._owner )
+ def owner(self):
+ self._completeIfNotSet(self._owner)
+ return self._NoneIfNotSet(self._owner)
@property
- def parent( self ):
- self._completeIfNotSet( self._parent )
- return self._NoneIfNotSet( self._parent )
+ def parent(self):
+ self._completeIfNotSet(self._parent)
+ return self._NoneIfNotSet(self._parent)
@property
- def permissions( self ):
- self._completeIfNotSet( self._permissions )
- return self._NoneIfNotSet( self._permissions )
+ def permissions(self):
+ self._completeIfNotSet(self._permissions)
+ return self._NoneIfNotSet(self._permissions)
@property
- def private( self ):
- self._completeIfNotSet( self._private )
- return self._NoneIfNotSet( self._private )
+ def private(self):
+ self._completeIfNotSet(self._private)
+ return self._NoneIfNotSet(self._private)
@property
- def pushed_at( self ):
- self._completeIfNotSet( self._pushed_at )
- return self._NoneIfNotSet( self._pushed_at )
+ def pushed_at(self):
+ self._completeIfNotSet(self._pushed_at)
+ return self._NoneIfNotSet(self._pushed_at)
@property
- def size( self ):
- self._completeIfNotSet( self._size )
- return self._NoneIfNotSet( self._size )
+ def size(self):
+ self._completeIfNotSet(self._size)
+ return self._NoneIfNotSet(self._size)
@property
- def source( self ):
- self._completeIfNotSet( self._source )
- return self._NoneIfNotSet( self._source )
+ def source(self):
+ self._completeIfNotSet(self._source)
+ return self._NoneIfNotSet(self._source)
@property
- def ssh_url( self ):
- self._completeIfNotSet( self._ssh_url )
- return self._NoneIfNotSet( self._ssh_url )
+ def ssh_url(self):
+ self._completeIfNotSet(self._ssh_url)
+ return self._NoneIfNotSet(self._ssh_url)
@property
- def svn_url( self ):
- self._completeIfNotSet( self._svn_url )
- return self._NoneIfNotSet( self._svn_url )
+ def svn_url(self):
+ self._completeIfNotSet(self._svn_url)
+ return self._NoneIfNotSet(self._svn_url)
@property
- def updated_at( self ):
- self._completeIfNotSet( self._updated_at )
- return self._NoneIfNotSet( self._updated_at )
+ def updated_at(self):
+ self._completeIfNotSet(self._updated_at)
+ return self._NoneIfNotSet(self._updated_at)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def watchers( self ):
- self._completeIfNotSet( self._watchers )
- return self._NoneIfNotSet( self._watchers )
+ def watchers(self):
+ self._completeIfNotSet(self._watchers)
+ return self._NoneIfNotSet(self._watchers)
- def add_to_collaborators( self, collaborator ):
- assert isinstance( collaborator, NamedUser.NamedUser ), collaborator
+ def add_to_collaborators(self, collaborator):
+ assert isinstance(collaborator, NamedUser.NamedUser), collaborator
headers, data = self._requester.requestAndCheck(
"PUT",
self.url + "/collaborators/" + collaborator._identity,
@@ -206,41 +207,41 @@ class Repository( GithubObject.GithubObject ):
None
)
- def compare( self, base, head ):
- assert isinstance( base, ( str, unicode ) ), base
- assert isinstance( head, ( str, unicode ) ), head
+ def compare(self, base, head):
+ assert isinstance(base, (str, unicode)), base
+ assert isinstance(head, (str, unicode)), head
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/compare/" + base + "..." + head,
None,
None
)
- return Comparison.Comparison( self._requester, data, completed = True )
+ return Comparison.Comparison(self._requester, data, completed=True)
- def create_download( self, name, size, description = GithubObject.NotSet, content_type = GithubObject.NotSet ):
- assert isinstance( name, ( str, unicode ) ), name
- assert isinstance( size, int ), 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
+ def create_download(self, name, size, description=GithubObject.NotSet, content_type=GithubObject.NotSet):
+ assert isinstance(name, (str, unicode)), name
+ assert isinstance(size, int), 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
post_parameters = {
"name": name,
"size": size,
}
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
if content_type is not GithubObject.NotSet:
- post_parameters[ "content_type" ] = content_type
+ post_parameters["content_type"] = content_type
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/downloads",
None,
post_parameters
)
- return Download.Download( self._requester, data, completed = True )
+ return Download.Download(self._requester, data, completed=True)
- def create_git_blob( self, content, encoding ):
- assert isinstance( content, ( str, unicode ) ), content
- assert isinstance( encoding, ( str, unicode ) ), encoding
+ def create_git_blob(self, content, encoding):
+ assert isinstance(content, (str, unicode)), content
+ assert isinstance(encoding, (str, unicode)), encoding
post_parameters = {
"content": content,
"encoding": encoding,
@@ -251,34 +252,34 @@ class Repository( GithubObject.GithubObject ):
None,
post_parameters
)
- return GitBlob.GitBlob( self._requester, data, completed = True )
+ return GitBlob.GitBlob(self._requester, data, completed=True)
- def create_git_commit( self, message, tree, parents, author = GithubObject.NotSet, committer = 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
+ def create_git_commit(self, message, tree, parents, author=GithubObject.NotSet, committer=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
post_parameters = {
"message": message,
"tree": tree._identity,
- "parents": [ element._identity for element in parents ],
+ "parents": [element._identity for element in parents],
}
if author is not GithubObject.NotSet:
- post_parameters[ "author" ] = author._identity
+ post_parameters["author"] = author._identity
if committer is not GithubObject.NotSet:
- post_parameters[ "committer" ] = committer._identity
+ post_parameters["committer"] = committer._identity
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/git/commits",
None,
post_parameters
)
- return GitCommit.GitCommit( self._requester, data, completed = True )
+ return GitCommit.GitCommit(self._requester, data, completed=True)
- def create_git_ref( self, ref, sha ):
- assert isinstance( ref, ( str, unicode ) ), ref
- assert isinstance( sha, ( str, unicode ) ), sha
+ def create_git_ref(self, ref, sha):
+ assert isinstance(ref, (str, unicode)), ref
+ assert isinstance(sha, (str, unicode)), sha
post_parameters = {
"ref": ref,
"sha": sha,
@@ -289,14 +290,14 @@ class Repository( GithubObject.GithubObject ):
None,
post_parameters
)
- return GitRef.GitRef( self._requester, data, completed = True )
+ return GitRef.GitRef(self._requester, data, completed=True)
- def create_git_tag( self, tag, message, object, type, tagger = 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
+ def create_git_tag(self, tag, message, object, type, tagger=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
post_parameters = {
"tag": tag,
"message": message,
@@ -304,80 +305,80 @@ class Repository( GithubObject.GithubObject ):
"type": type,
}
if tagger is not GithubObject.NotSet:
- post_parameters[ "tagger" ] = tagger._identity
+ post_parameters["tagger"] = tagger._identity
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/git/tags",
None,
post_parameters
)
- return GitTag.GitTag( self._requester, data, completed = True )
+ return 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=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
post_parameters = {
- "tree": [ element._identity for element in tree ],
+ "tree": [element._identity for element in tree],
}
if base_tree is not GithubObject.NotSet:
- post_parameters[ "base_tree" ] = base_tree._identity
+ post_parameters["base_tree"] = base_tree._identity
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/git/trees",
None,
post_parameters
)
- return GitTree.GitTree( self._requester, data, completed = True )
+ return GitTree.GitTree(self._requester, data, completed=True)
- def create_hook( self, name, config, events = GithubObject.NotSet, active = 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
+ def create_hook(self, name, config, events=GithubObject.NotSet, active=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
post_parameters = {
"name": name,
"config": config,
}
if events is not GithubObject.NotSet:
- post_parameters[ "events" ] = events
+ post_parameters["events"] = events
if active is not GithubObject.NotSet:
- post_parameters[ "active" ] = active
+ post_parameters["active"] = active
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/hooks",
None,
post_parameters
)
- return Hook.Hook( self._requester, data, completed = True )
+ return Hook.Hook(self._requester, data, completed=True)
- def create_issue( self, title, body = GithubObject.NotSet, assignee = GithubObject.NotSet, milestone = GithubObject.NotSet, labels = 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
+ def create_issue(self, title, body=GithubObject.NotSet, assignee=GithubObject.NotSet, milestone=GithubObject.NotSet, labels=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
post_parameters = {
"title": title,
}
if body is not GithubObject.NotSet:
- post_parameters[ "body" ] = body
+ post_parameters["body"] = body
if assignee is not GithubObject.NotSet:
- post_parameters[ "assignee" ] = assignee._identity
+ post_parameters["assignee"] = assignee._identity
if milestone is not GithubObject.NotSet:
- post_parameters[ "milestone" ] = milestone._identity
+ post_parameters["milestone"] = milestone._identity
if labels is not GithubObject.NotSet:
- post_parameters[ "labels" ] = [ element.name for element in labels ]
+ post_parameters["labels"] = [element.name for element in labels]
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/issues",
None,
post_parameters
)
- return Issue.Issue( self._requester, data, completed = True )
+ return Issue.Issue(self._requester, data, completed=True)
- def create_key( self, title, key ):
- assert isinstance( title, ( str, unicode ) ), title
- assert isinstance( key, ( str, unicode ) ), key
+ def create_key(self, title, key):
+ assert isinstance(title, (str, unicode)), title
+ assert isinstance(key, (str, unicode)), key
post_parameters = {
"title": title,
"key": key,
@@ -388,11 +389,11 @@ class Repository( GithubObject.GithubObject ):
None,
post_parameters
)
- return RepositoryKey.RepositoryKey( self._requester, data, completed = True, repoUrl = self._url )
+ return RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url)
- def create_label( self, name, color ):
- assert isinstance( name, ( str, unicode ) ), name
- assert isinstance( color, ( str, unicode ) ), color
+ def create_label(self, name, color):
+ assert isinstance(name, (str, unicode)), name
+ assert isinstance(color, (str, unicode)), color
post_parameters = {
"name": name,
"color": color,
@@ -403,50 +404,50 @@ class Repository( GithubObject.GithubObject ):
None,
post_parameters
)
- return Label.Label( self._requester, data, completed = True )
+ return Label.Label(self._requester, data, completed=True)
- def create_milestone( self, title, state = GithubObject.NotSet, description = GithubObject.NotSet, due_on = 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
+ def create_milestone(self, title, state=GithubObject.NotSet, description=GithubObject.NotSet, due_on=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
post_parameters = {
"title": title,
}
if state is not GithubObject.NotSet:
- post_parameters[ "state" ] = state
+ post_parameters["state"] = state
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
if due_on is not GithubObject.NotSet:
- post_parameters[ "due_on" ] = due_on.strftime( "%Y-%m-%d" )
+ post_parameters["due_on"] = due_on.strftime("%Y-%m-%d")
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/milestones",
None,
post_parameters
)
- return Milestone.Milestone( self._requester, data, completed = True )
+ return Milestone.Milestone(self._requester, data, completed=True)
- def create_pull( self, *args, **kwds ):
- if len( args ) + len( kwds ) == 4:
- return self.__create_pull_1( *args, **kwds )
+ def create_pull(self, *args, **kwds):
+ if len(args) + len(kwds) == 4:
+ return self.__create_pull_1(*args, **kwds)
else:
- return self.__create_pull_2( *args, **kwds )
+ return self.__create_pull_2(*args, **kwds)
- def __create_pull_1( self, title, body, base, head ):
- assert isinstance( title, ( str, unicode ) ), title
- assert isinstance( body, ( str, unicode ) ), body
- assert isinstance( base, ( str, unicode ) ), base
- assert isinstance( head, ( str, unicode ) ), head
- return self.__create_pull( title = title, body = body, base = base, head = head )
+ def __create_pull_1(self, title, body, base, head):
+ assert isinstance(title, (str, unicode)), title
+ assert isinstance(body, (str, unicode)), body
+ assert isinstance(base, (str, unicode)), base
+ assert isinstance(head, (str, unicode)), head
+ 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( base, ( str, unicode ) ), base
- assert isinstance( head, ( str, unicode ) ), head
- return self.__create_pull( issue = issue._identity, base = base, head = head )
+ def __create_pull_2(self, issue, base, head):
+ assert isinstance(issue, 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)
- def __create_pull( self, **kwds ):
+ def __create_pull(self, **kwds):
post_parameters = kwds
headers, data = self._requester.requestAndCheck(
"POST",
@@ -454,9 +455,9 @@ class Repository( GithubObject.GithubObject ):
None,
post_parameters
)
- return PullRequest.PullRequest( self._requester, data, completed = True )
+ return PullRequest.PullRequest(self._requester, data, completed=True)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -464,40 +465,40 @@ 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 ):
- 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
+ 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):
+ 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
post_parameters = {
"name": name,
}
if description is not GithubObject.NotSet:
- post_parameters[ "description" ] = description
+ post_parameters["description"] = description
if homepage is not GithubObject.NotSet:
- post_parameters[ "homepage" ] = homepage
+ post_parameters["homepage"] = homepage
if public is not GithubObject.NotSet:
- post_parameters[ "public" ] = public
+ post_parameters["public"] = public
if has_issues is not GithubObject.NotSet:
- post_parameters[ "has_issues" ] = has_issues
+ post_parameters["has_issues"] = has_issues
if has_wiki is not GithubObject.NotSet:
- post_parameters[ "has_wiki" ] = has_wiki
+ post_parameters["has_wiki"] = has_wiki
if has_downloads is not GithubObject.NotSet:
- post_parameters[ "has_downloads" ] = has_downloads
+ post_parameters["has_downloads"] = has_downloads
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def get_archive_link( self, archive_format, ref = GithubObject.NotSet ):
- assert isinstance( archive_format, ( str, unicode ) ), archive_format
- assert ref is GithubObject.NotSet or isinstance( ref, ( str, unicode ) ), ref
+ def get_archive_link(self, archive_format, ref=GithubObject.NotSet):
+ assert isinstance(archive_format, (str, unicode)), archive_format
+ assert ref is GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
url = self.url + "/" + archive_format
if ref is not GithubObject.NotSet:
url += "/" + ref
@@ -507,9 +508,9 @@ class Repository( GithubObject.GithubObject ):
None,
None
)
- return headers[ "location" ]
+ return headers["location"]
- def get_assignees( self ):
+ def get_assignees(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -517,17 +518,17 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_branch( self, branch ):
- assert isinstance( branch, ( str, unicode ) ), branch
+ def get_branch(self, branch):
+ assert isinstance(branch, (str, unicode)), branch
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/branches/" + branch,
None,
None
)
- return Branch.Branch( self._requester, data, completed = True )
+ return Branch.Branch(self._requester, data, completed=True)
- def get_branches( self ):
+ def get_branches(self):
return PaginatedList.PaginatedList(
Branch.Branch,
self._requester,
@@ -535,7 +536,7 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_collaborators( self ):
+ def get_collaborators(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -543,17 +544,17 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_comment( self, id ):
- assert isinstance( id, int ), id
+ def get_comment(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- self.url + "/comments/" + str( id ),
+ self.url + "/comments/" + str(id),
None,
None
)
- return CommitComment.CommitComment( self._requester, data, completed = True )
+ return CommitComment.CommitComment(self._requester, data, completed=True)
- def get_comments( self ):
+ def get_comments(self):
return PaginatedList.PaginatedList(
CommitComment.CommitComment,
self._requester,
@@ -561,24 +562,24 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_commit( self, sha ):
- assert isinstance( sha, ( str, unicode ) ), sha
+ def get_commit(self, sha):
+ assert isinstance(sha, (str, unicode)), sha
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/commits/" + sha,
None,
None
)
- return Commit.Commit( self._requester, data, completed = True )
+ return 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=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
url_parameters = dict()
if sha is not GithubObject.NotSet:
- url_parameters[ "sha" ] = sha
+ url_parameters["sha"] = sha
if path is not GithubObject.NotSet:
- url_parameters[ "path" ] = path
+ url_parameters["path"] = path
return PaginatedList.PaginatedList(
Commit.Commit,
self._requester,
@@ -586,17 +587,17 @@ class Repository( GithubObject.GithubObject ):
url_parameters
)
- def get_contents( self, path ):
- assert isinstance( path, ( str, unicode ) ), path
+ def get_contents(self, path):
+ assert isinstance(path, (str, unicode)), path
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/contents" + path,
None,
None
)
- return ContentFile.ContentFile( self._requester, data, completed = True )
+ return ContentFile.ContentFile(self._requester, data, completed=True)
- def get_contributors( self ):
+ def get_contributors(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -604,17 +605,17 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_download( self, id ):
- assert isinstance( id, int ), id
+ def get_download(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- self.url + "/downloads/" + str( id ),
+ self.url + "/downloads/" + str(id),
None,
None
)
- return Download.Download( self._requester, data, completed = True )
+ return Download.Download(self._requester, data, completed=True)
- def get_downloads( self ):
+ def get_downloads(self):
return PaginatedList.PaginatedList(
Download.Download,
self._requester,
@@ -622,7 +623,7 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_events( self ):
+ def get_events(self):
return PaginatedList.PaginatedList(
Event.Event,
self._requester,
@@ -630,7 +631,7 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_forks( self ):
+ def get_forks(self):
return PaginatedList.PaginatedList(
Repository,
self._requester,
@@ -638,37 +639,37 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_git_blob( self, sha ):
- assert isinstance( sha, ( str, unicode ) ), sha
+ def get_git_blob(self, sha):
+ assert isinstance(sha, (str, unicode)), sha
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/git/blobs/" + sha,
None,
None
)
- return GitBlob.GitBlob( self._requester, data, completed = True )
+ return GitBlob.GitBlob(self._requester, data, completed=True)
- def get_git_commit( self, sha ):
- assert isinstance( sha, ( str, unicode ) ), sha
+ def get_git_commit(self, sha):
+ assert isinstance(sha, (str, unicode)), sha
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/git/commits/" + sha,
None,
None
)
- return GitCommit.GitCommit( self._requester, data, completed = True )
+ return GitCommit.GitCommit(self._requester, data, completed=True)
- def get_git_ref( self, ref ):
- assert isinstance( ref, ( str, unicode ) ), ref
+ def get_git_ref(self, ref):
+ assert isinstance(ref, (str, unicode)), ref
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/git/" + ref,
None,
None
)
- return GitRef.GitRef( self._requester, data, completed = True )
+ return GitRef.GitRef(self._requester, data, completed=True)
- def get_git_refs( self ):
+ def get_git_refs(self):
return PaginatedList.PaginatedList(
GitRef.GitRef,
self._requester,
@@ -676,41 +677,41 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_git_tag( self, sha ):
- assert isinstance( sha, ( str, unicode ) ), sha
+ def get_git_tag(self, sha):
+ assert isinstance(sha, (str, unicode)), sha
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/git/tags/" + sha,
None,
None
)
- return GitTag.GitTag( self._requester, data, completed = True )
+ return GitTag.GitTag(self._requester, data, completed=True)
- def get_git_tree( self, sha, recursive = GithubObject.NotSet ):
- assert isinstance( sha, ( str, unicode ) ), sha
- assert recursive is GithubObject.NotSet or isinstance( recursive, bool ), recursive
+ def get_git_tree(self, sha, recursive=GithubObject.NotSet):
+ assert isinstance(sha, (str, unicode)), sha
+ assert recursive is GithubObject.NotSet or isinstance(recursive, bool), recursive
url_parameters = dict()
if recursive is not GithubObject.NotSet:
- url_parameters[ "recursive" ] = recursive
+ url_parameters["recursive"] = recursive
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/git/trees/" + sha,
url_parameters,
None
)
- return GitTree.GitTree( self._requester, data, completed = True )
+ return GitTree.GitTree(self._requester, data, completed=True)
- def get_hook( self, id ):
- assert isinstance( id, int ), id
+ def get_hook(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- self.url + "/hooks/" + str( id ),
+ self.url + "/hooks/" + str(id),
None,
None
)
- return Hook.Hook( self._requester, data, completed = True )
+ return Hook.Hook(self._requester, data, completed=True)
- def get_hooks( self ):
+ def get_hooks(self):
return PaginatedList.PaginatedList(
Hook.Hook,
self._requester,
@@ -718,48 +719,48 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_issue( self, number ):
- assert isinstance( number, int ), number
+ def get_issue(self, number):
+ assert isinstance(number, int), number
headers, data = self._requester.requestAndCheck(
"GET",
- self.url + "/issues/" + str( number ),
+ self.url + "/issues/" + str(number),
None,
None
)
- return Issue.Issue( self._requester, data, completed = True )
+ return 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=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
url_parameters = dict()
if milestone is not GithubObject.NotSet:
- if isinstance( milestone, str ):
- url_parameters[ "milestone" ] = milestone
+ if isinstance(milestone, str):
+ url_parameters["milestone"] = milestone
else:
- url_parameters[ "milestone" ] = milestone._identity
+ url_parameters["milestone"] = milestone._identity
if state is not GithubObject.NotSet:
- url_parameters[ "state" ] = state
+ url_parameters["state"] = state
if assignee is not GithubObject.NotSet:
- if isinstance( assignee, str ):
- url_parameters[ "assignee" ] = assignee
+ if isinstance(assignee, str):
+ url_parameters["assignee"] = assignee
else:
- url_parameters[ "assignee" ] = assignee._identity
+ url_parameters["assignee"] = assignee._identity
if mentioned is not GithubObject.NotSet:
- url_parameters[ "mentioned" ] = mentioned._identity
+ url_parameters["mentioned"] = mentioned._identity
if labels is not GithubObject.NotSet:
- url_parameters[ "labels" ] = ",".join( label.name for label in labels )
+ url_parameters["labels"] = ",".join(label.name for label in labels)
if sort is not GithubObject.NotSet:
- url_parameters[ "sort" ] = sort
+ url_parameters["sort"] = sort
if direction is not GithubObject.NotSet:
- url_parameters[ "direction" ] = direction
+ url_parameters["direction"] = direction
if since is not GithubObject.NotSet:
- url_parameters[ "since" ] = since.strftime( "%Y-%m-%dT%H:%M:%SZ" )
+ url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
return PaginatedList.PaginatedList(
Issue.Issue,
self._requester,
@@ -767,17 +768,17 @@ class Repository( GithubObject.GithubObject ):
url_parameters
)
- def get_issues_event( self, id ):
- assert isinstance( id, int ), id
+ def get_issues_event(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- self.url + "/issues/events/" + str( id ),
+ self.url + "/issues/events/" + str(id),
None,
None
)
- return IssueEvent.IssueEvent( self._requester, data, completed = True )
+ return IssueEvent.IssueEvent(self._requester, data, completed=True)
- def get_issues_events( self ):
+ def get_issues_events(self):
return PaginatedList.PaginatedList(
IssueEvent.IssueEvent,
self._requester,
@@ -785,35 +786,35 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_key( self, id ):
- assert isinstance( id, int ), id
+ def get_key(self, id):
+ assert isinstance(id, int), id
headers, data = self._requester.requestAndCheck(
"GET",
- self.url + "/keys/" + str( id ),
+ self.url + "/keys/" + str(id),
None,
None
)
- return RepositoryKey.RepositoryKey( self._requester, data, completed = True, repoUrl = self._url )
+ return RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url)
- def get_keys( self ):
+ def get_keys(self):
return PaginatedList.PaginatedList(
- lambda requester, data, completed: RepositoryKey.RepositoryKey( requester, data, completed, repoUrl = self._url ),
+ lambda requester, data, completed: RepositoryKey.RepositoryKey(requester, data, completed, repoUrl=self._url),
self._requester,
self.url + "/keys",
None
)
- def get_label( self, name ):
- assert isinstance( name, ( str, unicode ) ), name
+ def get_label(self, name):
+ assert isinstance(name, (str, unicode)), name
headers, data = self._requester.requestAndCheck(
"GET",
- self.url + "/labels/" + urllib.quote( name ),
+ self.url + "/labels/" + urllib.quote(name),
None,
None
)
- return Label.Label( self._requester, data, completed = True )
+ return Label.Label(self._requester, data, completed=True)
- def get_labels( self ):
+ def get_labels(self):
return PaginatedList.PaginatedList(
Label.Label,
self._requester,
@@ -821,7 +822,7 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_languages( self ):
+ def get_languages(self):
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/languages",
@@ -830,27 +831,27 @@ class Repository( GithubObject.GithubObject ):
)
return data
- def get_milestone( self, number ):
- assert isinstance( number, int ), number
+ def get_milestone(self, number):
+ assert isinstance(number, int), number
headers, data = self._requester.requestAndCheck(
"GET",
- self.url + "/milestones/" + str( number ),
+ self.url + "/milestones/" + str(number),
None,
None
)
- return Milestone.Milestone( self._requester, data, completed = True )
+ return 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=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
url_parameters = dict()
if state is not GithubObject.NotSet:
- url_parameters[ "state" ] = state
+ url_parameters["state"] = state
if sort is not GithubObject.NotSet:
- url_parameters[ "sort" ] = sort
+ url_parameters["sort"] = sort
if direction is not GithubObject.NotSet:
- url_parameters[ "direction" ] = direction
+ url_parameters["direction"] = direction
return PaginatedList.PaginatedList(
Milestone.Milestone,
self._requester,
@@ -858,7 +859,7 @@ class Repository( GithubObject.GithubObject ):
url_parameters
)
- def get_network_events( self ):
+ def get_network_events(self):
return PaginatedList.PaginatedList(
Event.Event,
self._requester,
@@ -866,21 +867,21 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_pull( self, number ):
- assert isinstance( number, int ), number
+ def get_pull(self, number):
+ assert isinstance(number, int), number
headers, data = self._requester.requestAndCheck(
"GET",
- self.url + "/pulls/" + str( number ),
+ self.url + "/pulls/" + str(number),
None,
None
)
- return PullRequest.PullRequest( self._requester, data, completed = True )
+ return 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=GithubObject.NotSet):
+ assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state
url_parameters = dict()
if state is not GithubObject.NotSet:
- url_parameters[ "state" ] = state
+ url_parameters["state"] = state
return PaginatedList.PaginatedList(
PullRequest.PullRequest,
self._requester,
@@ -888,16 +889,16 @@ class Repository( GithubObject.GithubObject ):
url_parameters
)
- def get_readme( self ):
+ def get_readme(self):
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/readme",
None,
None
)
- return ContentFile.ContentFile( self._requester, data, completed = True )
+ return ContentFile.ContentFile(self._requester, data, completed=True)
- def get_stargazers( self ):
+ def get_stargazers(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -905,7 +906,7 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_subscribers( self ):
+ def get_subscribers(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -913,7 +914,7 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_tags( self ):
+ def get_tags(self):
return PaginatedList.PaginatedList(
Tag.Tag,
self._requester,
@@ -921,7 +922,7 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_teams( self ):
+ def get_teams(self):
return PaginatedList.PaginatedList(
Team.Team,
self._requester,
@@ -929,7 +930,7 @@ class Repository( GithubObject.GithubObject ):
None
)
- def get_watchers( self ):
+ def get_watchers(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -937,8 +938,8 @@ class Repository( GithubObject.GithubObject ):
None
)
- def has_in_assignees( self, assignee ):
- assert isinstance( assignee, NamedUser.NamedUser ), assignee
+ def has_in_assignees(self, assignee):
+ assert isinstance(assignee, NamedUser.NamedUser), assignee
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/assignees/" + assignee._identity,
@@ -947,8 +948,8 @@ class Repository( GithubObject.GithubObject ):
)
return status == 204
- def has_in_collaborators( self, collaborator ):
- assert isinstance( collaborator, NamedUser.NamedUser ), collaborator
+ def has_in_collaborators(self, collaborator):
+ assert isinstance(collaborator, NamedUser.NamedUser), collaborator
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/collaborators/" + collaborator._identity,
@@ -957,30 +958,30 @@ class Repository( GithubObject.GithubObject ):
)
return status == 204
- def legacy_search_issues( self, state, keyword ):
- assert state in [ "open", "closed" ], state
- assert isinstance( keyword, ( str, unicode ) ), keyword
+ def legacy_search_issues(self, state, keyword):
+ assert state in ["open", "closed"], state
+ assert isinstance(keyword, (str, unicode)), keyword
headers, data = self._requester.requestAndCheck(
"GET",
- "/legacy/issues/search/" + self.owner.login + "/" + self.name + "/" + state + "/" + urllib.quote( keyword ),
+ "/legacy/issues/search/" + self.owner.login + "/" + self.name + "/" + state + "/" + urllib.quote(keyword),
None,
None
)
return [
- Issue.Issue( self._requester, Legacy.convertIssue( element ), completed = False )
- for element in data[ "issues" ]
+ Issue.Issue(self._requester, Legacy.convertIssue(element), completed=False)
+ for element in data["issues"]
]
- def merge( self, base, head, commit_message = 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
+ def merge(self, base, head, commit_message=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
post_parameters = {
"base": base,
"head": head,
}
if commit_message is not GithubObject.NotSet:
- post_parameters[ "commit_message" ] = commit_message
+ post_parameters["commit_message"] = commit_message
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/merges",
@@ -990,10 +991,10 @@ class Repository( GithubObject.GithubObject ):
if data is None:
return None
else:
- return Commit.Commit( self._requester, data, completed = True )
+ return Commit.Commit(self._requester, data, completed=True)
- def remove_from_collaborators( self, collaborator ):
- assert isinstance( collaborator, NamedUser.NamedUser ), collaborator
+ def remove_from_collaborators(self, collaborator):
+ assert isinstance(collaborator, NamedUser.NamedUser), collaborator
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/collaborators/" + collaborator._identity,
@@ -1002,10 +1003,10 @@ class Repository( GithubObject.GithubObject ):
)
@property
- def _identity( self ):
+ def _identity(self):
return self.owner.login + "/" + self.name
- def _initAttributes( self ):
+ def _initAttributes(self):
self._clone_url = GithubObject.NotSet
self._created_at = GithubObject.NotSet
self._description = GithubObject.NotSet
@@ -1037,94 +1038,94 @@ class Repository( GithubObject.GithubObject ):
self._url = GithubObject.NotSet
self._watchers = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "clone_url" in attributes: # pragma no branch
- assert attributes[ "clone_url" ] is None or isinstance( attributes[ "clone_url" ], ( str, unicode ) ), attributes[ "clone_url" ]
- self._clone_url = attributes[ "clone_url" ]
- 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" ] )
- if "description" in attributes: # pragma no branch
- assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
- self._description = attributes[ "description" ]
- if "fork" in attributes: # pragma no branch
- assert attributes[ "fork" ] is None or isinstance( attributes[ "fork" ], bool ), attributes[ "fork" ]
- self._fork = attributes[ "fork" ]
- if "forks" in attributes: # pragma no branch
- assert attributes[ "forks" ] is None or isinstance( attributes[ "forks" ], int ), attributes[ "forks" ]
- self._forks = attributes[ "forks" ]
- if "full_name" in attributes: # pragma no branch
- assert attributes[ "full_name" ] is None or isinstance( attributes[ "full_name" ], ( str, unicode ) ), attributes[ "full_name" ]
- self._full_name = attributes[ "full_name" ]
- if "git_url" in attributes: # pragma no branch
- assert attributes[ "git_url" ] is None or isinstance( attributes[ "git_url" ], ( str, unicode ) ), attributes[ "git_url" ]
- self._git_url = attributes[ "git_url" ]
- if "has_downloads" in attributes: # pragma no branch
- assert attributes[ "has_downloads" ] is None or isinstance( attributes[ "has_downloads" ], bool ), attributes[ "has_downloads" ]
- self._has_downloads = attributes[ "has_downloads" ]
- if "has_issues" in attributes: # pragma no branch
- assert attributes[ "has_issues" ] is None or isinstance( attributes[ "has_issues" ], bool ), attributes[ "has_issues" ]
- self._has_issues = attributes[ "has_issues" ]
- if "has_wiki" in attributes: # pragma no branch
- assert attributes[ "has_wiki" ] is None or isinstance( attributes[ "has_wiki" ], bool ), attributes[ "has_wiki" ]
- self._has_wiki = attributes[ "has_wiki" ]
- if "homepage" in attributes: # pragma no branch
- assert attributes[ "homepage" ] is None or isinstance( attributes[ "homepage" ], ( str, unicode ) ), attributes[ "homepage" ]
- self._homepage = attributes[ "homepage" ]
- 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" ]
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "language" in attributes: # pragma no branch
- assert attributes[ "language" ] is None or isinstance( attributes[ "language" ], ( str, unicode ) ), attributes[ "language" ]
- self._language = attributes[ "language" ]
- if "master_branch" in attributes: # pragma no branch
- assert attributes[ "master_branch" ] is None or isinstance( attributes[ "master_branch" ], ( str, unicode ) ), attributes[ "master_branch" ]
- self._master_branch = attributes[ "master_branch" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "open_issues" in attributes: # pragma no branch
- assert attributes[ "open_issues" ] is None or isinstance( attributes[ "open_issues" ], int ), attributes[ "open_issues" ]
- 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 )
- 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 )
- 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 )
- if "private" in attributes: # pragma no branch
- assert attributes[ "private" ] is None or isinstance( attributes[ "private" ], bool ), attributes[ "private" ]
- self._private = attributes[ "private" ]
- if "pushed_at" in attributes: # pragma no branch
- assert attributes[ "pushed_at" ] is None or isinstance( attributes[ "pushed_at" ], ( str, unicode ) ), attributes[ "pushed_at" ]
- self._pushed_at = self._parseDatetime( attributes[ "pushed_at" ] )
- if "size" in attributes: # pragma no branch
- assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ]
- self._size = attributes[ "size" ]
- if "source" in attributes: # pragma no branch
- assert attributes[ "source" ] is None or isinstance( attributes[ "source" ], dict ), attributes[ "source" ]
- self._source = None if attributes[ "source" ] is None else Repository( self._requester, attributes[ "source" ], completed = False )
- if "ssh_url" in attributes: # pragma no branch
- assert attributes[ "ssh_url" ] is None or isinstance( attributes[ "ssh_url" ], ( str, unicode ) ), attributes[ "ssh_url" ]
- self._ssh_url = attributes[ "ssh_url" ]
- if "svn_url" in attributes: # pragma no branch
- assert attributes[ "svn_url" ] is None or isinstance( attributes[ "svn_url" ], ( str, unicode ) ), attributes[ "svn_url" ]
- self._svn_url = attributes[ "svn_url" ]
- if "updated_at" in attributes: # pragma no branch
- assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
- self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
- if "watchers" in attributes: # pragma no branch
- assert attributes[ "watchers" ] is None or isinstance( attributes[ "watchers" ], int ), attributes[ "watchers" ]
- self._watchers = attributes[ "watchers" ]
+ def _useAttributes(self, attributes):
+ if "clone_url" in attributes: # pragma no branch
+ assert attributes["clone_url"] is None or isinstance(attributes["clone_url"], (str, unicode)), attributes["clone_url"]
+ self._clone_url = attributes["clone_url"]
+ 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"])
+ if "description" in attributes: # pragma no branch
+ assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"]
+ self._description = attributes["description"]
+ if "fork" in attributes: # pragma no branch
+ assert attributes["fork"] is None or isinstance(attributes["fork"], bool), attributes["fork"]
+ self._fork = attributes["fork"]
+ if "forks" in attributes: # pragma no branch
+ assert attributes["forks"] is None or isinstance(attributes["forks"], int), attributes["forks"]
+ self._forks = attributes["forks"]
+ if "full_name" in attributes: # pragma no branch
+ assert attributes["full_name"] is None or isinstance(attributes["full_name"], (str, unicode)), attributes["full_name"]
+ self._full_name = attributes["full_name"]
+ if "git_url" in attributes: # pragma no branch
+ assert attributes["git_url"] is None or isinstance(attributes["git_url"], (str, unicode)), attributes["git_url"]
+ self._git_url = attributes["git_url"]
+ if "has_downloads" in attributes: # pragma no branch
+ assert attributes["has_downloads"] is None or isinstance(attributes["has_downloads"], bool), attributes["has_downloads"]
+ self._has_downloads = attributes["has_downloads"]
+ if "has_issues" in attributes: # pragma no branch
+ assert attributes["has_issues"] is None or isinstance(attributes["has_issues"], bool), attributes["has_issues"]
+ self._has_issues = attributes["has_issues"]
+ if "has_wiki" in attributes: # pragma no branch
+ assert attributes["has_wiki"] is None or isinstance(attributes["has_wiki"], bool), attributes["has_wiki"]
+ self._has_wiki = attributes["has_wiki"]
+ if "homepage" in attributes: # pragma no branch
+ assert attributes["homepage"] is None or isinstance(attributes["homepage"], (str, unicode)), attributes["homepage"]
+ self._homepage = attributes["homepage"]
+ 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"]
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "language" in attributes: # pragma no branch
+ assert attributes["language"] is None or isinstance(attributes["language"], (str, unicode)), attributes["language"]
+ self._language = attributes["language"]
+ if "master_branch" in attributes: # pragma no branch
+ assert attributes["master_branch"] is None or isinstance(attributes["master_branch"], (str, unicode)), attributes["master_branch"]
+ self._master_branch = attributes["master_branch"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "open_issues" in attributes: # pragma no branch
+ assert attributes["open_issues"] is None or isinstance(attributes["open_issues"], int), attributes["open_issues"]
+ 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)
+ 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)
+ 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)
+ if "private" in attributes: # pragma no branch
+ assert attributes["private"] is None or isinstance(attributes["private"], bool), attributes["private"]
+ self._private = attributes["private"]
+ if "pushed_at" in attributes: # pragma no branch
+ assert attributes["pushed_at"] is None or isinstance(attributes["pushed_at"], (str, unicode)), attributes["pushed_at"]
+ self._pushed_at = self._parseDatetime(attributes["pushed_at"])
+ if "size" in attributes: # pragma no branch
+ assert attributes["size"] is None or isinstance(attributes["size"], int), attributes["size"]
+ self._size = attributes["size"]
+ if "source" in attributes: # pragma no branch
+ assert attributes["source"] is None or isinstance(attributes["source"], dict), attributes["source"]
+ self._source = None if attributes["source"] is None else Repository(self._requester, attributes["source"], completed=False)
+ if "ssh_url" in attributes: # pragma no branch
+ assert attributes["ssh_url"] is None or isinstance(attributes["ssh_url"], (str, unicode)), attributes["ssh_url"]
+ self._ssh_url = attributes["ssh_url"]
+ if "svn_url" in attributes: # pragma no branch
+ assert attributes["svn_url"] is None or isinstance(attributes["svn_url"], (str, unicode)), attributes["svn_url"]
+ self._svn_url = attributes["svn_url"]
+ if "updated_at" in attributes: # pragma no branch
+ assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"]
+ self._updated_at = self._parseDatetime(attributes["updated_at"])
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
+ if "watchers" in attributes: # pragma no branch
+ assert attributes["watchers"] is None or isinstance(attributes["watchers"], int), attributes["watchers"]
+ self._watchers = attributes["watchers"]
diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py
index 2d05745b..e094b775 100644
--- a/github/RepositoryKey.py
+++ b/github/RepositoryKey.py
@@ -13,40 +13,42 @@
import GithubObject
-class RepositoryKey( GithubObject.GithubObject ):
- def __init__( self, requester, attributes, completed, repoUrl ):
- GithubObject.GithubObject.__init__( self, requester, attributes, completed )
+
+class RepositoryKey(GithubObject.GithubObject):
+ def __init__(self, requester, attributes, completed, repoUrl):
+ GithubObject.GithubObject.__init__(self, requester, attributes, completed)
self.__repoUrl = repoUrl
- @property
- def __customUrl( self ):
- return self.__repoUrl + "/keys/" + str( self.id )
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def __customUrl(self):
+ return self.__repoUrl + "/keys/" + str(self.id)
@property
- def key( self ):
- self._completeIfNotSet( self._key )
- return self._NoneIfNotSet( self._key )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def title( self ):
- self._completeIfNotSet( self._title )
- return self._NoneIfNotSet( self._title )
+ def key(self):
+ self._completeIfNotSet(self._key)
+ return self._NoneIfNotSet(self._key)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def title(self):
+ self._completeIfNotSet(self._title)
+ return self._NoneIfNotSet(self._title)
@property
- def verified( self ):
- self._completeIfNotSet( self._verified )
- return self._NoneIfNotSet( self._verified )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def delete( self ):
+ @property
+ def verified(self):
+ self._completeIfNotSet(self._verified)
+ return self._NoneIfNotSet(self._verified)
+
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.__customUrl,
@@ -54,42 +56,42 @@ 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=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
post_parameters = dict()
if title is not GithubObject.NotSet:
- post_parameters[ "title" ] = title
+ post_parameters["title"] = title
if key is not GithubObject.NotSet:
- post_parameters[ "key" ] = key
+ post_parameters["key"] = key
headers, data = self._requester.requestAndCheck(
"PATCH",
self.__customUrl,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._id = GithubObject.NotSet
self._key = GithubObject.NotSet
self._title = GithubObject.NotSet
self._url = GithubObject.NotSet
self._verified = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "key" in attributes: # pragma no branch
- assert attributes[ "key" ] is None or isinstance( attributes[ "key" ], ( str, unicode ) ), attributes[ "key" ]
- self._key = attributes[ "key" ]
- if "title" in attributes: # pragma no branch
- assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
- self._title = attributes[ "title" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
- if "verified" in attributes: # pragma no branch
- assert attributes[ "verified" ] is None or isinstance( attributes[ "verified" ], bool ), attributes[ "verified" ]
- self._verified = attributes[ "verified" ]
+ def _useAttributes(self, attributes):
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "key" in attributes: # pragma no branch
+ assert attributes["key"] is None or isinstance(attributes["key"], (str, unicode)), attributes["key"]
+ self._key = attributes["key"]
+ if "title" in attributes: # pragma no branch
+ assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"]
+ self._title = attributes["title"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
+ if "verified" in attributes: # pragma no branch
+ assert attributes["verified"] is None or isinstance(attributes["verified"], bool), attributes["verified"]
+ self._verified = attributes["verified"]
diff --git a/github/Requester.py b/github/Requester.py
index 3b2682cb..a209a90c 100644
--- a/github/Requester.py
+++ b/github/Requester.py
@@ -22,8 +22,8 @@ atLeastPython26 = sys.hexversion >= 0x02060000
if atLeastPython26:
import json
-else: #pragma no cover
- import simplejson as json #pragma no cover
+else: # pragma no cover
+ import simplejson as json # pragma no cover
import GithubException
import Logging
@@ -34,14 +34,14 @@ class Requester:
__httpsConnectionClass = httplib.HTTPSConnection
@classmethod
- def injectConnectionClasses( cls, httpConnectionClass, httpsConnectionClass ):
+ def injectConnectionClasses(cls, httpConnectionClass, httpsConnectionClass):
cls.__httpConnectionClass = httpConnectionClass
cls.__httpsConnectionClass = httpsConnectionClass
- def __init__( self, login_or_token, password, base_url, timeout ):
+ def __init__(self, login_or_token, password, base_url, timeout):
if password is not None:
login = login_or_token
- self.__authorizationHeader = "Basic " + base64.b64encode( login + ":" + password ).replace( '\n', '' )
+ self.__authorizationHeader = "Basic " + base64.b64encode(login + ":" + password).replace('\n', '')
elif login_or_token is not None:
token = login_or_token
self.__authorizationHeader = "token " + token
@@ -49,7 +49,7 @@ class Requester:
self.__authorizationHeader = None
self.__base_url = base_url
- o = urlparse.urlparse( base_url )
+ o = urlparse.urlparse(base_url)
self.__hostname = o.hostname
self.__port = o.port
self.__prefix = o.path
@@ -60,28 +60,28 @@ class Requester:
elif o.scheme == "http":
self.__connectionClass = self.__httpConnectionClass
else:
- assert( False ) #pragma no cover
- self.rate_limiting = ( 5000, 5000 )
+ assert(False) # pragma no cover
+ self.rate_limiting = (5000, 5000)
- def requestAndCheck( self, verb, url, parameters, input ):
- status, headers, output = self.requestRaw( verb, url, parameters, input )
- output = self.__structuredFromJson( output )
+ def requestAndCheck(self, verb, url, parameters, input):
+ status, headers, output = self.requestRaw(verb, url, parameters, input)
+ output = self.__structuredFromJson(output)
if status >= 400:
- raise GithubException.GithubException( status, output )
+ raise GithubException.GithubException(status, output)
return headers, output
- def requestRaw( self, verb, url, parameters, input ):
- assert verb in [ "HEAD", "GET", "POST", "PATCH", "PUT", "DELETE" ]
+ def requestRaw(self, verb, url, parameters, input):
+ assert verb in ["HEAD", "GET", "POST", "PATCH", "PUT", "DELETE"]
- #URLs generated locally will be relative to __base_url
- #URLs returned from the server will start with __base_url
- if url.startswith( "/" ):
+ # URLs generated locally will be relative to __base_url
+ # URLs returned from the server will start with __base_url
+ if url.startswith("/"):
url = self.__prefix + url
else:
- o = urlparse.urlparse( url )
- assert o.scheme == self.__scheme or o.scheme == "https" and self.__scheme == "http" # Issue #80
+ o = urlparse.urlparse(url)
+ assert o.scheme == self.__scheme or o.scheme == "https" and self.__scheme == "http" # Issue #80
assert o.hostname == self.__hostname
- assert o.path.startswith( self.__prefix )
+ assert o.path.startswith(self.__prefix)
assert o.port == self.__port
url = o.path
if o.query != "":
@@ -89,42 +89,42 @@ class Requester:
headers = dict()
if self.__authorizationHeader is not None:
- headers[ "Authorization" ] = self.__authorizationHeader
+ headers["Authorization"] = self.__authorizationHeader
if atLeastPython26:
- cnx = self.__connectionClass( host = self.__hostname, port = self.__port, strict = True, timeout = self.__timeout )
- else: #pragma no cover
- cnx = self.__connectionClass( host = self.__hostname, port = self.__port, strict = True ) #pragma no cover
+ cnx = self.__connectionClass(host=self.__hostname, port=self.__port, strict=True, timeout=self.__timeout)
+ else: # pragma no cover
+ cnx = self.__connectionClass(host=self.__hostname, port=self.__port, strict=True) # pragma no cover
cnx.request(
verb,
- self.__completeUrl( url, parameters ),
- json.dumps( input ),
+ self.__completeUrl(url, parameters),
+ json.dumps(input),
headers
)
response = cnx.getresponse()
status = response.status
- headers = dict( response.getheaders() )
+ headers = dict(response.getheaders())
output = response.read()
cnx.close()
if "x-ratelimit-remaining" in headers and "x-ratelimit-limit" in headers:
- self.rate_limiting = ( int( headers[ "x-ratelimit-remaining" ] ), int( headers[ "x-ratelimit-limit" ] ) )
+ self.rate_limiting = (int(headers["x-ratelimit-remaining"]), int(headers["x-ratelimit-limit"]))
logger = Logging.get_logger()
if logger.isEnabledFor(logging.DEBUG):
logger.debug(' '.join(map(str, [verb, self.__base_url + url, parameters, input, "==>", status, str(headers), str(output)])))
return status, headers, output
- def __completeUrl( self, url, parameters ):
- if parameters is None or len( parameters ) == 0:
+ def __completeUrl(self, url, parameters):
+ if parameters is None or len(parameters) == 0:
return url
else:
- return url + "?" + urllib.urlencode( parameters )
+ return url + "?" + urllib.urlencode(parameters)
- def __structuredFromJson( self, data ):
- if len( data ) == 0:
+ def __structuredFromJson(self, data):
+ if len(data) == 0:
return None
else:
- return json.loads( data )
+ return json.loads(data)
diff --git a/github/Tag.py b/github/Tag.py
index 3ed86186..ab1f6fd3 100644
--- a/github/Tag.py
+++ b/github/Tag.py
@@ -15,39 +15,40 @@ import GithubObject
import Commit
-class Tag( GithubObject.BasicGithubObject ):
+
+class Tag(GithubObject.BasicGithubObject):
@property
- def commit( self ):
- return self._NoneIfNotSet( self._commit )
+ def commit(self):
+ return self._NoneIfNotSet(self._commit)
@property
- def name( self ):
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ return self._NoneIfNotSet(self._name)
@property
- def tarball_url( self ):
- return self._NoneIfNotSet( self._tarball_url )
+ def tarball_url(self):
+ return self._NoneIfNotSet(self._tarball_url)
@property
- def zipball_url( self ):
- return self._NoneIfNotSet( self._zipball_url )
+ def zipball_url(self):
+ return self._NoneIfNotSet(self._zipball_url)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._commit = GithubObject.NotSet
self._name = GithubObject.NotSet
self._tarball_url = GithubObject.NotSet
self._zipball_url = 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 )
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "tarball_url" in attributes: # pragma no branch
- assert attributes[ "tarball_url" ] is None or isinstance( attributes[ "tarball_url" ], ( str, unicode ) ), attributes[ "tarball_url" ]
- self._tarball_url = attributes[ "tarball_url" ]
- if "zipball_url" in attributes: # pragma no branch
- assert attributes[ "zipball_url" ] is None or isinstance( attributes[ "zipball_url" ], ( str, unicode ) ), attributes[ "zipball_url" ]
- self._zipball_url = attributes[ "zipball_url" ]
+ 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)
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "tarball_url" in attributes: # pragma no branch
+ assert attributes["tarball_url"] is None or isinstance(attributes["tarball_url"], (str, unicode)), attributes["tarball_url"]
+ self._tarball_url = attributes["tarball_url"]
+ if "zipball_url" in attributes: # pragma no branch
+ assert attributes["zipball_url"] is None or isinstance(attributes["zipball_url"], (str, unicode)), attributes["zipball_url"]
+ self._zipball_url = attributes["zipball_url"]
diff --git a/github/Team.py b/github/Team.py
index 671ce655..342ee4ce 100644
--- a/github/Team.py
+++ b/github/Team.py
@@ -17,39 +17,40 @@ import PaginatedList
import Repository
import NamedUser
-class Team( GithubObject.GithubObject ):
+
+class Team(GithubObject.GithubObject):
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def members_count( self ):
- self._completeIfNotSet( self._members_count )
- return self._NoneIfNotSet( self._members_count )
+ def members_count(self):
+ self._completeIfNotSet(self._members_count)
+ return self._NoneIfNotSet(self._members_count)
@property
- def name( self ):
- self._completeIfNotSet( self._name )
- return self._NoneIfNotSet( self._name )
+ def name(self):
+ self._completeIfNotSet(self._name)
+ return self._NoneIfNotSet(self._name)
@property
- def permission( self ):
- self._completeIfNotSet( self._permission )
- return self._NoneIfNotSet( self._permission )
+ def permission(self):
+ self._completeIfNotSet(self._permission)
+ return self._NoneIfNotSet(self._permission)
@property
- def repos_count( self ):
- self._completeIfNotSet( self._repos_count )
- return self._NoneIfNotSet( self._repos_count )
+ def repos_count(self):
+ self._completeIfNotSet(self._repos_count)
+ return self._NoneIfNotSet(self._repos_count)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
- def add_to_members( self, member ):
- assert isinstance( member, NamedUser.NamedUser ), member
+ def add_to_members(self, member):
+ assert isinstance(member, NamedUser.NamedUser), member
headers, data = self._requester.requestAndCheck(
"PUT",
self.url + "/members/" + member._identity,
@@ -57,8 +58,8 @@ class Team( GithubObject.GithubObject ):
None
)
- def add_to_repos( self, repo ):
- assert isinstance( repo, Repository.Repository ), repo
+ def add_to_repos(self, repo):
+ assert isinstance(repo, Repository.Repository), repo
headers, data = self._requester.requestAndCheck(
"PUT",
self.url + "/repos/" + repo._identity,
@@ -66,7 +67,7 @@ class Team( GithubObject.GithubObject ):
None
)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -74,23 +75,23 @@ class Team( GithubObject.GithubObject ):
None
)
- def edit( self, name, permission = GithubObject.NotSet ):
- assert isinstance( name, ( str, unicode ) ), name
- assert permission is GithubObject.NotSet or isinstance( permission, ( str, unicode ) ), permission
+ def edit(self, name, permission=GithubObject.NotSet):
+ assert isinstance(name, (str, unicode)), name
+ assert permission is GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
post_parameters = {
"name": name,
}
if permission is not GithubObject.NotSet:
- post_parameters[ "permission" ] = permission
+ post_parameters["permission"] = permission
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def get_members( self ):
+ def get_members(self):
return PaginatedList.PaginatedList(
NamedUser.NamedUser,
self._requester,
@@ -98,7 +99,7 @@ class Team( GithubObject.GithubObject ):
None
)
- def get_repos( self ):
+ def get_repos(self):
return PaginatedList.PaginatedList(
Repository.Repository,
self._requester,
@@ -106,8 +107,8 @@ class Team( GithubObject.GithubObject ):
None
)
- def has_in_members( self, member ):
- assert isinstance( member, NamedUser.NamedUser ), member
+ def has_in_members(self, member):
+ assert isinstance(member, NamedUser.NamedUser), member
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/members/" + member._identity,
@@ -116,8 +117,8 @@ class Team( GithubObject.GithubObject ):
)
return status == 204
- def has_in_repos( self, repo ):
- assert isinstance( repo, Repository.Repository ), repo
+ def has_in_repos(self, repo):
+ assert isinstance(repo, Repository.Repository), repo
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/repos/" + repo._identity,
@@ -126,8 +127,8 @@ class Team( GithubObject.GithubObject ):
)
return status == 204
- def remove_from_members( self, member ):
- assert isinstance( member, NamedUser.NamedUser ), member
+ def remove_from_members(self, member):
+ assert isinstance(member, NamedUser.NamedUser), member
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/members/" + member._identity,
@@ -135,8 +136,8 @@ class Team( GithubObject.GithubObject ):
None
)
- def remove_from_repos( self, repo ):
- assert isinstance( repo, Repository.Repository ), repo
+ def remove_from_repos(self, repo):
+ assert isinstance(repo, Repository.Repository), repo
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/repos/" + repo._identity,
@@ -145,10 +146,10 @@ class Team( GithubObject.GithubObject ):
)
@property
- def _identity( self ):
+ def _identity(self):
return self.id
- def _initAttributes( self ):
+ def _initAttributes(self):
self._id = GithubObject.NotSet
self._members_count = GithubObject.NotSet
self._name = GithubObject.NotSet
@@ -156,22 +157,22 @@ class Team( GithubObject.GithubObject ):
self._repos_count = GithubObject.NotSet
self._url = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "members_count" in attributes: # pragma no branch
- assert attributes[ "members_count" ] is None or isinstance( attributes[ "members_count" ], int ), attributes[ "members_count" ]
- self._members_count = attributes[ "members_count" ]
- if "name" in attributes: # pragma no branch
- assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
- self._name = attributes[ "name" ]
- if "permission" in attributes: # pragma no branch
- assert attributes[ "permission" ] is None or isinstance( attributes[ "permission" ], ( str, unicode ) ), attributes[ "permission" ]
- self._permission = attributes[ "permission" ]
- if "repos_count" in attributes: # pragma no branch
- assert attributes[ "repos_count" ] is None or isinstance( attributes[ "repos_count" ], int ), attributes[ "repos_count" ]
- self._repos_count = attributes[ "repos_count" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
+ def _useAttributes(self, attributes):
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "members_count" in attributes: # pragma no branch
+ assert attributes["members_count"] is None or isinstance(attributes["members_count"], int), attributes["members_count"]
+ self._members_count = attributes["members_count"]
+ if "name" in attributes: # pragma no branch
+ assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"]
+ self._name = attributes["name"]
+ if "permission" in attributes: # pragma no branch
+ assert attributes["permission"] is None or isinstance(attributes["permission"], (str, unicode)), attributes["permission"]
+ self._permission = attributes["permission"]
+ if "repos_count" in attributes: # pragma no branch
+ assert attributes["repos_count"] is None or isinstance(attributes["repos_count"], int), attributes["repos_count"]
+ self._repos_count = attributes["repos_count"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
diff --git a/github/UserKey.py b/github/UserKey.py
index 6886842a..baaacddd 100644
--- a/github/UserKey.py
+++ b/github/UserKey.py
@@ -13,33 +13,34 @@
import GithubObject
-class UserKey( GithubObject.GithubObject ):
+
+class UserKey(GithubObject.GithubObject):
@property
- def id( self ):
- self._completeIfNotSet( self._id )
- return self._NoneIfNotSet( self._id )
+ def id(self):
+ self._completeIfNotSet(self._id)
+ return self._NoneIfNotSet(self._id)
@property
- def key( self ):
- self._completeIfNotSet( self._key )
- return self._NoneIfNotSet( self._key )
+ def key(self):
+ self._completeIfNotSet(self._key)
+ return self._NoneIfNotSet(self._key)
@property
- def title( self ):
- self._completeIfNotSet( self._title )
- return self._NoneIfNotSet( self._title )
+ def title(self):
+ self._completeIfNotSet(self._title)
+ return self._NoneIfNotSet(self._title)
@property
- def url( self ):
- self._completeIfNotSet( self._url )
- return self._NoneIfNotSet( self._url )
+ def url(self):
+ self._completeIfNotSet(self._url)
+ return self._NoneIfNotSet(self._url)
@property
- def verified( self ):
- self._completeIfNotSet( self._verified )
- return self._NoneIfNotSet( self._verified )
+ def verified(self):
+ self._completeIfNotSet(self._verified)
+ return self._NoneIfNotSet(self._verified)
- def delete( self ):
+ def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -47,42 +48,42 @@ 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=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
post_parameters = dict()
if title is not GithubObject.NotSet:
- post_parameters[ "title" ] = title
+ post_parameters["title"] = title
if key is not GithubObject.NotSet:
- post_parameters[ "key" ] = key
+ post_parameters["key"] = key
headers, data = self._requester.requestAndCheck(
"PATCH",
self.url,
None,
post_parameters
)
- self._useAttributes( data )
+ self._useAttributes(data)
- def _initAttributes( self ):
+ def _initAttributes(self):
self._id = GithubObject.NotSet
self._key = GithubObject.NotSet
self._title = GithubObject.NotSet
self._url = GithubObject.NotSet
self._verified = GithubObject.NotSet
- def _useAttributes( self, attributes ):
- if "id" in attributes: # pragma no branch
- assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
- self._id = attributes[ "id" ]
- if "key" in attributes: # pragma no branch
- assert attributes[ "key" ] is None or isinstance( attributes[ "key" ], ( str, unicode ) ), attributes[ "key" ]
- self._key = attributes[ "key" ]
- if "title" in attributes: # pragma no branch
- assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
- self._title = attributes[ "title" ]
- if "url" in attributes: # pragma no branch
- assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
- self._url = attributes[ "url" ]
- if "verified" in attributes: # pragma no branch
- assert attributes[ "verified" ] is None or isinstance( attributes[ "verified" ], bool ), attributes[ "verified" ]
- self._verified = attributes[ "verified" ]
+ def _useAttributes(self, attributes):
+ if "id" in attributes: # pragma no branch
+ assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
+ self._id = attributes["id"]
+ if "key" in attributes: # pragma no branch
+ assert attributes["key"] is None or isinstance(attributes["key"], (str, unicode)), attributes["key"]
+ self._key = attributes["key"]
+ if "title" in attributes: # pragma no branch
+ assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"]
+ self._title = attributes["title"]
+ if "url" in attributes: # pragma no branch
+ assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
+ self._url = attributes["url"]
+ if "verified" in attributes: # pragma no branch
+ assert attributes["verified"] is None or isinstance(attributes["verified"], bool), attributes["verified"]
+ self._verified = attributes["verified"]
diff --git a/github/tests/AllTests.py b/github/tests/AllTests.py
index dcdc9cdb..c3b5bb3a 100644
--- a/github/tests/AllTests.py
+++ b/github/tests/AllTests.py
@@ -1,59 +1,59 @@
-# 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 .
-
-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 Markdown 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 PaginatedList import *
-from Exceptions import *
-from Enterprise import *
-from Logging import *
-
-from Issue33 import *
-from Issue50 import *
-from Issue54 import *
-from Issue80 import *
+# 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 .
+
+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 Markdown 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 PaginatedList import *
+from Exceptions import *
+from Enterprise import *
+from Logging import *
+
+from Issue33 import *
+from Issue50 import *
+from Issue54 import *
+from Issue80 import *
diff --git a/github/tests/AuthenticatedUser.py b/github/tests/AuthenticatedUser.py
index 295e0d6f..5cfae067 100644
--- a/github/tests/AuthenticatedUser.py
+++ b/github/tests/AuthenticatedUser.py
@@ -16,160 +16,161 @@ import Framework
import github
import datetime
-class AuthenticatedUser( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
+
+class AuthenticatedUser(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
self.user = self.g.get_user()
- def testAttributes( self ):
- self.assertEqual( self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" )
- self.assertEqual( self.user.bio, "" )
- self.assertEqual( self.user.blog, "http://vincent-jacques.net" )
- self.assertEqual( self.user.collaborators, 0 )
- self.assertEqual( self.user.company, "Criteo" )
- self.assertEqual( self.user.created_at, datetime.datetime( 2010, 7, 9, 6, 10, 6 ) )
- self.assertEqual( self.user.disk_usage, 16692 )
- self.assertEqual( self.user.email, "vincent@vincent-jacques.net" )
- self.assertEqual( self.user.followers, 13 )
- self.assertEqual( self.user.following, 24 )
- self.assertEqual( self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225" )
- self.assertEqual( self.user.hireable, False )
- self.assertEqual( self.user.html_url, "https://github.com/jacquev6" )
- self.assertEqual( self.user.id, 327146 )
- self.assertEqual( self.user.location, "Paris, France" )
- self.assertEqual( self.user.login, "jacquev6" )
- self.assertEqual( self.user.name, "Vincent Jacques" )
- self.assertEqual( self.user.owned_private_repos, 5 )
- self.assertEqual( self.user.plan.name, "micro" )
- self.assertEqual( self.user.plan.collaborators, 1 )
- self.assertEqual( self.user.plan.space, 614400 )
- self.assertEqual( self.user.plan.private_repos, 5 )
- self.assertEqual( self.user.private_gists, 5 )
- self.assertEqual( self.user.public_gists, 1 )
- self.assertEqual( self.user.public_repos, 10 )
- self.assertEqual( self.user.total_private_repos, 5 )
- self.assertEqual( self.user.type, "User" )
- self.assertEqual( self.user.url, "https://api.github.com/users/jacquev6" )
+ def testAttributes(self):
+ self.assertEqual(self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png")
+ self.assertEqual(self.user.bio, "")
+ self.assertEqual(self.user.blog, "http://vincent-jacques.net")
+ self.assertEqual(self.user.collaborators, 0)
+ self.assertEqual(self.user.company, "Criteo")
+ self.assertEqual(self.user.created_at, datetime.datetime(2010, 7, 9, 6, 10, 6))
+ self.assertEqual(self.user.disk_usage, 16692)
+ self.assertEqual(self.user.email, "vincent@vincent-jacques.net")
+ self.assertEqual(self.user.followers, 13)
+ self.assertEqual(self.user.following, 24)
+ self.assertEqual(self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225")
+ self.assertEqual(self.user.hireable, False)
+ self.assertEqual(self.user.html_url, "https://github.com/jacquev6")
+ self.assertEqual(self.user.id, 327146)
+ self.assertEqual(self.user.location, "Paris, France")
+ self.assertEqual(self.user.login, "jacquev6")
+ self.assertEqual(self.user.name, "Vincent Jacques")
+ self.assertEqual(self.user.owned_private_repos, 5)
+ self.assertEqual(self.user.plan.name, "micro")
+ self.assertEqual(self.user.plan.collaborators, 1)
+ self.assertEqual(self.user.plan.space, 614400)
+ self.assertEqual(self.user.plan.private_repos, 5)
+ self.assertEqual(self.user.private_gists, 5)
+ self.assertEqual(self.user.public_gists, 1)
+ self.assertEqual(self.user.public_repos, 10)
+ self.assertEqual(self.user.total_private_repos, 5)
+ self.assertEqual(self.user.type, "User")
+ self.assertEqual(self.user.url, "https://api.github.com/users/jacquev6")
- def testEditWithoutArguments( self ):
+ def testEditWithoutArguments(self):
self.user.edit()
- def testEditWithAllArguments( self ):
- self.user.edit( "Name edited by PyGithub", "Email edited by PyGithub", "Blog edited by PyGithub", "Company edited by PyGithub", "Location edited by PyGithub", True, "Bio edited by PyGithub" )
- self.assertEqual( self.user.name, "Name edited by PyGithub" )
- self.assertEqual( self.user.email, "Email edited by PyGithub" )
- self.assertEqual( self.user.blog, "Blog edited by PyGithub" )
- self.assertEqual( self.user.company, "Company edited by PyGithub" )
- self.assertEqual( self.user.location, "Location edited by PyGithub" )
- self.assertEqual( self.user.hireable, True )
- self.assertEqual( self.user.bio, "Bio edited by PyGithub" )
+ def testEditWithAllArguments(self):
+ self.user.edit("Name edited by PyGithub", "Email edited by PyGithub", "Blog edited by PyGithub", "Company edited by PyGithub", "Location edited by PyGithub", True, "Bio edited by PyGithub")
+ self.assertEqual(self.user.name, "Name edited by PyGithub")
+ self.assertEqual(self.user.email, "Email edited by PyGithub")
+ self.assertEqual(self.user.blog, "Blog edited by PyGithub")
+ self.assertEqual(self.user.company, "Company edited by PyGithub")
+ self.assertEqual(self.user.location, "Location edited by PyGithub")
+ self.assertEqual(self.user.hireable, True)
+ self.assertEqual(self.user.bio, "Bio edited by PyGithub")
- def testEmails( self ):
- self.assertEqual( self.user.get_emails(), [ "vincent@vincent-jacques.net", "github.com@vincent-jacques.net" ] )
- self.user.add_to_emails( "1@foobar.com", "2@foobar.com" )
- self.assertEqual( self.user.get_emails(), [ "vincent@vincent-jacques.net", "1@foobar.com", "2@foobar.com", "github.com@vincent-jacques.net" ] )
- self.user.remove_from_emails( "1@foobar.com", "2@foobar.com" )
- self.assertEqual( self.user.get_emails(), [ "vincent@vincent-jacques.net", "github.com@vincent-jacques.net" ] )
+ def testEmails(self):
+ self.assertEqual(self.user.get_emails(), ["vincent@vincent-jacques.net", "github.com@vincent-jacques.net"])
+ self.user.add_to_emails("1@foobar.com", "2@foobar.com")
+ self.assertEqual(self.user.get_emails(), ["vincent@vincent-jacques.net", "1@foobar.com", "2@foobar.com", "github.com@vincent-jacques.net"])
+ self.user.remove_from_emails("1@foobar.com", "2@foobar.com")
+ self.assertEqual(self.user.get_emails(), ["vincent@vincent-jacques.net", "github.com@vincent-jacques.net"])
- def testFollowing( self ):
- nvie = self.g.get_user( "nvie" )
- self.assertListKeyEqual( self.user.get_following(), lambda u: u.login, [ "schacon", "jamis", "chad", "unclebob", "dabrahams", "jnorthrup", "brugidou", "regisb", "walidk", "tanzilli", "fjardon", "r3c", "sdanzan", "vineus", "cjuniet", "gturri", "ant9000", "asquini", "claudyus", "jardon-u", "s-bernard", "kamaradclimber", "Lyloa", "nvie" ] )
- self.assertEqual( self.user.has_in_following( nvie ), True )
- self.user.remove_from_following( nvie )
- self.assertEqual( self.user.has_in_following( nvie ), False )
- self.user.add_to_following( nvie )
- self.assertEqual( self.user.has_in_following( nvie ), True )
- self.assertListKeyEqual( self.user.get_followers(), lambda u: u.login, [ "jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y" ] )
+ def testFollowing(self):
+ nvie = self.g.get_user("nvie")
+ self.assertListKeyEqual(self.user.get_following(), lambda u: u.login, ["schacon", "jamis", "chad", "unclebob", "dabrahams", "jnorthrup", "brugidou", "regisb", "walidk", "tanzilli", "fjardon", "r3c", "sdanzan", "vineus", "cjuniet", "gturri", "ant9000", "asquini", "claudyus", "jardon-u", "s-bernard", "kamaradclimber", "Lyloa", "nvie"])
+ self.assertEqual(self.user.has_in_following(nvie), True)
+ self.user.remove_from_following(nvie)
+ self.assertEqual(self.user.has_in_following(nvie), False)
+ self.user.add_to_following(nvie)
+ self.assertEqual(self.user.has_in_following(nvie), True)
+ self.assertListKeyEqual(self.user.get_followers(), lambda u: u.login, ["jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y"])
- def testWatching( self ):
- gitflow = self.g.get_user( "nvie" ).get_repo( "gitflow" )
- self.assertListKeyEqual( self.user.get_watched(), lambda r: r.name, [ "git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "PyGithub", "django", "django", "TestPyGithub" ] )
- self.assertEqual( self.user.has_in_watched( gitflow ), True )
- self.user.remove_from_watched( gitflow )
- self.assertEqual( self.user.has_in_watched( gitflow ), False )
- self.user.add_to_watched( gitflow )
- self.assertEqual( self.user.has_in_watched( gitflow ), True )
+ def testWatching(self):
+ gitflow = self.g.get_user("nvie").get_repo("gitflow")
+ self.assertListKeyEqual(self.user.get_watched(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "PyGithub", "django", "django", "TestPyGithub"])
+ self.assertEqual(self.user.has_in_watched(gitflow), True)
+ self.user.remove_from_watched(gitflow)
+ self.assertEqual(self.user.has_in_watched(gitflow), False)
+ self.user.add_to_watched(gitflow)
+ self.assertEqual(self.user.has_in_watched(gitflow), True)
- def testStarring( self ):
- gitflow = self.g.get_user( "nvie" ).get_repo( "gitflow" )
- self.assertListKeyEqual( self.user.get_starred(), lambda r: r.name, [ "git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "amaunet", "django", "django", "moviePlanning", "folly" ] )
- self.assertEqual( self.user.has_in_starred( gitflow ), True )
- self.user.remove_from_starred( gitflow )
- self.assertEqual( self.user.has_in_starred( gitflow ), False )
- self.user.add_to_starred( gitflow )
- self.assertEqual( self.user.has_in_starred( gitflow ), True )
+ def testStarring(self):
+ gitflow = self.g.get_user("nvie").get_repo("gitflow")
+ self.assertListKeyEqual(self.user.get_starred(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "amaunet", "django", "django", "moviePlanning", "folly"])
+ self.assertEqual(self.user.has_in_starred(gitflow), True)
+ self.user.remove_from_starred(gitflow)
+ self.assertEqual(self.user.has_in_starred(gitflow), False)
+ self.user.add_to_starred(gitflow)
+ self.assertEqual(self.user.has_in_starred(gitflow), True)
- def testSubscriptions( self ):
- gitflow = self.g.get_user( "nvie" ).get_repo( "gitflow" )
- self.assertListKeyEqual( self.user.get_subscriptions(), lambda r: r.name, [ "gitflow", "ViDE", "Boost.HierarchicalEnum", "QuadProgMm", "DrawSyntax", "DrawTurksHead", "PrivateStuff", "vincent-jacques.net", "Hacking", "C4Planner", "developer.github.com", "PyGithub", "PyGithub", "django", "CinePlanning", "PyGithub", "PyGithub", "PyGithub", "IpMap", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub" ] )
- self.assertEqual( self.user.has_in_subscriptions( gitflow ), True )
- self.user.remove_from_subscriptions( gitflow )
- self.assertEqual( self.user.has_in_subscriptions( gitflow ), False )
- self.user.add_to_subscriptions( gitflow )
- self.assertEqual( self.user.has_in_subscriptions( gitflow ), True )
+ def testSubscriptions(self):
+ gitflow = self.g.get_user("nvie").get_repo("gitflow")
+ self.assertListKeyEqual(self.user.get_subscriptions(), lambda r: r.name, ["gitflow", "ViDE", "Boost.HierarchicalEnum", "QuadProgMm", "DrawSyntax", "DrawTurksHead", "PrivateStuff", "vincent-jacques.net", "Hacking", "C4Planner", "developer.github.com", "PyGithub", "PyGithub", "django", "CinePlanning", "PyGithub", "PyGithub", "PyGithub", "IpMap", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub"])
+ self.assertEqual(self.user.has_in_subscriptions(gitflow), True)
+ self.user.remove_from_subscriptions(gitflow)
+ self.assertEqual(self.user.has_in_subscriptions(gitflow), False)
+ self.user.add_to_subscriptions(gitflow)
+ self.assertEqual(self.user.has_in_subscriptions(gitflow), True)
- def testGetAuthorizations( self ):
- self.assertListKeyEqual( self.user.get_authorizations(), lambda a: a.id, [ 372294 ] )
+ def testGetAuthorizations(self):
+ self.assertListKeyEqual(self.user.get_authorizations(), lambda a: a.id, [372294])
- def testCreateRepository( self ):
- repo = self.user.create_repo( "TestPyGithub" )
- self.assertEqual( repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub" )
+ def testCreateRepository(self):
+ repo = self.user.create_repo("TestPyGithub")
+ self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub")
- def testCreateRepositoryWithAllArguments( self ):
- repo = self.user.create_repo( "TestPyGithub", "Repo created by PyGithub", "http://foobar.com", private = False, has_issues = False, has_wiki = False, has_downloads = False )
- self.assertEqual( repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub" )
+ def testCreateRepositoryWithAllArguments(self):
+ repo = self.user.create_repo("TestPyGithub", "Repo created by PyGithub", "http://foobar.com", private=False, has_issues=False, has_wiki=False, has_downloads=False)
+ self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub")
- def testCreateAuthorizationWithoutArguments( self ):
+ def testCreateAuthorizationWithoutArguments(self):
authorization = self.user.create_authorization()
- self.assertEqual( authorization.id, 372259 )
+ self.assertEqual(authorization.id, 372259)
- def testCreateAuthorizationWithAllArguments( self ):
- authorization = self.user.create_authorization( [ "repo" ], "Note created by PyGithub", "http://vincent-jacques.net/PyGithub" )
- self.assertEqual( authorization.id, 372294 )
+ def testCreateAuthorizationWithAllArguments(self):
+ authorization = self.user.create_authorization(["repo"], "Note created by PyGithub", "http://vincent-jacques.net/PyGithub")
+ self.assertEqual(authorization.id, 372294)
- def testCreateGist( self ):
- gist = self.user.create_gist( True, { "foobar.txt": github.InputFileContent( "File created by PyGithub" ) }, "Gist created by PyGithub" )
- self.assertEqual( gist.description, "Gist created by PyGithub" )
- self.assertEqual( gist.files.keys(), [ "foobar.txt" ] )
- self.assertEqual( gist.files[ "foobar.txt" ].content, "File created by PyGithub" )
+ def testCreateGist(self):
+ gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")}, "Gist created by PyGithub")
+ self.assertEqual(gist.description, "Gist created by PyGithub")
+ self.assertEqual(gist.files.keys(), ["foobar.txt"])
+ self.assertEqual(gist.files["foobar.txt"].content, "File created by PyGithub")
- def testCreateGistWithoutDescription( self ):
- gist = self.user.create_gist( True, { "foobar.txt": github.InputFileContent( "File created by PyGithub" ) } )
- self.assertEqual( gist.description, None )
- self.assertEqual( gist.files.keys(), [ "foobar.txt" ] )
- self.assertEqual( gist.files[ "foobar.txt" ].content, "File created by PyGithub" )
+ def testCreateGistWithoutDescription(self):
+ gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")})
+ self.assertEqual(gist.description, None)
+ self.assertEqual(gist.files.keys(), ["foobar.txt"])
+ self.assertEqual(gist.files["foobar.txt"].content, "File created by PyGithub")
- def testCreateKey( self ):
- key = self.user.create_key( "Key added through PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE" )
- self.assertEqual( key.id, 2626650 )
+ def testCreateKey(self):
+ key = self.user.create_key("Key added through PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE")
+ self.assertEqual(key.id, 2626650)
- def testGetEvents( self ):
- self.assertListKeyBegin( self.user.get_events(), lambda e: e.type, [ "PushEvent", "IssuesEvent", "IssueCommentEvent", "PushEvent" ] )
+ def testGetEvents(self):
+ self.assertListKeyBegin(self.user.get_events(), lambda e: e.type, ["PushEvent", "IssuesEvent", "IssueCommentEvent", "PushEvent"])
- def testGetOrganizationEvents( self ):
- self.assertListKeyBegin( self.user.get_organization_events( self.g.get_organization( "BeaverSoftware" ) ), lambda e: e.type, [ "CreateEvent", "CreateEvent", "PushEvent", "PushEvent" ] )
+ def testGetOrganizationEvents(self):
+ self.assertListKeyBegin(self.user.get_organization_events(self.g.get_organization("BeaverSoftware")), lambda e: e.type, ["CreateEvent", "CreateEvent", "PushEvent", "PushEvent"])
- def testGetGists( self ):
- self.assertListKeyEqual( self.user.get_gists(), lambda g: g.id, [ "2793505", "2793179", "11cb445f8197e17d303d", "1942384", "dcb7de17e8a52b74541d" ] )
+ def testGetGists(self):
+ self.assertListKeyEqual(self.user.get_gists(), lambda g: g.id, ["2793505", "2793179", "11cb445f8197e17d303d", "1942384", "dcb7de17e8a52b74541d"])
- def testGetStarredGists( self ):
- self.assertListKeyEqual( self.user.get_starred_gists(), lambda g: g.id, [ "1942384", "dcb7de17e8a52b74541d" ] )
+ def testGetStarredGists(self):
+ self.assertListKeyEqual(self.user.get_starred_gists(), lambda g: g.id, ["1942384", "dcb7de17e8a52b74541d"])
- def testGetIssues( self ):
- self.assertListKeyEqual( self.user.get_issues(), lambda i: ( i.id, i.repository.name ), [ ( 4639931, "PyGithub" ), ( 4452000, "PyGithub" ), ( 4356743, "PyGithub" ), ( 3716033, "PyGithub" ), ( 3715946, "PyGithub" ), ( 3643837, "PyGithub" ), ( 3628022, "PyGithub" ), ( 3624595, "PyGithub" ), ( 3624570, "PyGithub" ), ( 3624561, "PyGithub" ), ( 3624556, "PyGithub" ), ( 3619973, "PyGithub" ), ( 3527266, "PyGithub" ), ( 3527245, "PyGithub" ), ( 3527231, "PyGithub" ) ] )
+ def testGetIssues(self):
+ self.assertListKeyEqual(self.user.get_issues(), lambda i: (i.id, i.repository.name), [(4639931, "PyGithub"), (4452000, "PyGithub"), (4356743, "PyGithub"), (3716033, "PyGithub"), (3715946, "PyGithub"), (3643837, "PyGithub"), (3628022, "PyGithub"), (3624595, "PyGithub"), (3624570, "PyGithub"), (3624561, "PyGithub"), (3624556, "PyGithub"), (3619973, "PyGithub"), (3527266, "PyGithub"), (3527245, "PyGithub"), (3527231, "PyGithub")])
- def testGetKeys( self ):
- self.assertListKeyEqual( self.user.get_keys(), lambda k: k.title, [ "vincent@home", "vincent@gandi", "vincent@aws", "vincent@macbook" ] )
+ def testGetKeys(self):
+ self.assertListKeyEqual(self.user.get_keys(), lambda k: k.title, ["vincent@home", "vincent@gandi", "vincent@aws", "vincent@macbook"])
- def testGetOrgs( self ):
- self.assertListKeyEqual( self.user.get_orgs(), lambda o: o.login, [ "BeaverSoftware" ] )
+ def testGetOrgs(self):
+ self.assertListKeyEqual(self.user.get_orgs(), lambda o: o.login, ["BeaverSoftware"])
- def testGetRepos( self ):
- self.assertListKeyEqual( self.user.get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] )
+ def testGetRepos(self):
+ self.assertListKeyEqual(self.user.get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
- def testGetReposWithArguments( self ):
- self.assertListKeyEqual( self.user.get_repos( "public", "full_name", "desc" ), lambda r: r.name, [ "ViDE", "QuadProgMm", "PyGithub", "DrawTurksHead", "DrawSyntax", "django", "developer.github.com", "C4Planner", "Boost.HierarchicalEnum", "acme-public-website" ] )
+ def testGetReposWithArguments(self):
+ self.assertListKeyEqual(self.user.get_repos("public", "full_name", "desc"), lambda r: r.name, ["ViDE", "QuadProgMm", "PyGithub", "DrawTurksHead", "DrawSyntax", "django", "developer.github.com", "C4Planner", "Boost.HierarchicalEnum", "acme-public-website"])
- def testCreateFork( self ):
- repo = self.user.create_fork( self.g.get_user( "nvie" ).get_repo( "gitflow" ) )
- self.assertEqual( repo.source.full_name, "nvie/gitflow" )
+ def testCreateFork(self):
+ repo = self.user.create_fork(self.g.get_user("nvie").get_repo("gitflow"))
+ self.assertEqual(repo.source.full_name, "nvie/gitflow")
diff --git a/github/tests/Authentication.py b/github/tests/Authentication.py
index 1414bb79..cc8e7b06 100644
--- a/github/tests/Authentication.py
+++ b/github/tests/Authentication.py
@@ -14,15 +14,16 @@
import Framework
import github
-class Authentication( Framework.BasicTestCase ):
- def testNoAuthentication( self ):
+
+class Authentication(Framework.BasicTestCase):
+ def testNoAuthentication(self):
g = github.Github()
- self.assertEqual( g.get_user( "jacquev6" ).name, "Vincent Jacques" )
+ self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques")
- def testBasicAuthentication( self ):
- g = github.Github( self.login, self.password )
- self.assertEqual( g.get_user( "jacquev6" ).name, "Vincent Jacques" )
+ def testBasicAuthentication(self):
+ g = github.Github(self.login, self.password)
+ self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques")
- def testOAuthAuthentication( self ):
- g = github.Github( self.oauth_token )
- self.assertEqual( g.get_user( "jacquev6" ).name, "Vincent Jacques" )
+ def testOAuthAuthentication(self):
+ g = github.Github(self.oauth_token)
+ self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques")
diff --git a/github/tests/Authorization.py b/github/tests/Authorization.py
index 524abfd1..c23f2a0c 100644
--- a/github/tests/Authorization.py
+++ b/github/tests/Authorization.py
@@ -15,37 +15,38 @@ import Framework
import datetime
-class Authorization( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.authorization = self.g.get_user().get_authorization( 372259 )
- def testAttributes( self ):
- self.assertEqual( self.authorization.app.url, "http://developer.github.com/v3/oauth/#oauth-authorizations-api" )
- self.assertEqual( self.authorization.app.name, "GitHub API" )
- self.assertEqual( self.authorization.created_at, datetime.datetime( 2012, 5, 22, 18, 3, 17 ) )
- self.assertEqual( self.authorization.id, 372259 )
- self.assertEqual( self.authorization.note, None )
- self.assertEqual( self.authorization.note_url, None )
- self.assertEqual( self.authorization.scopes, [] )
- self.assertEqual( self.authorization.token, "82459c4500086f8f0cc67d2936c17d1e27ad1c33" )
- self.assertEqual( self.authorization.updated_at, datetime.datetime( 2012, 5, 22, 18, 3, 17 ) )
- self.assertEqual( self.authorization.url, "https://api.github.com/authorizations/372259" )
+class Authorization(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.authorization = self.g.get_user().get_authorization(372259)
- def testEdit( self ):
+ def testAttributes(self):
+ self.assertEqual(self.authorization.app.url, "http://developer.github.com/v3/oauth/#oauth-authorizations-api")
+ self.assertEqual(self.authorization.app.name, "GitHub API")
+ self.assertEqual(self.authorization.created_at, datetime.datetime(2012, 5, 22, 18, 3, 17))
+ self.assertEqual(self.authorization.id, 372259)
+ self.assertEqual(self.authorization.note, None)
+ self.assertEqual(self.authorization.note_url, None)
+ self.assertEqual(self.authorization.scopes, [])
+ self.assertEqual(self.authorization.token, "82459c4500086f8f0cc67d2936c17d1e27ad1c33")
+ self.assertEqual(self.authorization.updated_at, datetime.datetime(2012, 5, 22, 18, 3, 17))
+ self.assertEqual(self.authorization.url, "https://api.github.com/authorizations/372259")
+
+ def testEdit(self):
self.authorization.edit()
- self.assertEqual( self.authorization.scopes, [] )
- self.authorization.edit( scopes = [ "user" ] )
- self.assertEqual( self.authorization.scopes, [ "user" ] )
- self.authorization.edit( add_scopes = [ "repo" ] )
- self.assertEqual( self.authorization.scopes, [ "user", "repo" ] )
- self.authorization.edit( remove_scopes = [ "repo" ] )
- self.assertEqual( self.authorization.scopes, [ "user" ] )
- self.assertEqual( self.authorization.note, None )
- self.assertEqual( self.authorization.note_url, None )
- self.authorization.edit( note = "Note created by PyGithub", note_url = "http://vincent-jacques.net/PyGithub" )
- self.assertEqual( self.authorization.note, "Note created by PyGithub" )
- self.assertEqual( self.authorization.note_url, "http://vincent-jacques.net/PyGithub" )
+ self.assertEqual(self.authorization.scopes, [])
+ self.authorization.edit(scopes=["user"])
+ self.assertEqual(self.authorization.scopes, ["user"])
+ self.authorization.edit(add_scopes=["repo"])
+ self.assertEqual(self.authorization.scopes, ["user", "repo"])
+ self.authorization.edit(remove_scopes=["repo"])
+ self.assertEqual(self.authorization.scopes, ["user"])
+ self.assertEqual(self.authorization.note, None)
+ self.assertEqual(self.authorization.note_url, None)
+ self.authorization.edit(note="Note created by PyGithub", note_url="http://vincent-jacques.net/PyGithub")
+ self.assertEqual(self.authorization.note, "Note created by PyGithub")
+ self.assertEqual(self.authorization.note_url, "http://vincent-jacques.net/PyGithub")
- def testDelete( self ):
+ def testDelete(self):
self.authorization.delete()
diff --git a/github/tests/Branch.py b/github/tests/Branch.py
index 4983cbcb..9b84ee5b 100644
--- a/github/tests/Branch.py
+++ b/github/tests/Branch.py
@@ -13,11 +13,12 @@
import Framework
-class Branch( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.branch = self.g.get_user().get_repo( "PyGithub" ).get_branches()[ 0 ]
- def testAttributes( self ):
- self.assertEqual( self.branch.name, "topic/RewriteWithGeneratedCode" )
- self.assertEqual( self.branch.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" )
+class Branch(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.branch = self.g.get_user().get_repo("PyGithub").get_branches()[0]
+
+ def testAttributes(self):
+ self.assertEqual(self.branch.name, "topic/RewriteWithGeneratedCode")
+ self.assertEqual(self.branch.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
diff --git a/github/tests/Commit.py b/github/tests/Commit.py
index ddf04752..4c242858 100644
--- a/github/tests/Commit.py
+++ b/github/tests/Commit.py
@@ -13,68 +13,69 @@
import Framework
-class Commit( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.commit = self.g.get_user().get_repo( "PyGithub" ).get_commit( "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" )
- self.commit.author.login # to force lazy completion
- def testAttributes( self ):
- self.assertEqual( self.commit.author.login, "jacquev6" )
- self.assertEqual( self.commit.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a" )
- self.assertEqual( self.commit.committer.login, "jacquev6" )
- self.assertEqual( len( self.commit.files ), 1 )
- self.assertEqual( self.commit.files[ 0 ].additions, 0 )
- self.assertEqual( self.commit.files[ 0 ].blob_url, "https://github.com/jacquev6/PyGithub/blob/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py" )
- self.assertEqual( self.commit.files[ 0 ].changes, 20 )
- self.assertEqual( self.commit.files[ 0 ].deletions, 20 )
- self.assertEqual( self.commit.files[ 0 ].filename, "github/GithubObjects/GitAuthor.py" )
- self.assertTrue( isinstance( self.commit.files[ 0 ].patch, ( str, unicode ) ) )
- self.assertEqual( self.commit.files[ 0 ].raw_url, "https://github.com/jacquev6/PyGithub/raw/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py" )
- self.assertEqual( self.commit.files[ 0 ].sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" )
- self.assertEqual( self.commit.files[ 0 ].status, "modified" )
- self.assertEqual( len( self.commit.parents ), 1 )
- self.assertEqual( self.commit.parents[ 0 ].sha, "b46ed0dfde5ad02d3b91eb54a41c5ed960710eae" )
- self.assertEqual( self.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" )
- self.assertEqual( self.commit.stats.deletions, 20 )
- self.assertEqual( self.commit.stats.additions, 0 )
- self.assertEqual( self.commit.stats.total, 20 )
- self.assertEqual( self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a" )
+class Commit(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.commit = self.g.get_user().get_repo("PyGithub").get_commit("1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
+ self.commit.author.login # to force lazy completion
- def testGetComments( self ):
- self.assertListKeyEqual( self.commit.get_comments(), lambda c: c.id, [ 1347033, 1347083, 1347397, 1349654 ] )
+ def testAttributes(self):
+ self.assertEqual(self.commit.author.login, "jacquev6")
+ self.assertEqual(self.commit.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
+ self.assertEqual(self.commit.committer.login, "jacquev6")
+ self.assertEqual(len(self.commit.files), 1)
+ self.assertEqual(self.commit.files[0].additions, 0)
+ self.assertEqual(self.commit.files[0].blob_url, "https://github.com/jacquev6/PyGithub/blob/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py")
+ self.assertEqual(self.commit.files[0].changes, 20)
+ self.assertEqual(self.commit.files[0].deletions, 20)
+ self.assertEqual(self.commit.files[0].filename, "github/GithubObjects/GitAuthor.py")
+ self.assertTrue(isinstance(self.commit.files[0].patch, (str, unicode)))
+ self.assertEqual(self.commit.files[0].raw_url, "https://github.com/jacquev6/PyGithub/raw/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py")
+ self.assertEqual(self.commit.files[0].sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
+ self.assertEqual(self.commit.files[0].status, "modified")
+ self.assertEqual(len(self.commit.parents), 1)
+ self.assertEqual(self.commit.parents[0].sha, "b46ed0dfde5ad02d3b91eb54a41c5ed960710eae")
+ self.assertEqual(self.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
+ self.assertEqual(self.commit.stats.deletions, 20)
+ self.assertEqual(self.commit.stats.additions, 0)
+ self.assertEqual(self.commit.stats.total, 20)
+ self.assertEqual(self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
- def testCreateComment( self ):
- comment = self.commit.create_comment( "Comment created by PyGithub" )
- self.assertEqual( comment.id, 1361949 )
- self.assertEqual( comment.line, None )
- self.assertEqual( comment.path, None )
- self.assertEqual( comment.position, None )
+ def testGetComments(self):
+ self.assertListKeyEqual(self.commit.get_comments(), lambda c: c.id, [1347033, 1347083, 1347397, 1349654])
- def testCreateCommentOnFileLine( self ):
- comment = self.commit.create_comment( "Comment created by PyGithub", path = "codegen/templates/GithubObject.MethodBody.UseResult.py", line = 26 )
- self.assertEqual( comment.id, 1362000 )
- self.assertEqual( comment.line, 26 )
- self.assertEqual( comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py" )
- self.assertEqual( comment.position, None )
+ def testCreateComment(self):
+ comment = self.commit.create_comment("Comment created by PyGithub")
+ self.assertEqual(comment.id, 1361949)
+ self.assertEqual(comment.line, None)
+ self.assertEqual(comment.path, None)
+ self.assertEqual(comment.position, None)
- def testCreateCommentOnFilePosition( self ):
- comment = self.commit.create_comment( "Comment also created by PyGithub", path = "codegen/templates/GithubObject.MethodBody.UseResult.py", position = 3 )
- self.assertEqual( comment.id, 1362001 )
- self.assertEqual( comment.line, None )
- self.assertEqual( comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py" )
- self.assertEqual( comment.position, 3 )
+ def testCreateCommentOnFileLine(self):
+ comment = self.commit.create_comment("Comment created by PyGithub", path="codegen/templates/GithubObject.MethodBody.UseResult.py", line=26)
+ self.assertEqual(comment.id, 1362000)
+ self.assertEqual(comment.line, 26)
+ self.assertEqual(comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py")
+ self.assertEqual(comment.position, None)
- def testCreateStatusWithoutOptionalParameters( self ):
- status = self.commit.create_status( "pending" )
- self.assertEqual( status.id, 277031 )
- self.assertEqual( status.state, "pending" )
- self.assertEqual( status.target_url, None )
- self.assertEqual( status.description, None )
+ def testCreateCommentOnFilePosition(self):
+ comment = self.commit.create_comment("Comment also created by PyGithub", path="codegen/templates/GithubObject.MethodBody.UseResult.py", position=3)
+ self.assertEqual(comment.id, 1362001)
+ self.assertEqual(comment.line, None)
+ self.assertEqual(comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py")
+ self.assertEqual(comment.position, 3)
- def testCreateStatusWithAllParameters( self ):
- status = self.commit.create_status( "success", "https://github.com/jacquev6/PyGithub/issues/67", "Status successfuly created by PyGithub" )
- self.assertEqual( status.id, 277040 )
- self.assertEqual( status.state, "success" )
- self.assertEqual( status.target_url, "https://github.com/jacquev6/PyGithub/issues/67" )
- self.assertEqual( status.description, "Status successfuly created by PyGithub" )
+ def testCreateStatusWithoutOptionalParameters(self):
+ status = self.commit.create_status("pending")
+ self.assertEqual(status.id, 277031)
+ self.assertEqual(status.state, "pending")
+ self.assertEqual(status.target_url, None)
+ self.assertEqual(status.description, None)
+
+ def testCreateStatusWithAllParameters(self):
+ status = self.commit.create_status("success", "https://github.com/jacquev6/PyGithub/issues/67", "Status successfuly created by PyGithub")
+ self.assertEqual(status.id, 277040)
+ self.assertEqual(status.state, "success")
+ self.assertEqual(status.target_url, "https://github.com/jacquev6/PyGithub/issues/67")
+ self.assertEqual(status.description, "Status successfuly created by PyGithub")
diff --git a/github/tests/CommitComment.py b/github/tests/CommitComment.py
index 423f6152..83068c2b 100644
--- a/github/tests/CommitComment.py
+++ b/github/tests/CommitComment.py
@@ -15,26 +15,27 @@ import Framework
import datetime
-class CommitComment( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.comment = self.g.get_user().get_repo( "PyGithub" ).get_comment( 1361949 )
- def testAttributes( self ):
- self.assertEqual( self.comment.body, "Comment created by PyGithub" )
- self.assertEqual( self.comment.commit_id, "6945921c529be14c3a8f566dd1e483674516d46d" )
- self.assertEqual( self.comment.created_at, datetime.datetime( 2012, 5, 22, 18, 40, 18 ) )
- self.assertEqual( self.comment.html_url, "https://github.com/jacquev6/PyGithub/commit/6945921c529be14c3a8f566dd1e483674516d46d#commitcomment-1361949" )
- self.assertEqual( self.comment.id, 1361949 )
- self.assertEqual( self.comment.line, None )
- self.assertEqual( self.comment.path, None )
- self.assertEqual( self.comment.position, None )
- self.assertEqual( self.comment.updated_at, datetime.datetime( 2012, 5, 22, 18, 40, 18 ) )
- self.assertEqual( self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/comments/1361949" )
- self.assertEqual( self.comment.user.login, "jacquev6" )
+class CommitComment(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.comment = self.g.get_user().get_repo("PyGithub").get_comment(1361949)
- def testEdit( self ):
- self.comment.edit( "Comment edited by PyGithub" )
+ def testAttributes(self):
+ self.assertEqual(self.comment.body, "Comment created by PyGithub")
+ self.assertEqual(self.comment.commit_id, "6945921c529be14c3a8f566dd1e483674516d46d")
+ self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 22, 18, 40, 18))
+ self.assertEqual(self.comment.html_url, "https://github.com/jacquev6/PyGithub/commit/6945921c529be14c3a8f566dd1e483674516d46d#commitcomment-1361949")
+ self.assertEqual(self.comment.id, 1361949)
+ self.assertEqual(self.comment.line, None)
+ self.assertEqual(self.comment.path, None)
+ self.assertEqual(self.comment.position, None)
+ self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 22, 18, 40, 18))
+ self.assertEqual(self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/comments/1361949")
+ self.assertEqual(self.comment.user.login, "jacquev6")
- def testDelete( self ):
+ def testEdit(self):
+ self.comment.edit("Comment edited by PyGithub")
+
+ def testDelete(self):
self.comment.delete()
diff --git a/github/tests/CommitStatus.py b/github/tests/CommitStatus.py
index 30e5eb22..49691267 100644
--- a/github/tests/CommitStatus.py
+++ b/github/tests/CommitStatus.py
@@ -1,34 +1,35 @@
-# 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 .
-
-import Framework
-
-import github
-import datetime
-
-class CommitStatus( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.statuses = list( self.g.get_user().get_repo( "PyGithub" ).get_commit( "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ).get_statuses() )
-
- def testAttributes( self ):
- self.assertEqual( self.statuses[ 0 ].created_at, datetime.datetime( 2012, 9, 8, 11, 30, 56 ) )
- self.assertEqual( self.statuses[ 0 ].updated_at, datetime.datetime( 2012, 9, 8, 11, 30, 56 ) )
- self.assertEqual( self.statuses[ 0 ].creator.login, "jacquev6" )
- self.assertEqual( self.statuses[ 0 ].description, "Status successfuly created by PyGithub" )
- self.assertEqual( self.statuses[ 1 ].description, None )
- self.assertEqual( self.statuses[ 0 ].id, 277040 )
- self.assertEqual( self.statuses[ 0 ].state, "success" )
- self.assertEqual( self.statuses[ 1 ].state, "pending" )
- self.assertEqual( self.statuses[ 0 ].target_url, "https://github.com/jacquev6/PyGithub/issues/67" )
- self.assertEqual( self.statuses[ 1 ].target_url, None )
+# 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 .
+
+import Framework
+
+import github
+import datetime
+
+
+class CommitStatus(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.statuses = list(self.g.get_user().get_repo("PyGithub").get_commit("1292bf0e22c796e91cc3d6e24b544aece8c21f2a").get_statuses())
+
+ def testAttributes(self):
+ self.assertEqual(self.statuses[0].created_at, datetime.datetime(2012, 9, 8, 11, 30, 56))
+ self.assertEqual(self.statuses[0].updated_at, datetime.datetime(2012, 9, 8, 11, 30, 56))
+ self.assertEqual(self.statuses[0].creator.login, "jacquev6")
+ self.assertEqual(self.statuses[0].description, "Status successfuly created by PyGithub")
+ self.assertEqual(self.statuses[1].description, None)
+ self.assertEqual(self.statuses[0].id, 277040)
+ self.assertEqual(self.statuses[0].state, "success")
+ self.assertEqual(self.statuses[1].state, "pending")
+ self.assertEqual(self.statuses[0].target_url, "https://github.com/jacquev6/PyGithub/issues/67")
+ self.assertEqual(self.statuses[1].target_url, None)
diff --git a/github/tests/ContentFile.py b/github/tests/ContentFile.py
index e5ad1d3c..1616c6eb 100644
--- a/github/tests/ContentFile.py
+++ b/github/tests/ContentFile.py
@@ -1,33 +1,34 @@
-# 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 .
-
-import base64
-
-import Framework
-
-import github
-import datetime
-
-class ContentFile( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.file = self.g.get_user().get_repo( "PyGithub" ).get_readme()
-
- def testAttributes( self ):
- self.assertEqual( self.file.type, "file" )
- self.assertEqual( self.file.encoding, "base64" )
- 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 )
- self.assertEqual( self.file.sha, "5628799a7d517a4aaa0c1a7004d07569cd154df0" )
+# 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 .
+
+import base64
+
+import Framework
+
+import github
+import datetime
+
+
+class ContentFile(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.file = self.g.get_user().get_repo("PyGithub").get_readme()
+
+ def testAttributes(self):
+ self.assertEqual(self.file.type, "file")
+ self.assertEqual(self.file.encoding, "base64")
+ 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)
+ self.assertEqual(self.file.sha, "5628799a7d517a4aaa0c1a7004d07569cd154df0")
diff --git a/github/tests/Download.py b/github/tests/Download.py
index ba80fb36..975d6f20 100644
--- a/github/tests/Download.py
+++ b/github/tests/Download.py
@@ -15,32 +15,33 @@ import Framework
import datetime
-class Download( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.download = self.g.get_user().get_repo( "PyGithub" ).get_download( 242550 )
- def testAttributes( self ):
- self.assertEqual( self.download.accesskeyid, None )
- self.assertEqual( self.download.acl, None )
- self.assertEqual( self.download.bucket, None )
- self.assertEqual( self.download.content_type, "text/plain" )
- self.assertEqual( self.download.created_at, datetime.datetime( 2012, 5, 22, 18, 58, 32 ) )
- self.assertEqual( self.download.description, None )
- self.assertEqual( self.download.download_count, 0 )
- self.assertEqual( self.download.expirationdate, None )
- self.assertEqual( self.download.html_url, "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt" )
- self.assertEqual( self.download.id, 242550 )
- self.assertEqual( self.download.mime_type, None )
- self.assertEqual( self.download.name, "Foobar.txt" )
- self.assertEqual( self.download.path, None )
- self.assertEqual( self.download.policy, None )
- self.assertEqual( self.download.prefix, None )
- self.assertEqual( self.download.redirect, None )
- self.assertEqual( self.download.s3_url, None )
- self.assertEqual( self.download.signature, None )
- self.assertEqual( self.download.size, 1024 )
- self.assertEqual( self.download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242550" )
+class Download(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.download = self.g.get_user().get_repo("PyGithub").get_download(242550)
- def testDelete( self ):
+ def testAttributes(self):
+ self.assertEqual(self.download.accesskeyid, None)
+ self.assertEqual(self.download.acl, None)
+ self.assertEqual(self.download.bucket, None)
+ self.assertEqual(self.download.content_type, "text/plain")
+ self.assertEqual(self.download.created_at, datetime.datetime(2012, 5, 22, 18, 58, 32))
+ self.assertEqual(self.download.description, None)
+ self.assertEqual(self.download.download_count, 0)
+ self.assertEqual(self.download.expirationdate, None)
+ self.assertEqual(self.download.html_url, "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt")
+ self.assertEqual(self.download.id, 242550)
+ self.assertEqual(self.download.mime_type, None)
+ self.assertEqual(self.download.name, "Foobar.txt")
+ self.assertEqual(self.download.path, None)
+ self.assertEqual(self.download.policy, None)
+ self.assertEqual(self.download.prefix, None)
+ self.assertEqual(self.download.redirect, None)
+ self.assertEqual(self.download.s3_url, None)
+ self.assertEqual(self.download.signature, None)
+ self.assertEqual(self.download.size, 1024)
+ self.assertEqual(self.download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242550")
+
+ def testDelete(self):
self.download.delete()
diff --git a/github/tests/Enterprise.py b/github/tests/Enterprise.py
index 9058c608..5552f14b 100644
--- a/github/tests/Enterprise.py
+++ b/github/tests/Enterprise.py
@@ -15,22 +15,23 @@ import github
import Framework
+
# Replay data for this test case is forged, because I don't have access to a real Github Enterprise install
-class Enterprise( Framework.BasicTestCase ):
- def testHttps( self ):
- g = github.Github( self.login, self.password, base_url = "https://my.enterprise.com" )
- self.assertListKeyEqual( g.get_user().get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] )
+class Enterprise(Framework.BasicTestCase):
+ def testHttps(self):
+ g = github.Github(self.login, self.password, base_url="https://my.enterprise.com")
+ self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
- def testHttp( self ):
- g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com" )
- self.assertListKeyEqual( g.get_user().get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] )
+ def testHttp(self):
+ g = github.Github(self.login, self.password, base_url="http://my.enterprise.com")
+ self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
- def testLongUrl( self ):
- g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com/path/to/github" )
+ def testLongUrl(self):
+ g = github.Github(self.login, self.password, base_url="http://my.enterprise.com/path/to/github")
repos = g.get_user().get_repos()
- self.assertListKeyEqual( repos, lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] )
- self.assertEqual( repos[ 0 ].owner.name, "Vincent Jacques" )
+ self.assertListKeyEqual(repos, lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
+ self.assertEqual(repos[0].owner.name, "Vincent Jacques")
- def testSpecificPort( self ):
- g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com:8080" )
- self.assertListKeyEqual( g.get_user().get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] )
+ def testSpecificPort(self):
+ g = github.Github(self.login, self.password, base_url="http://my.enterprise.com:8080")
+ self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
diff --git a/github/tests/Event.py b/github/tests/Event.py
index fa17c2a3..5bc0d6c7 100644
--- a/github/tests/Event.py
+++ b/github/tests/Event.py
@@ -15,17 +15,18 @@ import Framework
import datetime
-class Event( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.event = self.g.get_user( "jacquev6" ).get_events()[ 0 ]
- def testAttributes( self ):
- self.assertEqual( self.event.actor.login, "jacquev6" )
- self.assertEqual( self.event.created_at, datetime.datetime( 2012, 5, 26, 10, 1, 39 ) )
- self.assertEqual( self.event.id, "1556114751" )
- self.assertEqual( self.event.org, None )
- self.assertEqual( self.event.payload, {u'commits': [{u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'sha': u'5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'message': u'Implement the three authentication schemes', u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/cb0313157bf904f2d364377d35d9397b269547a5', u'sha': u'cb0313157bf904f2d364377d35d9397b269547a5', u'message': u"Merge branch 'topic/Authentication' into develop", u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'sha': u'0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'message': u'Publish version 0.7', u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'sha': u'ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'message': u"Merge branch 'develop'", u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/3a3bf4763192ee1234eb0557628133e06f3dfc76', u'sha': u'3a3bf4763192ee1234eb0557628133e06f3dfc76', u'message': u"Merge branch 'master' into topic/RewriteWithGeneratedCode\n\nConflicts:\n\tgithub/Github.py\n\tgithub/Requester.py", u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/608f17794664f61693a3dc05e6056fea8fbef0ff', u'sha': u'608f17794664f61693a3dc05e6056fea8fbef0ff', u'message': u'Restore some form of Authorization header in replay data', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/2c04b8adbd91d38eef4f0767337ab7a12b2f684b', u'sha': u'2c04b8adbd91d38eef4f0767337ab7a12b2f684b', u'message': u'Allow test without pre-set-up Github', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/5b97389988b6fe43e15a079702f6f1671257fb28', u'sha': u'5b97389988b6fe43e15a079702f6f1671257fb28', u'message': u'Test three authentication schemes', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/12747613c5ec00deccf296b8619ad507f7050475', u'sha': u'12747613c5ec00deccf296b8619ad507f7050475', u'message': u'Test Issue.getComments', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/2982fa96c5ca75abe717d974d83f9135d664232e', u'sha': u'2982fa96c5ca75abe717d974d83f9135d664232e', u'message': u'Test the new Repository.full_name attribute', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/619eae8d51c5988f0d2889fc767fa677438ba95d', u'sha': u'619eae8d51c5988f0d2889fc767fa677438ba95d', u'message': u'Improve coverage of AuthenticatedUser', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}], u'head': u'619eae8d51c5988f0d2889fc767fa677438ba95d', u'push_id': 80673538, u'ref': u'refs/heads/topic/RewriteWithGeneratedCode', u'size': 11} )
- self.assertEqual( self.event.public, True )
- self.assertEqual( self.event.repo.name, "jacquev6/PyGithub" )
- self.assertEqual( self.event.type, "PushEvent" )
+class Event(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.event = self.g.get_user("jacquev6").get_events()[0]
+
+ def testAttributes(self):
+ self.assertEqual(self.event.actor.login, "jacquev6")
+ self.assertEqual(self.event.created_at, datetime.datetime(2012, 5, 26, 10, 1, 39))
+ self.assertEqual(self.event.id, "1556114751")
+ self.assertEqual(self.event.org, None)
+ self.assertEqual(self.event.payload, {u'commits': [{u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'sha': u'5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'message': u'Implement the three authentication schemes', u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/cb0313157bf904f2d364377d35d9397b269547a5', u'sha': u'cb0313157bf904f2d364377d35d9397b269547a5', u'message': u"Merge branch 'topic/Authentication' into develop", u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'sha': u'0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'message': u'Publish version 0.7', u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'sha': u'ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'message': u"Merge branch 'develop'", u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/3a3bf4763192ee1234eb0557628133e06f3dfc76', u'sha': u'3a3bf4763192ee1234eb0557628133e06f3dfc76', u'message': u"Merge branch 'master' into topic/RewriteWithGeneratedCode\n\nConflicts:\n\tgithub/Github.py\n\tgithub/Requester.py", u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/608f17794664f61693a3dc05e6056fea8fbef0ff', u'sha': u'608f17794664f61693a3dc05e6056fea8fbef0ff', u'message': u'Restore some form of Authorization header in replay data', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/2c04b8adbd91d38eef4f0767337ab7a12b2f684b', u'sha': u'2c04b8adbd91d38eef4f0767337ab7a12b2f684b', u'message': u'Allow test without pre-set-up Github', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/5b97389988b6fe43e15a079702f6f1671257fb28', u'sha': u'5b97389988b6fe43e15a079702f6f1671257fb28', u'message': u'Test three authentication schemes', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/12747613c5ec00deccf296b8619ad507f7050475', u'sha': u'12747613c5ec00deccf296b8619ad507f7050475', u'message': u'Test Issue.getComments', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/2982fa96c5ca75abe717d974d83f9135d664232e', u'sha': u'2982fa96c5ca75abe717d974d83f9135d664232e', u'message': u'Test the new Repository.full_name attribute', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/619eae8d51c5988f0d2889fc767fa677438ba95d', u'sha': u'619eae8d51c5988f0d2889fc767fa677438ba95d', u'message': u'Improve coverage of AuthenticatedUser', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}], u'head': u'619eae8d51c5988f0d2889fc767fa677438ba95d', u'push_id': 80673538, u'ref': u'refs/heads/topic/RewriteWithGeneratedCode', u'size': 11})
+ self.assertEqual(self.event.public, True)
+ self.assertEqual(self.event.repo.name, "jacquev6/PyGithub")
+ self.assertEqual(self.event.type, "PushEvent")
diff --git a/github/tests/Exceptions.py b/github/tests/Exceptions.py
index e94b4bd8..b30cff58 100644
--- a/github/tests/Exceptions.py
+++ b/github/tests/Exceptions.py
@@ -18,14 +18,14 @@ import Framework
atLeastPython26 = sys.hexversion >= 0x02060000
-# To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument
-class Exceptions( Framework.TestCase ):
- def testInvalidInput( self ):
+
+class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument
+ def testInvalidInput(self):
try:
- self.g.get_user().create_key( "Bad key", "xxx" )
- self.fail( "Should have raised" )
+ self.g.get_user().create_key("Bad key", "xxx")
+ self.fail("Should have raised")
except github.GithubException, exception:
- self.assertEqual( exception.status, 422 )
+ self.assertEqual(exception.status, 422)
self.assertEqual(
exception.data,
{
@@ -41,42 +41,42 @@ class Exceptions( Framework.TestCase ):
}
)
if atLeastPython26:
- 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\'}]}" )
+ 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\'}]}" )
+ 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\'}]}")
- def testUnknownObject( self ):
+ def testUnknownObject(self):
try:
- self.g.get_user().get_repo( "Xxx" )
- self.fail( "Should have raised" )
+ self.g.get_user().get_repo("Xxx")
+ self.fail("Should have raised")
except github.GithubException, exception:
- self.assertEqual( exception.status, 404 )
- self.assertEqual( exception.data, { "message": "Not Found" } )
+ self.assertEqual(exception.status, 404)
+ self.assertEqual(exception.data, {"message": "Not Found"})
if atLeastPython26:
- self.assertEqual( str( exception ), "404 {u'message': u'Not Found'}" )
+ self.assertEqual(str(exception), "404 {u'message': u'Not Found'}")
else:
- self.assertEqual( str( exception ), "404 {'message': 'Not Found'}" )
+ self.assertEqual(str(exception), "404 {'message': 'Not Found'}")
- def testUnknownUser( self ):
+ def testUnknownUser(self):
try:
- self.g.get_user( "ThisUserShouldReallyNotExist" )
- self.fail( "Should have raised" )
+ self.g.get_user("ThisUserShouldReallyNotExist")
+ self.fail("Should have raised")
except github.GithubException, exception:
- self.assertEqual( exception.status, 404 )
- self.assertEqual( exception.data, { "message": "Not Found" } )
+ self.assertEqual(exception.status, 404)
+ self.assertEqual(exception.data, {"message": "Not Found"})
if atLeastPython26:
- self.assertEqual( str( exception ), "404 {u'message': u'Not Found'}" )
+ self.assertEqual(str(exception), "404 {u'message': u'Not Found'}")
else:
- self.assertEqual( str( exception ), "404 {'message': 'Not Found'}" )
+ self.assertEqual(str(exception), "404 {'message': 'Not Found'}")
- def testBadAuthentication( self ):
+ def testBadAuthentication(self):
try:
- github.Github( "BadUser", "BadPassword" ).get_user().login
- self.fail( "Should have raised" )
+ github.Github("BadUser", "BadPassword").get_user().login
+ self.fail("Should have raised")
except github.GithubException, exception:
- self.assertEqual( exception.status, 401 )
- self.assertEqual( exception.data, { "message": "Bad credentials" } )
+ self.assertEqual(exception.status, 401)
+ self.assertEqual(exception.data, {"message": "Bad credentials"})
if atLeastPython26:
- self.assertEqual( str( exception ), "401 {u'message': u'Bad credentials'}" )
+ self.assertEqual(str(exception), "401 {u'message': u'Bad credentials'}")
else:
- self.assertEqual( str( exception ), "401 {'message': 'Bad credentials'}" )
+ self.assertEqual(str(exception), "401 {'message': 'Bad credentials'}")
diff --git a/github/tests/Framework.py b/github/tests/Framework.py
index cf1dc896..ae8c3878 100644
--- a/github/tests/Framework.py
+++ b/github/tests/Framework.py
@@ -19,42 +19,45 @@ import traceback
import github
+
class FakeHttpResponse:
- def __init__( self, status, headers, output ):
+ def __init__(self, status, headers, output):
self.status = status
self.__headers = headers
self.__output = output
- def getheaders( self ):
+ def getheaders(self):
return self.__headers
- def read( self ):
+ def read(self):
return self.__output
-def fixAuthorizationHeader( headers ):
+
+def fixAuthorizationHeader(headers):
if "Authorization" in headers:
- if headers[ "Authorization" ].startswith( "token " ):
- headers[ "Authorization" ] = "token private_token_removed"
- elif headers[ "Authorization" ].startswith( "Basic " ):
- headers[ "Authorization" ] = "Basic login_and_password_removed"
+ if headers["Authorization"].startswith("token "):
+ headers["Authorization"] = "token private_token_removed"
+ elif headers["Authorization"].startswith("Basic "):
+ headers["Authorization"] = "Basic login_and_password_removed"
else:
assert False
+
class RecordingConnection:
- def __init__( self, file, protocol, host, port, *args, **kwds ):
+ def __init__(self, file, protocol, host, port, *args, **kwds):
self.__file = file
self.__protocol = protocol
self.__host = host
- self.__port = str( port )
- self.__cnx = self._realConnection( host, port, *args, **kwds )
+ self.__port = str(port)
+ self.__cnx = self._realConnection(host, port, *args, **kwds)
- def request( self, verb, url, input, headers ):
+ def request(self, verb, url, input, headers):
print verb, url, input, headers,
- self.__cnx.request( verb, url, input, headers )
- fixAuthorizationHeader( headers )
- self.__file.write( self.__protocol + " " + verb + " " + self.__host + " " + self.__port + " " + url + " " + str( headers ) + " " + input + "\n" )
+ self.__cnx.request(verb, url, input, headers)
+ fixAuthorizationHeader(headers)
+ self.__file.write(self.__protocol + " " + verb + " " + self.__host + " " + self.__port + " " + url + " " + str(headers) + " " + input + "\n")
- def getresponse( self ):
+ def getresponse(self):
res = self.__cnx.getresponse()
status = res.status
@@ -62,69 +65,75 @@ class RecordingConnection:
headers = res.getheaders()
output = res.read()
- self.__file.write( str( status ) + "\n" )
- self.__file.write( str( headers ) + "\n" )
- self.__file.write( str( output ) + "\n" )
+ self.__file.write(str(status) + "\n")
+ self.__file.write(str(headers) + "\n")
+ self.__file.write(str(output) + "\n")
- return FakeHttpResponse( status, headers, output )
+ return FakeHttpResponse(status, headers, output)
- def close( self ):
- self.__file.write( "\n" )
+ def close(self):
+ self.__file.write("\n")
return self.__cnx.close()
-class RecordingHttpConnection( RecordingConnection ):
+
+class RecordingHttpConnection(RecordingConnection):
_realConnection = httplib.HTTPConnection
- def __init__( self, file, *args, **kwds ):
- RecordingConnection.__init__( self, file, "http", *args, **kwds )
+ def __init__(self, file, *args, **kwds):
+ RecordingConnection.__init__(self, file, "http", *args, **kwds)
-class RecordingHttpsConnection( RecordingConnection ):
+
+class RecordingHttpsConnection(RecordingConnection):
_realConnection = httplib.HTTPSConnection
- def __init__( self, file, *args, **kwds ):
+ def __init__(self, file, *args, **kwds):
print args, kwds
- RecordingConnection.__init__( self, file, "https", *args, **kwds )
+ RecordingConnection.__init__(self, file, "https", *args, **kwds)
+
class ReplayingConnection:
- def __init__( self, testCase, file, protocol, host, port, *args, **kwds ):
+ def __init__(self, testCase, file, protocol, host, port, *args, **kwds):
self.__testCase = testCase
self.__file = file
self.__protocol = protocol
self.__host = host
- self.__port = str( port )
+ self.__port = str(port)
- def request( self, verb, url, input, headers ):
- fixAuthorizationHeader( headers )
+ def request(self, verb, url, input, headers):
+ fixAuthorizationHeader(headers)
expectation = self.__file.readline().strip()
- self.__testCase.assertEqual( self.__protocol + " " + verb + " " + self.__host + " " + self.__port + " " + url + " " + str( headers ) + " " + input, expectation )
+ self.__testCase.assertEqual(self.__protocol + " " + verb + " " + self.__host + " " + self.__port + " " + url + " " + str(headers) + " " + input, expectation)
- def getresponse( self ):
- status = int( self.__file.readline().strip() )
- headers = eval( self.__file.readline().strip() )
+ def getresponse(self):
+ status = int(self.__file.readline().strip())
+ headers = eval(self.__file.readline().strip())
output = self.__file.readline().strip()
- return FakeHttpResponse( status, headers, output )
+ return FakeHttpResponse(status, headers, output)
- def close( self ):
+ def close(self):
self.__file.readline()
-def ReplayingHttpConnection( testCase, file, *args, **kwds ):
- return ReplayingConnection( testCase, file, "http", *args, **kwds )
-def ReplayingHttpsConnection( testCase, file, *args, **kwds ):
- return ReplayingConnection( testCase, file, "https", *args, **kwds )
+def ReplayingHttpConnection(testCase, file, *args, **kwds):
+ return ReplayingConnection(testCase, file, "http", *args, **kwds)
-class BasicTestCase( unittest.TestCase ):
+
+def ReplayingHttpsConnection(testCase, file, *args, **kwds):
+ return ReplayingConnection(testCase, file, "https", *args, **kwds)
+
+
+class BasicTestCase(unittest.TestCase):
recordMode = False
- def setUp( self ):
- unittest.TestCase.setUp( self )
+ def setUp(self):
+ unittest.TestCase.setUp(self)
self.__fileName = ""
self.__file = None
if self.recordMode:
github.Requester.Requester.injectConnectionClasses(
- lambda ignored, *args, **kwds: RecordingHttpConnection( self.__openFile( "wb" ), *args, **kwds ),
- lambda ignored, *args, **kwds: RecordingHttpsConnection( self.__openFile( "wb" ), *args, **kwds )
+ lambda ignored, *args, **kwds: RecordingHttpConnection(self.__openFile("wb"), *args, **kwds),
+ lambda ignored, *args, **kwds: RecordingHttpsConnection(self.__openFile("wb"), *args, **kwds)
)
import GithubCredentials
self.login = GithubCredentials.login
@@ -132,46 +141,48 @@ class BasicTestCase( unittest.TestCase ):
self.oauth_token = GithubCredentials.oauth_token
else:
github.Requester.Requester.injectConnectionClasses(
- lambda ignored, *args, **kwds: ReplayingHttpConnection( self, self.__openFile( "r" ), *args, **kwds ),
- lambda ignored, *args, **kwds: ReplayingHttpsConnection( self, self.__openFile( "r" ), *args, **kwds )
+ lambda ignored, *args, **kwds: ReplayingHttpConnection(self, self.__openFile("r"), *args, **kwds),
+ lambda ignored, *args, **kwds: ReplayingHttpsConnection(self, self.__openFile("r"), *args, **kwds)
)
self.login = "login"
self.password = "password"
self.oauth_token = "oauth_token"
- def tearDown( self ):
- unittest.TestCase.tearDown( self )
+ def tearDown(self):
+ unittest.TestCase.tearDown(self)
self.__closeReplayFileIfNeeded()
- def __openFile( self, mode ):
- for ( _, _, functionName, _ ) in traceback.extract_stack():
- if functionName.startswith( "test" ) or functionName == "setUp" or functionName == "tearDown":
- if functionName != "test": # because in class Hook( Framework.TestCase ), method testTest calls Hook.test
- fileName = os.path.join( os.path.dirname( __file__ ), "ReplayData", self.__class__.__name__ + "." + functionName + ".txt" )
+ def __openFile(self, mode):
+ for (_, _, functionName, _) in traceback.extract_stack():
+ if functionName.startswith("test") or functionName == "setUp" or functionName == "tearDown":
+ if functionName != "test": # because in class Hook(Framework.TestCase), method testTest calls Hook.test
+ fileName = os.path.join(os.path.dirname(__file__), "ReplayData", self.__class__.__name__ + "." + functionName + ".txt")
if fileName != self.__fileName:
self.__closeReplayFileIfNeeded()
self.__fileName = fileName
- self.__file = open( self.__fileName, mode )
+ self.__file = open(self.__fileName, mode)
return self.__file
- def __closeReplayFileIfNeeded( self ):
+ def __closeReplayFileIfNeeded(self):
if self.__file is not None:
if not self.recordMode:
- self.assertEqual( self.__file.readline(), "" )
+ self.assertEqual(self.__file.readline(), "")
self.__file.close()
- def assertListKeyEqual( self, elements, key, expectedKeys ):
- realKeys = [ key( element ) for element in elements ]
- self.assertEqual( realKeys, expectedKeys )
+ def assertListKeyEqual(self, elements, key, expectedKeys):
+ realKeys = [key(element) for element in elements]
+ self.assertEqual(realKeys, expectedKeys)
- def assertListKeyBegin( self, elements, key, expectedKeys ):
- realKeys = [ key( element ) for element in elements[ : len( expectedKeys ) ] ]
- self.assertEqual( realKeys, expectedKeys )
+ def assertListKeyBegin(self, elements, key, expectedKeys):
+ realKeys = [key(element) for element in elements[: len(expectedKeys)]]
+ self.assertEqual(realKeys, expectedKeys)
+
+
+class TestCase(BasicTestCase):
+ def setUp(self):
+ BasicTestCase.setUp(self)
+ self.g = github.Github(self.login, self.password)
-class TestCase( BasicTestCase ):
- def setUp( self ):
- BasicTestCase.setUp( self )
- self.g = github.Github( self.login, self.password )
def activateRecordMode():
BasicTestCase.recordMode = True
diff --git a/github/tests/Gist.py b/github/tests/Gist.py
index 76341e8d..98ba0e60 100644
--- a/github/tests/Gist.py
+++ b/github/tests/Gist.py
@@ -16,71 +16,72 @@ import Framework
import github
import datetime
-class Gist( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- 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" )
+class Gist(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.gist = self.g.get_gist("2729810")
- def testEditWithoutParameters( self ):
+ 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")
+
+ 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.assertEquals(self.gist.description, "Gist created by PyGithub")
+ self.assertEquals(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" ] )
+ 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"])
- def testCreateComment( self ):
- comment = self.gist.create_comment( "Comment created by PyGithub" )
- self.assertEquals( comment.id, 323629 )
+ def testCreateComment(self):
+ comment = self.gist.create_comment("Comment created by PyGithub")
+ self.assertEquals(comment.id, 323629)
- def testGetComments( self ):
- self.assertListKeyEqual( self.gist.get_comments(), lambda c: c.id, [ 323637 ] )
+ def testGetComments(self):
+ self.assertListKeyEqual(self.gist.get_comments(), lambda c: c.id, [323637])
- def testStarring( self ):
- self.assertFalse( self.gist.is_starred() )
+ def testStarring(self):
+ self.assertFalse(self.gist.is_starred())
self.gist.set_starred()
- self.assertTrue( self.gist.is_starred() )
+ self.assertTrue(self.gist.is_starred())
self.gist.reset_starred()
- self.assertFalse( self.gist.is_starred() )
+ self.assertFalse(self.gist.is_starred())
- def testFork( self ):
- gist = self.g.get_gist( "2729818" ) # Random gist
+ 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
- sameGist = self.g.get_gist( "2729865" )
- self.assertEquals( sameGist.fork_of.id, "2729818" )
+ self.assertEquals(myGist.id, "2729865")
+ self.assertEquals(myGist.fork_of, None) # WTF
+ sameGist = self.g.get_gist("2729865")
+ self.assertEquals(sameGist.fork_of.id, "2729818")
- def testDelete( self ):
+ def testDelete(self):
self.gist.delete()
diff --git a/github/tests/GistComment.py b/github/tests/GistComment.py
index 4fb3122b..08ab183d 100644
--- a/github/tests/GistComment.py
+++ b/github/tests/GistComment.py
@@ -15,23 +15,24 @@ import Framework
import datetime
-class GistComment( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- 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/comments/323629" )
- self.assertEquals( self.comment.user.login, "jacquev6" )
+class GistComment(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.comment = self.g.get_gist("2729810").get_comment(323629)
- 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 ) )
+ 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/comments/323629")
+ self.assertEquals(self.comment.user.login, "jacquev6")
- def testDelete( self ):
+ 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))
+
+ def testDelete(self):
self.comment.delete()
diff --git a/github/tests/GitBlob.py b/github/tests/GitBlob.py
index 64ef55d3..92e495ae 100644
--- a/github/tests/GitBlob.py
+++ b/github/tests/GitBlob.py
@@ -13,16 +13,17 @@
import Framework
-class GitBlob( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.blob = self.g.get_user().get_repo( "PyGithub" ).get_git_blob( "53bce9fa919b4544e67275089b3ec5b44be20667" )
- def testAttributes( self ):
- self.assertTrue( self.blob.content.startswith( "IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgpmcm9tIGRpc3R1dGlscy5jb3JlIGlt\ncG9ydCBzZXR1cAppbXBvcnQgdGV4dHdyYXAKCnNldHVwKAogICAgbmFtZSA9\n" ) )
- self.assertTrue( self.blob.content.endswith( "Z3JhbW1pbmcgTGFuZ3VhZ2UgOjogUHl0aG9uIiwKICAgICAgICAiVG9waWMg\nOjogU29mdHdhcmUgRGV2ZWxvcG1lbnQiLAogICAgXSwKKQo=\n" ) )
- self.assertEqual( len( self.blob.content ), 1757 )
- self.assertEqual( self.blob.encoding, "base64" )
- self.assertEqual( self.blob.size, 1295 )
- self.assertEqual( self.blob.sha, "53bce9fa919b4544e67275089b3ec5b44be20667" )
- self.assertEqual( self.blob.url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/53bce9fa919b4544e67275089b3ec5b44be20667" )
+class GitBlob(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.blob = self.g.get_user().get_repo("PyGithub").get_git_blob("53bce9fa919b4544e67275089b3ec5b44be20667")
+
+ def testAttributes(self):
+ self.assertTrue(self.blob.content.startswith("IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgpmcm9tIGRpc3R1dGlscy5jb3JlIGlt\ncG9ydCBzZXR1cAppbXBvcnQgdGV4dHdyYXAKCnNldHVwKAogICAgbmFtZSA9\n"))
+ self.assertTrue(self.blob.content.endswith("Z3JhbW1pbmcgTGFuZ3VhZ2UgOjogUHl0aG9uIiwKICAgICAgICAiVG9waWMg\nOjogU29mdHdhcmUgRGV2ZWxvcG1lbnQiLAogICAgXSwKKQo=\n"))
+ self.assertEqual(len(self.blob.content), 1757)
+ self.assertEqual(self.blob.encoding, "base64")
+ self.assertEqual(self.blob.size, 1295)
+ self.assertEqual(self.blob.sha, "53bce9fa919b4544e67275089b3ec5b44be20667")
+ self.assertEqual(self.blob.url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/53bce9fa919b4544e67275089b3ec5b44be20667")
diff --git a/github/tests/GitCommit.py b/github/tests/GitCommit.py
index f85a667e..d2d71871 100644
--- a/github/tests/GitCommit.py
+++ b/github/tests/GitCommit.py
@@ -15,22 +15,23 @@ import datetime
import Framework
-class GitCommit( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.commit = self.g.get_user().get_repo( "PyGithub" ).get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" )
- def testAttributes( self ):
- self.assertEqual( self.commit.author.name, "Vincent Jacques" )
- self.assertEqual( self.commit.author.email, "vincent@vincent-jacques.net" )
- self.assertEqual( self.commit.author.date, datetime.datetime( 2012, 4, 17, 17, 55, 16 ) )
- self.assertEqual( self.commit.committer.name, "Vincent Jacques" )
- self.assertEqual( self.commit.committer.email, "vincent@vincent-jacques.net" )
- self.assertEqual( self.commit.committer.date, datetime.datetime( 2012, 4, 17, 17, 55, 16 ) )
- self.assertEqual( self.commit.message, "Merge branch 'develop'\n" )
- self.assertEqual( len( self.commit.parents ), 2 )
- self.assertEqual( self.commit.parents[ 0 ].sha, "936f4a97f1a86392637ec002bbf89ff036a5062d" )
- self.assertEqual( self.commit.parents[ 1 ].sha, "2a7e80e6421c5d4d201d60619068dea6bae612cb" )
- self.assertEqual( self.commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495" )
- self.assertEqual( self.commit.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad" )
- self.assertEqual( self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495" )
+class GitCommit(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.commit = self.g.get_user().get_repo("PyGithub").get_git_commit("4303c5b90e2216d927155e9609436ccb8984c495")
+
+ def testAttributes(self):
+ self.assertEqual(self.commit.author.name, "Vincent Jacques")
+ self.assertEqual(self.commit.author.email, "vincent@vincent-jacques.net")
+ self.assertEqual(self.commit.author.date, datetime.datetime(2012, 4, 17, 17, 55, 16))
+ self.assertEqual(self.commit.committer.name, "Vincent Jacques")
+ self.assertEqual(self.commit.committer.email, "vincent@vincent-jacques.net")
+ self.assertEqual(self.commit.committer.date, datetime.datetime(2012, 4, 17, 17, 55, 16))
+ self.assertEqual(self.commit.message, "Merge branch 'develop'\n")
+ self.assertEqual(len(self.commit.parents), 2)
+ self.assertEqual(self.commit.parents[0].sha, "936f4a97f1a86392637ec002bbf89ff036a5062d")
+ self.assertEqual(self.commit.parents[1].sha, "2a7e80e6421c5d4d201d60619068dea6bae612cb")
+ self.assertEqual(self.commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495")
+ self.assertEqual(self.commit.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad")
+ self.assertEqual(self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495")
diff --git a/github/tests/GitRef.py b/github/tests/GitRef.py
index df53f017..67e4ddc0 100644
--- a/github/tests/GitRef.py
+++ b/github/tests/GitRef.py
@@ -13,23 +13,24 @@
import Framework
-class GitRef( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.ref = self.g.get_user().get_repo( "PyGithub" ).get_git_ref( "refs/heads/BranchCreatedByPyGithub" )
- def testAttributes( self ):
- self.assertEqual( self.ref.object.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" )
- self.assertEqual( self.ref.object.type, "commit" )
- self.assertEqual( self.ref.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a" )
- self.assertEqual( self.ref.ref, "refs/heads/BranchCreatedByPyGithub" )
- self.assertEqual( self.ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub" )
+class GitRef(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.ref = self.g.get_user().get_repo("PyGithub").get_git_ref("refs/heads/BranchCreatedByPyGithub")
- def testEdit( self ):
- self.ref.edit( "04cde900a0775b51f762735637bd30de392a2793" )
+ def testAttributes(self):
+ self.assertEqual(self.ref.object.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
+ self.assertEqual(self.ref.object.type, "commit")
+ self.assertEqual(self.ref.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a")
+ self.assertEqual(self.ref.ref, "refs/heads/BranchCreatedByPyGithub")
+ self.assertEqual(self.ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub")
- def testEditWithForce( self ):
- self.ref.edit( "4303c5b90e2216d927155e9609436ccb8984c495", force = True )
+ def testEdit(self):
+ self.ref.edit("04cde900a0775b51f762735637bd30de392a2793")
- def testDelete( self ):
+ def testEditWithForce(self):
+ self.ref.edit("4303c5b90e2216d927155e9609436ccb8984c495", force=True)
+
+ def testDelete(self):
self.ref.delete()
diff --git a/github/tests/GitTag.py b/github/tests/GitTag.py
index f7fb6f84..eb20977c 100644
--- a/github/tests/GitTag.py
+++ b/github/tests/GitTag.py
@@ -15,19 +15,20 @@ import datetime
import Framework
-class GitTag( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.tag = self.g.get_user().get_repo( "PyGithub" ).get_git_tag( "f5f37322407b02a80de4526ad88d5f188977bc3c" )
- def testAttributes( self ):
- self.assertEqual( self.tag.message, "Version 0.6\n" )
- self.assertEqual( self.tag.object.sha, "4303c5b90e2216d927155e9609436ccb8984c495" )
- self.assertEqual( self.tag.object.type, "commit" )
- self.assertEqual( self.tag.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495" )
- self.assertEqual( self.tag.sha, "f5f37322407b02a80de4526ad88d5f188977bc3c" )
- self.assertEqual( self.tag.tag, "v0.6" )
- self.assertEqual( self.tag.tagger.date, datetime.datetime( 2012, 5, 10, 18, 14, 15 ) )
- self.assertEqual( self.tag.tagger.email, "vincent@vincent-jacques.net" )
- self.assertEqual( self.tag.tagger.name, "Vincent Jacques" )
- self.assertEqual( self.tag.url, "https://api.github.com/repos/jacquev6/PyGithub/git/tags/f5f37322407b02a80de4526ad88d5f188977bc3c" )
+class GitTag(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.tag = self.g.get_user().get_repo("PyGithub").get_git_tag("f5f37322407b02a80de4526ad88d5f188977bc3c")
+
+ def testAttributes(self):
+ self.assertEqual(self.tag.message, "Version 0.6\n")
+ self.assertEqual(self.tag.object.sha, "4303c5b90e2216d927155e9609436ccb8984c495")
+ self.assertEqual(self.tag.object.type, "commit")
+ self.assertEqual(self.tag.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495")
+ self.assertEqual(self.tag.sha, "f5f37322407b02a80de4526ad88d5f188977bc3c")
+ self.assertEqual(self.tag.tag, "v0.6")
+ self.assertEqual(self.tag.tagger.date, datetime.datetime(2012, 5, 10, 18, 14, 15))
+ self.assertEqual(self.tag.tagger.email, "vincent@vincent-jacques.net")
+ self.assertEqual(self.tag.tagger.name, "Vincent Jacques")
+ self.assertEqual(self.tag.url, "https://api.github.com/repos/jacquev6/PyGithub/git/tags/f5f37322407b02a80de4526ad88d5f188977bc3c")
diff --git a/github/tests/GitTree.py b/github/tests/GitTree.py
index f660125c..7a512d8d 100644
--- a/github/tests/GitTree.py
+++ b/github/tests/GitTree.py
@@ -13,24 +13,25 @@
import Framework
-class GitTree( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.tree = self.g.get_user().get_repo( "PyGithub" ).get_git_tree( "f492784d8ca837779650d1fb406a1a3587a764ad" )
- def testAttributes( self ):
- self.assertEqual( self.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad" )
- self.assertEqual( len( self.tree.tree ), 11 )
- self.assertEqual( self.tree.tree[ 0 ].mode, "100644" )
- self.assertEqual( self.tree.tree[ 0 ].path, ".gitignore" )
- self.assertEqual( self.tree.tree[ 0 ].sha, "8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd" )
- self.assertEqual( self.tree.tree[ 0 ].size, 53 )
- self.assertEqual( self.tree.tree[ 0 ].type, "blob" )
- self.assertEqual( self.tree.tree[ 0 ].url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd" )
- self.assertEqual( self.tree.tree[ 6 ].mode, "040000" )
- self.assertEqual( self.tree.tree[ 6 ].path, "ReplayDataForIntegrationTest" )
- self.assertEqual( self.tree.tree[ 6 ].sha, "60b4602b2c2070246c5df078fb7a5150b45815eb" )
- self.assertEqual( self.tree.tree[ 6 ].size, None )
- self.assertEqual( self.tree.tree[ 6 ].type, "tree" )
- self.assertEqual( self.tree.tree[ 6 ].url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/60b4602b2c2070246c5df078fb7a5150b45815eb" )
- self.assertEqual( self.tree.url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad" )
+class GitTree(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.tree = self.g.get_user().get_repo("PyGithub").get_git_tree("f492784d8ca837779650d1fb406a1a3587a764ad")
+
+ def testAttributes(self):
+ self.assertEqual(self.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad")
+ self.assertEqual(len(self.tree.tree), 11)
+ self.assertEqual(self.tree.tree[0].mode, "100644")
+ self.assertEqual(self.tree.tree[0].path, ".gitignore")
+ self.assertEqual(self.tree.tree[0].sha, "8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd")
+ self.assertEqual(self.tree.tree[0].size, 53)
+ self.assertEqual(self.tree.tree[0].type, "blob")
+ self.assertEqual(self.tree.tree[0].url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd")
+ self.assertEqual(self.tree.tree[6].mode, "040000")
+ self.assertEqual(self.tree.tree[6].path, "ReplayDataForIntegrationTest")
+ self.assertEqual(self.tree.tree[6].sha, "60b4602b2c2070246c5df078fb7a5150b45815eb")
+ self.assertEqual(self.tree.tree[6].size, None)
+ self.assertEqual(self.tree.tree[6].type, "tree")
+ self.assertEqual(self.tree.tree[6].url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/60b4602b2c2070246c5df078fb7a5150b45815eb")
+ self.assertEqual(self.tree.url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad")
diff --git a/github/tests/Github.py b/github/tests/Github.py
index 79bb107e..899b7beb 100644
--- a/github/tests/Github.py
+++ b/github/tests/Github.py
@@ -15,77 +15,78 @@ import datetime
import Framework
-class Github( Framework.TestCase ):
- def testGetGists( self ):
- self.assertListKeyBegin( self.g.get_gists(), lambda g: g.id, [ "2729695", "2729656", "2729597", "2729584", "2729569", "2729554", "2729543", "2729537", "2729536", "2729533", "2729525", "2729522", "2729519", "2729515", "2729506", "2729487", "2729484", "2729482", "2729441", "2729432", "2729420", "2729398", "2729372", "2729371", "2729351", "2729346", "2729316", "2729304", "2729296", "2729276", "2729272", "2729265", "2729195", "2729160", "2729143", "2729127", "2729119", "2729113", "2729103", "2729069", "2729059", "2729051", "2729029", "2729027", "2729026", "2729022", "2729002", "2728985", "2728979", "2728964", "2728937", "2728933", "2728884", "2728869", "2728866", "2728855", "2728854", "2728853", "2728846", "2728825", "2728814", "2728813", "2728812", "2728805", "2728802", "2728800", "2728798", "2728797", "2728796", "2728793", "2728758", "2728754", "2728751", "2728748", "2728721", "2728716", "2728715", "2728705", "2728701", "2728699", "2728697", "2728688", "2728683", "2728677", "2728649", "2728640", "2728625", "2728620", "2728615", "2728614", "2728565", "2728564", "2728554", "2728523", "2728519", "2728511", "2728497", "2728496", "2728495", "2728487" ] )
- def testLegacySearchRepos( self ):
- repos = self.g.legacy_search_repos( "github api v3" )
- self.assertListKeyBegin( repos, lambda r: r.name, [ "octokit", "github-v3-api", "github_v3_api" ] )
- self.assertEqual( repos[ 0 ].full_name, "pengwynn/octokit" )
+class Github(Framework.TestCase):
+ def testGetGists(self):
+ self.assertListKeyBegin(self.g.get_gists(), lambda g: g.id, ["2729695", "2729656", "2729597", "2729584", "2729569", "2729554", "2729543", "2729537", "2729536", "2729533", "2729525", "2729522", "2729519", "2729515", "2729506", "2729487", "2729484", "2729482", "2729441", "2729432", "2729420", "2729398", "2729372", "2729371", "2729351", "2729346", "2729316", "2729304", "2729296", "2729276", "2729272", "2729265", "2729195", "2729160", "2729143", "2729127", "2729119", "2729113", "2729103", "2729069", "2729059", "2729051", "2729029", "2729027", "2729026", "2729022", "2729002", "2728985", "2728979", "2728964", "2728937", "2728933", "2728884", "2728869", "2728866", "2728855", "2728854", "2728853", "2728846", "2728825", "2728814", "2728813", "2728812", "2728805", "2728802", "2728800", "2728798", "2728797", "2728796", "2728793", "2728758", "2728754", "2728751", "2728748", "2728721", "2728716", "2728715", "2728705", "2728701", "2728699", "2728697", "2728688", "2728683", "2728677", "2728649", "2728640", "2728625", "2728620", "2728615", "2728614", "2728565", "2728564", "2728554", "2728523", "2728519", "2728511", "2728497", "2728496", "2728495", "2728487"])
+
+ def testLegacySearchRepos(self):
+ repos = self.g.legacy_search_repos("github api v3")
+ self.assertListKeyBegin(repos, lambda r: r.name, ["octokit", "github-v3-api", "github_v3_api"])
+ self.assertEqual(repos[0].full_name, "pengwynn/octokit")
# Attributes retrieved from legacy API without lazy completion call
- self.assertEqual( repos[ 1 ].created_at, datetime.datetime( 2011, 6, 23, 22, 52, 33 ) )
- self.assertEqual( repos[ 1 ].name, "github-v3-api" )
- self.assertEqual( repos[ 1 ].watchers, 35 )
- self.assertEqual( repos[ 1 ].has_downloads, True )
- self.assertEqual( repos[ 3 ].homepage, "http://peter-murach.github.com/github" )
- self.assertEqual( repos[ 1 ].url, "/repos/jwilger/github-v3-api" )
- self.assertEqual( repos[ 1 ].fork, False )
- self.assertEqual( repos[ 1 ].has_issues, True )
- self.assertEqual( repos[ 1 ].has_wiki, False )
- self.assertEqual( repos[ 1 ].forks, 13 )
- self.assertEqual( repos[ 1 ].size, 212 )
- self.assertEqual( repos[ 1 ].private, False )
- self.assertEqual( repos[ 1 ].open_issues, 2 )
- self.assertEqual( repos[ 3 ].pushed_at, datetime.datetime( 2012, 6, 28, 21, 26, 31 ) )
- self.assertEqual( repos[ 1 ].description, "Ruby Client for the GitHub v3 API" )
- self.assertEqual( repos[ 1 ].language, "Ruby" )
- self.assertEqual( repos[ 1 ].owner.login, "jwilger" )
- self.assertEqual( repos[ 1 ].owner.url, "/users/jwilger" )
+ self.assertEqual(repos[1].created_at, datetime.datetime(2011, 6, 23, 22, 52, 33))
+ self.assertEqual(repos[1].name, "github-v3-api")
+ self.assertEqual(repos[1].watchers, 35)
+ self.assertEqual(repos[1].has_downloads, True)
+ self.assertEqual(repos[3].homepage, "http://peter-murach.github.com/github")
+ self.assertEqual(repos[1].url, "/repos/jwilger/github-v3-api")
+ self.assertEqual(repos[1].fork, False)
+ self.assertEqual(repos[1].has_issues, True)
+ self.assertEqual(repos[1].has_wiki, False)
+ self.assertEqual(repos[1].forks, 13)
+ self.assertEqual(repos[1].size, 212)
+ self.assertEqual(repos[1].private, False)
+ self.assertEqual(repos[1].open_issues, 2)
+ self.assertEqual(repos[3].pushed_at, datetime.datetime(2012, 6, 28, 21, 26, 31))
+ self.assertEqual(repos[1].description, "Ruby Client for the GitHub v3 API")
+ self.assertEqual(repos[1].language, "Ruby")
+ self.assertEqual(repos[1].owner.login, "jwilger")
+ self.assertEqual(repos[1].owner.url, "/users/jwilger")
- def testLegacySearchReposPagination( self ):
- repos = self.g.legacy_search_repos( "document" )
- self.assertListKeyBegin( repos, lambda r: r.name, [ "git", "nimbus", "kss", "sstoolkit", "lawnchair", "appledoc", "jQ.Mobi", "ipython", "mongoengine", "ravendb", "substance", "symfony-docs", "JavaScript-Garden", "DocSets-for-iOS", "yard", "phpDocumentor2", "phpsh", "Tangle", "Ingredients", "documentjs", "xhp", "couchdb-lucene", "dox", "magento2", "javascriptmvc", "FastPdfKit", "roar", "DocumentUp", "NoRM", "jsdoc", "tagger", "mongodb-csharp", "php-github-api", "beautiful-docs", "mongodb-odm", "iodocs", "seesaw", "bcx-api", "developer.github.com", "amqp", "docsplit", "pycco", "standards-and-practices", "tidy-html5", "redis-doc", "tomdoc", "docs", "flourish", "userguide", "swagger-ui", "rfc", "Weasel-Diesel", "yuidoc", "apigen", "document-viewer", "develop.github.com", "Shanty-Mongo", "PTShowcaseViewController", "gravatar_image_tag", "api-wow-docs", "mongoid-tree", "safari-json-formatter", "mayan", "orm-documentation", "jsfiddle-docs-alpha", "core", "documentcloud", "flexible-nav", "writeCapture", "readium", "xmldocument", "Documentation-Examples", "grails-doc", "stdeb", "aws-autoscaling", "voteable_mongo", "review", "spreadsheet_on_rails", "UKSyntaxColoredTextDocument", "mandango", "bdoc", "Documentation", "documents.com", "rghost", "ticket_mule", "vendo", "khan-api", "spring-data-document-examples", "rspec_api_documentation", "axlsx", "phpdox", "documentation", "Sami", "innershiv", "doxyclean", "documents", "rvm-site", "jqapi", "documentation", "hadoopy", "VichUploaderBundle", "pdoc", "documentation", "wii-js", "oss-docs", "scala-maven-plugin", "Documents", "documenter", "behemoth", "documentation", "documentation", "propelorm.github.com", "Kobold2D", "AutoObjectDocumentation", "php-mongodb-admin", "django-mongokit", "puppet-docs", "docs", "Document", "vendorer", "symfony1-docs", "shocco", "documentation", "jog", "docs", "documentation", "documentation", "documentation", "documentation", "Documentation", "documentation", "documentation", "phpunit-documentation", "ADCtheme", "NelmioApiDocBundle", "iCloud-Singleton-CloudMe", "Documentation", "document", "document_mapper", "heroku-docs", "couchdb-odm", "documentation", "documentation", "document", "documentation", "NanoStore", "documentation", "Documentation", "documentation", "Documentation", "documentation", "document", "documentation", "documentation", "Documentation", "Documentation", "grendel", "ceylon-compiler", "mbtiles-spec", "documentation", "documents", "documents", "Documents", "Documentation", "documentation", "Documentation", "documentation", "documents", "Documentation", "documentation", "documentation", "documents", "Documentation", "documentation", "documenter", "documentation", "documents", "Documents", "documents", "documents", "documentation", "Document", "document", "rdoc", "mongoid_token", "travis-ci.github.com", "Documents", "Documents", "documents", "Document", "Documentation", "documents", "Documents", "Documentation", "documents", "documents", "documents", "documentation", "Documents", "Document", "documents", "documents", "Documentation", "Documentation", "Document", "documents", "Documents", "Documents", "Documentation", "Documents", "documents", "Documents", "document", "documents", "Documentation", "Documents", "documents", "documents", "Documents", "documents", "Documentation", "documentation", "Document", "Documents", "documents", "documents", "documents", "Documentation", "Documentation", "Documents", "Documents", "Documents", "Documenter", "document", "Documentation", "Documents", "Documents", "documentation", "documentation", "Document", "Documents", "Documentation", "Documentation", "Documents", "documents", "Documents", "document", "documentation", "Documents", "documentation", "documentation", "documentation", "Documentation", "Documents", "Documents", "documentation", "Documents", "Documents", "documentation", "documentation", "documents", "Documentation", "documents", "documentation", "Documentation", "Documents", "documentation", "documentation", "documents", "documentation", "Umbraco5Docs", "documents", "Documents", "Documentation", "documents", "document", "documents", "document", "documents", "documentation", "Documents", "documents", "document", "Documents", "Documentation", "Documentation", "documentation", "Documentation", "document", "documentation", "documents", "documents", "Documentations", "document", "documentation", "Documentation", "Document", "Documents", "Documents", "Document" ] )
+ def testLegacySearchReposPagination(self):
+ repos = self.g.legacy_search_repos("document")
+ self.assertListKeyBegin(repos, lambda r: r.name, ["git", "nimbus", "kss", "sstoolkit", "lawnchair", "appledoc", "jQ.Mobi", "ipython", "mongoengine", "ravendb", "substance", "symfony-docs", "JavaScript-Garden", "DocSets-for-iOS", "yard", "phpDocumentor2", "phpsh", "Tangle", "Ingredients", "documentjs", "xhp", "couchdb-lucene", "dox", "magento2", "javascriptmvc", "FastPdfKit", "roar", "DocumentUp", "NoRM", "jsdoc", "tagger", "mongodb-csharp", "php-github-api", "beautiful-docs", "mongodb-odm", "iodocs", "seesaw", "bcx-api", "developer.github.com", "amqp", "docsplit", "pycco", "standards-and-practices", "tidy-html5", "redis-doc", "tomdoc", "docs", "flourish", "userguide", "swagger-ui", "rfc", "Weasel-Diesel", "yuidoc", "apigen", "document-viewer", "develop.github.com", "Shanty-Mongo", "PTShowcaseViewController", "gravatar_image_tag", "api-wow-docs", "mongoid-tree", "safari-json-formatter", "mayan", "orm-documentation", "jsfiddle-docs-alpha", "core", "documentcloud", "flexible-nav", "writeCapture", "readium", "xmldocument", "Documentation-Examples", "grails-doc", "stdeb", "aws-autoscaling", "voteable_mongo", "review", "spreadsheet_on_rails", "UKSyntaxColoredTextDocument", "mandango", "bdoc", "Documentation", "documents.com", "rghost", "ticket_mule", "vendo", "khan-api", "spring-data-document-examples", "rspec_api_documentation", "axlsx", "phpdox", "documentation", "Sami", "innershiv", "doxyclean", "documents", "rvm-site", "jqapi", "documentation", "hadoopy", "VichUploaderBundle", "pdoc", "documentation", "wii-js", "oss-docs", "scala-maven-plugin", "Documents", "documenter", "behemoth", "documentation", "documentation", "propelorm.github.com", "Kobold2D", "AutoObjectDocumentation", "php-mongodb-admin", "django-mongokit", "puppet-docs", "docs", "Document", "vendorer", "symfony1-docs", "shocco", "documentation", "jog", "docs", "documentation", "documentation", "documentation", "documentation", "Documentation", "documentation", "documentation", "phpunit-documentation", "ADCtheme", "NelmioApiDocBundle", "iCloud-Singleton-CloudMe", "Documentation", "document", "document_mapper", "heroku-docs", "couchdb-odm", "documentation", "documentation", "document", "documentation", "NanoStore", "documentation", "Documentation", "documentation", "Documentation", "documentation", "document", "documentation", "documentation", "Documentation", "Documentation", "grendel", "ceylon-compiler", "mbtiles-spec", "documentation", "documents", "documents", "Documents", "Documentation", "documentation", "Documentation", "documentation", "documents", "Documentation", "documentation", "documentation", "documents", "Documentation", "documentation", "documenter", "documentation", "documents", "Documents", "documents", "documents", "documentation", "Document", "document", "rdoc", "mongoid_token", "travis-ci.github.com", "Documents", "Documents", "documents", "Document", "Documentation", "documents", "Documents", "Documentation", "documents", "documents", "documents", "documentation", "Documents", "Document", "documents", "documents", "Documentation", "Documentation", "Document", "documents", "Documents", "Documents", "Documentation", "Documents", "documents", "Documents", "document", "documents", "Documentation", "Documents", "documents", "documents", "Documents", "documents", "Documentation", "documentation", "Document", "Documents", "documents", "documents", "documents", "Documentation", "Documentation", "Documents", "Documents", "Documents", "Documenter", "document", "Documentation", "Documents", "Documents", "documentation", "documentation", "Document", "Documents", "Documentation", "Documentation", "Documents", "documents", "Documents", "document", "documentation", "Documents", "documentation", "documentation", "documentation", "Documentation", "Documents", "Documents", "documentation", "Documents", "Documents", "documentation", "documentation", "documents", "Documentation", "documents", "documentation", "Documentation", "Documents", "documentation", "documentation", "documents", "documentation", "Umbraco5Docs", "documents", "Documents", "Documentation", "documents", "document", "documents", "document", "documents", "documentation", "Documents", "documents", "document", "Documents", "Documentation", "Documentation", "documentation", "Documentation", "document", "documentation", "documents", "documents", "Documentations", "document", "documentation", "Documentation", "Document", "Documents", "Documents", "Document"])
- def testLegacySearchReposExplicitPagination( self ):
- repos = self.g.legacy_search_repos( "python" )
- self.assertEqual( [ r.name for r in repos.get_page( 4 ) ], [ "assetic", "cartodb", "cuisine", "gae-sessions", "geoalchemy2", "Multicorn", "wmfr-timeline", "redis-rdb-tools", "applet-workflows", "TweetBuff", "groovy-core", "StarTrekGame", "Nuevo", "Cupid", "node-sqlserver", "Magnet2Torrent", "GroundControl", "mock-django", "4bit", "mock-django", "Fabulous", "SFML", "pydicas", "flixel", "up", "mongrel2", "SimpleHTTPServerJs", "ultimos", "Archipel", "JSbooks", "nova", "nodebox", "simplehttp", "dablooms", "solarized", "landslide", "jQuery-File-Upload", "jQuery-File-Upload", "jQuery-File-Upload", "password-manager", "electrum", "twitter_nlp", "djangbone", "pyxfst", "node-gyp", "flare", "www.gittip.com", "wymeditor", "Kokobox", "MyCQ", "runwalk", "git-sweep", "HPCPythonSC2012", "sundown", "node2dm", "statirator", "fantastic-futures", "chainsaw", "itcursos-gerenciador-tarefas", "TideSDK", "genmaybot", "melpa", "ConnectedWire", "tarantool", "anserindicus_sn", "luvit", "Minecraft-Overviewer", "Iconic", "pyist.net", "wikibok", "mejorenvo-scraper", "NewsBlur", "SocketRocket", "spf13-vim", "IWantToWorkAtGloboCom", "ruby-style-guide", "aery32-refguide", "fafsite", "compsense_demo", "enaml", "mpi4py", "fi.pycon.org", "scikits-image", "scikits-image", "uni", "mako.vim", "mako.vim", "slumber", "de-composer", "nvm", "helloshopply", "Alianza", "vimfiles", "socorro-crashstats", "menu", "analytics", "elFinder", "riak_wiki", "livestreamer", "git-goggles" ] )
+ def testLegacySearchReposExplicitPagination(self):
+ repos = self.g.legacy_search_repos("python")
+ self.assertEqual([r.name for r in repos.get_page(4)], ["assetic", "cartodb", "cuisine", "gae-sessions", "geoalchemy2", "Multicorn", "wmfr-timeline", "redis-rdb-tools", "applet-workflows", "TweetBuff", "groovy-core", "StarTrekGame", "Nuevo", "Cupid", "node-sqlserver", "Magnet2Torrent", "GroundControl", "mock-django", "4bit", "mock-django", "Fabulous", "SFML", "pydicas", "flixel", "up", "mongrel2", "SimpleHTTPServerJs", "ultimos", "Archipel", "JSbooks", "nova", "nodebox", "simplehttp", "dablooms", "solarized", "landslide", "jQuery-File-Upload", "jQuery-File-Upload", "jQuery-File-Upload", "password-manager", "electrum", "twitter_nlp", "djangbone", "pyxfst", "node-gyp", "flare", "www.gittip.com", "wymeditor", "Kokobox", "MyCQ", "runwalk", "git-sweep", "HPCPythonSC2012", "sundown", "node2dm", "statirator", "fantastic-futures", "chainsaw", "itcursos-gerenciador-tarefas", "TideSDK", "genmaybot", "melpa", "ConnectedWire", "tarantool", "anserindicus_sn", "luvit", "Minecraft-Overviewer", "Iconic", "pyist.net", "wikibok", "mejorenvo-scraper", "NewsBlur", "SocketRocket", "spf13-vim", "IWantToWorkAtGloboCom", "ruby-style-guide", "aery32-refguide", "fafsite", "compsense_demo", "enaml", "mpi4py", "fi.pycon.org", "scikits-image", "scikits-image", "uni", "mako.vim", "mako.vim", "slumber", "de-composer", "nvm", "helloshopply", "Alianza", "vimfiles", "socorro-crashstats", "menu", "analytics", "elFinder", "riak_wiki", "livestreamer", "git-goggles"])
- def testLegacySearchReposWithLanguage( self ):
- repos = self.g.legacy_search_repos( "document", language = "Python" )
- self.assertListKeyBegin( repos, lambda r: r.name, [ "ipython", "mongoengine", "tagger" ] )
- self.assertEqual( repos[ 0 ].full_name, "ipython/ipython" )
+ def testLegacySearchReposWithLanguage(self):
+ repos = self.g.legacy_search_repos("document", language="Python")
+ self.assertListKeyBegin(repos, lambda r: r.name, ["ipython", "mongoengine", "tagger"])
+ self.assertEqual(repos[0].full_name, "ipython/ipython")
- def testLegacySearchUsers( self ):
- users = self.g.legacy_search_users( "vincent" )
- self.assertListKeyBegin( users, lambda u: u.login, [ "nvie", "obra", "lusis" ] )
+ def testLegacySearchUsers(self):
+ users = self.g.legacy_search_users("vincent")
+ self.assertListKeyBegin(users, lambda u: u.login, ["nvie", "obra", "lusis"])
# Attributes retrieved from legacy API without lazy completion call
- self.assertEqual( users[ 0 ].gravatar_id, "c5a7f21b46df698f3db31c37ed0cf55a" )
- self.assertEqual( users[ 0 ].name, "Vincent Driessen" )
- self.assertEqual( users[ 0 ].created_at, datetime.datetime( 2009, 5, 12, 21, 19, 38 ) )
- self.assertEqual( users[ 0 ].location, "Netherlands" )
- self.assertEqual( users[ 0 ].followers, 310 )
- self.assertEqual( users[ 0 ].public_repos, 63 )
- self.assertEqual( users[ 0 ].login, "nvie" )
+ self.assertEqual(users[0].gravatar_id, "c5a7f21b46df698f3db31c37ed0cf55a")
+ self.assertEqual(users[0].name, "Vincent Driessen")
+ self.assertEqual(users[0].created_at, datetime.datetime(2009, 5, 12, 21, 19, 38))
+ self.assertEqual(users[0].location, "Netherlands")
+ self.assertEqual(users[0].followers, 310)
+ self.assertEqual(users[0].public_repos, 63)
+ self.assertEqual(users[0].login, "nvie")
- def testLegacySearchUsersPagination( self ):
- self.assertEqual( len( list( self.g.legacy_search_users( "Lucy" ) ) ), 146 )
+ def testLegacySearchUsersPagination(self):
+ self.assertEqual(len(list(self.g.legacy_search_users("Lucy"))), 146)
- def testLegacySearchUsersExplicitPagination( self ):
- users = self.g.legacy_search_users( "Lucy" )
- self.assertEqual( [ u.login for u in users.get_page( 1 ) ], [ "lucievh", "lucyim", "Lucief", "RevolverUpstairs", "seriousprogramming", "reicul", "davincidubai", "LucianaNascimentodoPrado", "lucia-huenchunao", "kraji20", "Lucywolo", "Luciel", "sunnysummer", "elush", "oprealuci", "Flika", "lsher", "datadrivenjournalism", "nill2020", "doobi", "lucilu", "deldeldel", "lucianacocca", "lucyli-sfdc", "lucysatchell", "UBM", "kolousek", "lucyzhang", "lmegia", "luisolivo", "Lucyzhen", "Luhzinha", "beautifly", "lucybm96", "BuonocoreL", "lucywilliams", "ZxOxZ", "Motwinb", "johnlucy", "Aquanimation", "alaltaieri", "lucylin", "lucychambers", "JuanSesma", "cdwwebware", "ZachWills" ] )
+ def testLegacySearchUsersExplicitPagination(self):
+ users = self.g.legacy_search_users("Lucy")
+ self.assertEqual([u.login for u in users.get_page(1)], ["lucievh", "lucyim", "Lucief", "RevolverUpstairs", "seriousprogramming", "reicul", "davincidubai", "LucianaNascimentodoPrado", "lucia-huenchunao", "kraji20", "Lucywolo", "Luciel", "sunnysummer", "elush", "oprealuci", "Flika", "lsher", "datadrivenjournalism", "nill2020", "doobi", "lucilu", "deldeldel", "lucianacocca", "lucyli-sfdc", "lucysatchell", "UBM", "kolousek", "lucyzhang", "lmegia", "luisolivo", "Lucyzhen", "Luhzinha", "beautifly", "lucybm96", "BuonocoreL", "lucywilliams", "ZxOxZ", "Motwinb", "johnlucy", "Aquanimation", "alaltaieri", "lucylin", "lucychambers", "JuanSesma", "cdwwebware", "ZachWills"])
- def testLegacySearchUserByEmail( self ):
- user = self.g.legacy_search_user_by_email( "vincent@vincent-jacques.net" )
- self.assertEqual( user.login, "jacquev6" )
- self.assertEqual( user.followers, 13 )
+ def testLegacySearchUserByEmail(self):
+ user = self.g.legacy_search_user_by_email("vincent@vincent-jacques.net")
+ self.assertEqual(user.login, "jacquev6")
+ self.assertEqual(user.followers, 13)
- def testGetHooks( self ):
+ def testGetHooks(self):
hooks = self.g.get_hooks()
- hook = hooks[ 0 ]
- self.assertEqual( hook.name, "activecollab" )
- 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" ] ] )
+ hook = hooks[0]
+ self.assertEqual(hook.name, "activecollab")
+ 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"]])
diff --git a/github/tests/Hook.py b/github/tests/Hook.py
index f3b3c8b3..38e114a2 100644
--- a/github/tests/Hook.py
+++ b/github/tests/Hook.py
@@ -15,41 +15,42 @@ import Framework
import datetime
-class Hook( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.hook = self.g.get_user().get_repo( "PyGithub" ).get_hook( 257993 )
- def testAttributes( self ):
- self.assertEqual( self.hook.active, True ) # WTF
- self.assertEqual( self.hook.config, { "url": "http://foobar.com" } )
- self.assertEqual( self.hook.created_at, datetime.datetime( 2012, 5, 19, 6, 1, 45 ) )
- self.assertEqual( self.hook.events, [ "push" ] )
- self.assertEqual( self.hook.id, 257993 )
- self.assertEqual( self.hook.last_response.status, "ok" )
- self.assertEqual( self.hook.last_response.message, "OK" )
- self.assertEqual( self.hook.last_response.code, 200 )
- self.assertEqual( self.hook.name, "web" )
- self.assertEqual( self.hook.updated_at, datetime.datetime( 2012, 5, 29, 18, 49, 47 ) )
- self.assertEqual( self.hook.url, "https://api.github.com/repos/jacquev6/PyGithub/hooks/257993" )
+class Hook(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.hook = self.g.get_user().get_repo("PyGithub").get_hook(257993)
- def testEditWithMinimalParameters( self ):
- self.hook.edit( "web", { "url": "http://foobar.com/hook" } )
- self.assertEqual( self.hook.config, { "url": "http://foobar.com/hook" } )
- self.assertEqual( self.hook.updated_at, datetime.datetime( 2012, 5, 19, 5, 8, 16 ) )
+ def testAttributes(self):
+ self.assertEqual(self.hook.active, True) # WTF
+ self.assertEqual(self.hook.config, {"url": "http://foobar.com"})
+ self.assertEqual(self.hook.created_at, datetime.datetime(2012, 5, 19, 6, 1, 45))
+ self.assertEqual(self.hook.events, ["push"])
+ self.assertEqual(self.hook.id, 257993)
+ self.assertEqual(self.hook.last_response.status, "ok")
+ self.assertEqual(self.hook.last_response.message, "OK")
+ self.assertEqual(self.hook.last_response.code, 200)
+ self.assertEqual(self.hook.name, "web")
+ self.assertEqual(self.hook.updated_at, datetime.datetime(2012, 5, 29, 18, 49, 47))
+ self.assertEqual(self.hook.url, "https://api.github.com/repos/jacquev6/PyGithub/hooks/257993")
- def testDelete( self ):
+ def testEditWithMinimalParameters(self):
+ self.hook.edit("web", {"url": "http://foobar.com/hook"})
+ self.assertEqual(self.hook.config, {"url": "http://foobar.com/hook"})
+ self.assertEqual(self.hook.updated_at, datetime.datetime(2012, 5, 19, 5, 8, 16))
+
+ def testDelete(self):
self.hook.delete()
- def testTest( self ):
- self.hook.test() # This does not update attributes of hook
+ def testTest(self):
+ self.hook.test() # This does not update attributes of hook
- def testEditWithAllParameters( self ):
- self.hook.edit( "web", { "url": "http://foobar.com" }, events = [ "fork", "push" ] )
- self.assertEqual( self.hook.events, [ "fork", "push" ] )
- self.hook.edit( "web", { "url": "http://foobar.com" }, add_events = [ "push" ] )
- self.assertEqual( self.hook.events, [ "fork", "push" ] )
- self.hook.edit( "web", { "url": "http://foobar.com" }, remove_events = [ "fork" ] )
- self.assertEqual( self.hook.events, [ "push" ] )
- self.hook.edit( "web", { "url": "http://foobar.com" }, active = True )
- self.assertEqual( self.hook.active, True )
+ def testEditWithAllParameters(self):
+ self.hook.edit("web", {"url": "http://foobar.com"}, events=["fork", "push"])
+ self.assertEqual(self.hook.events, ["fork", "push"])
+ self.hook.edit("web", {"url": "http://foobar.com"}, add_events=["push"])
+ self.assertEqual(self.hook.events, ["fork", "push"])
+ self.hook.edit("web", {"url": "http://foobar.com"}, remove_events=["fork"])
+ self.assertEqual(self.hook.events, ["push"])
+ self.hook.edit("web", {"url": "http://foobar.com"}, active=True)
+ self.assertEqual(self.hook.active, True)
diff --git a/github/tests/IntegrationTest.py b/github/tests/IntegrationTest.py
index 9e5cb5b7..a7ff3600 100755
--- a/github/tests/IntegrationTest.py
+++ b/github/tests/IntegrationTest.py
@@ -15,6 +15,7 @@
import Framework
+
from AuthenticatedUser import *
from Authentication import *
from Authorization import *
diff --git a/github/tests/Issue.py b/github/tests/Issue.py
index 6ee4871d..95eec520 100644
--- a/github/tests/Issue.py
+++ b/github/tests/Issue.py
@@ -15,85 +15,86 @@ import Framework
import datetime
-class Issue( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.repo = self.g.get_user().get_repo( "PyGithub" )
- self.issue = self.repo.get_issue( 28 )
- def testAttributes( self ):
- self.assertEqual( self.issue.assignee.login, "jacquev6" )
- self.assertEqual( self.issue.body, "Body edited by PyGithub" )
- self.assertEqual( self.issue.closed_at, datetime.datetime( 2012, 5, 26, 14, 59, 33 ) )
- self.assertEqual( self.issue.closed_by.login, "jacquev6" )
- self.assertEqual( self.issue.comments, 0 )
- self.assertEqual( self.issue.created_at, datetime.datetime( 2012, 5, 19, 10, 38, 23 ) )
- self.assertEqual( self.issue.html_url, "https://github.com/jacquev6/PyGithub/issues/28" )
- self.assertEqual( self.issue.id, 4653757 )
- self.assertListKeyEqual( self.issue.labels, lambda l: l.name, [ "Bug", "Project management", "Question" ] )
- self.assertEqual( self.issue.milestone.title, "Version 0.4" )
- self.assertEqual( self.issue.number, 28 )
- self.assertEqual( self.issue.pull_request.diff_url, None )
- self.assertEqual( self.issue.pull_request.patch_url, None )
- self.assertEqual( self.issue.pull_request.html_url, None )
- self.assertEqual( self.issue.state, "closed" )
- self.assertEqual( self.issue.title, "Issue created by PyGithub" )
- self.assertEqual( self.issue.updated_at, datetime.datetime( 2012, 5, 26, 14, 59, 33 ) )
- self.assertEqual( self.issue.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/28" )
- self.assertEqual( self.issue.user.login, "jacquev6" )
+class Issue(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.repo = self.g.get_user().get_repo("PyGithub")
+ self.issue = self.repo.get_issue(28)
- def testEditWithoutParameters( self ):
+ def testAttributes(self):
+ self.assertEqual(self.issue.assignee.login, "jacquev6")
+ self.assertEqual(self.issue.body, "Body edited by PyGithub")
+ self.assertEqual(self.issue.closed_at, datetime.datetime(2012, 5, 26, 14, 59, 33))
+ self.assertEqual(self.issue.closed_by.login, "jacquev6")
+ self.assertEqual(self.issue.comments, 0)
+ self.assertEqual(self.issue.created_at, datetime.datetime(2012, 5, 19, 10, 38, 23))
+ self.assertEqual(self.issue.html_url, "https://github.com/jacquev6/PyGithub/issues/28")
+ self.assertEqual(self.issue.id, 4653757)
+ self.assertListKeyEqual(self.issue.labels, lambda l: l.name, ["Bug", "Project management", "Question"])
+ self.assertEqual(self.issue.milestone.title, "Version 0.4")
+ self.assertEqual(self.issue.number, 28)
+ self.assertEqual(self.issue.pull_request.diff_url, None)
+ self.assertEqual(self.issue.pull_request.patch_url, None)
+ self.assertEqual(self.issue.pull_request.html_url, None)
+ self.assertEqual(self.issue.state, "closed")
+ self.assertEqual(self.issue.title, "Issue created by PyGithub")
+ self.assertEqual(self.issue.updated_at, datetime.datetime(2012, 5, 26, 14, 59, 33))
+ self.assertEqual(self.issue.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/28")
+ self.assertEqual(self.issue.user.login, "jacquev6")
+
+ def testEditWithoutParameters(self):
self.issue.edit()
- def testEditWithAllParameters( self ):
- user = self.g.get_user( "jacquev6" )
- milestone = self.repo.get_milestone( 2 )
- self.issue.edit( "Title edited by PyGithub", "Body edited by PyGithub", user, "open", milestone, [ "Bug" ] )
- self.assertEqual( self.issue.assignee.login, "jacquev6" )
- self.assertEqual( self.issue.body, "Body edited by PyGithub" )
- self.assertEqual( self.issue.state, "open" )
- self.assertEqual( self.issue.title, "Title edited by PyGithub" )
- self.assertListKeyEqual( self.issue.labels, lambda l: l.name, [ "Bug" ] )
+ def testEditWithAllParameters(self):
+ user = self.g.get_user("jacquev6")
+ milestone = self.repo.get_milestone(2)
+ self.issue.edit("Title edited by PyGithub", "Body edited by PyGithub", user, "open", milestone, ["Bug"])
+ self.assertEqual(self.issue.assignee.login, "jacquev6")
+ self.assertEqual(self.issue.body, "Body edited by PyGithub")
+ self.assertEqual(self.issue.state, "open")
+ self.assertEqual(self.issue.title, "Title edited by PyGithub")
+ self.assertListKeyEqual(self.issue.labels, lambda l: l.name, ["Bug"])
- def testEditResetMilestone( self ):
- self.assertEqual( self.issue.milestone.title, "Version 0.4" )
- self.issue.edit( milestone = None )
- self.assertEqual( self.issue.milestone, None )
+ def testEditResetMilestone(self):
+ self.assertEqual(self.issue.milestone.title, "Version 0.4")
+ self.issue.edit(milestone=None)
+ self.assertEqual(self.issue.milestone, None)
- def testEditResetAssignee( self ):
- self.assertEqual( self.issue.assignee.login, "jacquev6" )
- self.issue.edit( assignee = None )
- self.assertEqual( self.issue.assignee, None )
+ def testEditResetAssignee(self):
+ self.assertEqual(self.issue.assignee.login, "jacquev6")
+ self.issue.edit(assignee=None)
+ self.assertEqual(self.issue.assignee, None)
- def testCreateComment( self ):
- comment = self.issue.create_comment( "Comment created by PyGithub" )
- self.assertEqual( comment.id, 5808311 )
+ def testCreateComment(self):
+ comment = self.issue.create_comment("Comment created by PyGithub")
+ self.assertEqual(comment.id, 5808311)
- def testGetComments( self ):
- self.assertListKeyEqual( self.issue.get_comments(), lambda c: c.user.login, [ "jacquev6", "roskakori" ] )
+ def testGetComments(self):
+ self.assertListKeyEqual(self.issue.get_comments(), lambda c: c.user.login, ["jacquev6", "roskakori"])
- def testGetEvents( self ):
- self.assertListKeyEqual( self.issue.get_events(), lambda e: e.id, [ 15819975, 15820048 ] )
+ def testGetEvents(self):
+ self.assertListKeyEqual(self.issue.get_events(), lambda e: e.id, [15819975, 15820048])
- def testGetLabels( self ):
- self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Project management", "Question" ] )
+ def testGetLabels(self):
+ self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Project management", "Question"])
- def testAddAndRemoveLabels( self ):
- bug = self.repo.get_label( "Bug" )
- question = self.repo.get_label( "Question" )
- self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Project management", "Question" ] )
- self.issue.remove_from_labels( bug )
- self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Project management", "Question" ] )
- self.issue.remove_from_labels( question )
- self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Project management" ] )
- self.issue.add_to_labels( bug, question )
- self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Project management", "Question" ] )
+ def testAddAndRemoveLabels(self):
+ bug = self.repo.get_label("Bug")
+ question = self.repo.get_label("Question")
+ self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Project management", "Question"])
+ self.issue.remove_from_labels(bug)
+ self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Project management", "Question"])
+ self.issue.remove_from_labels(question)
+ self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Project management"])
+ self.issue.add_to_labels(bug, question)
+ self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Project management", "Question"])
- def testDeleteAndSetLabels( self ):
- bug = self.repo.get_label( "Bug" )
- question = self.repo.get_label( "Question" )
- self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Project management", "Question" ] )
+ def testDeleteAndSetLabels(self):
+ bug = self.repo.get_label("Bug")
+ question = self.repo.get_label("Question")
+ self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Project management", "Question"])
self.issue.delete_labels()
- self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [] )
- self.issue.set_labels( bug, question )
- self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Question" ] )
+ self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, [])
+ self.issue.set_labels(bug, question)
+ self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Question"])
diff --git a/github/tests/Issue33.py b/github/tests/Issue33.py
index c5e9ac0f..2e29d2e1 100644
--- a/github/tests/Issue33.py
+++ b/github/tests/Issue33.py
@@ -13,13 +13,14 @@
import Framework
-class Issue33( Framework.TestCase ): # https://github.com/jacquev6/PyGithub/issues/33
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.repo = self.g.get_user( "openframeworks" ).get_repo( "openFrameworks" )
- def testOpenIssues( self ):
- self.assertEqual( len( list( self.repo.get_issues() ) ), 338 )
+class Issue33(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/33
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.repo = self.g.get_user("openframeworks").get_repo("openFrameworks")
- def testClosedIssues( self ):
- self.assertEqual( len( list( self.repo.get_issues( state = "closed" ) ) ), 950 )
+ def testOpenIssues(self):
+ self.assertEqual(len(list(self.repo.get_issues())), 338)
+
+ def testClosedIssues(self):
+ self.assertEqual(len(list(self.repo.get_issues(state="closed"))), 950)
diff --git a/github/tests/Issue50.py b/github/tests/Issue50.py
index e4dbf492..519a2195 100644
--- a/github/tests/Issue50.py
+++ b/github/tests/Issue50.py
@@ -15,43 +15,44 @@ import github
import Framework
-class Issue50( Framework.TestCase ): # https://github.com/jacquev6/PyGithub/issues/50
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.repo = self.g.get_user().get_repo( "PyGithub" )
- self.issue = self.repo.get_issue( 50 )
+
+class Issue50(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/50
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.repo = self.g.get_user().get_repo("PyGithub")
+ self.issue = self.repo.get_issue(50)
self.labelName = "Label with spaces and strange characters (&*#$)"
- def testCreateLabel( self ):
- label = self.repo.create_label( self.labelName, "ffff00" )
- self.assertEqual( label.name, self.labelName )
+ def testCreateLabel(self):
+ label = self.repo.create_label(self.labelName, "ffff00")
+ self.assertEqual(label.name, self.labelName)
- def testGetLabel( self ):
- label = self.repo.get_label( self.labelName )
- self.assertEqual( label.name, self.labelName )
+ def testGetLabel(self):
+ label = self.repo.get_label(self.labelName)
+ self.assertEqual(label.name, self.labelName)
- def testGetLabels( self ):
- self.assertListKeyEqual( self.repo.get_labels(), lambda l: l.name, [ "Refactoring", "Public interface", "Functionalities", "Project management", "Bug", "Question", "RequestedByUser", self.labelName ] )
+ def testGetLabels(self):
+ self.assertListKeyEqual(self.repo.get_labels(), lambda l: l.name, ["Refactoring", "Public interface", "Functionalities", "Project management", "Bug", "Question", "RequestedByUser", self.labelName])
- def testAddLabelToIssue( self ):
- self.issue.add_to_labels( self.repo.get_label( self.labelName ) )
+ def testAddLabelToIssue(self):
+ self.issue.add_to_labels(self.repo.get_label(self.labelName))
- def testRemoveLabelFromIssue( self ):
- self.issue.remove_from_labels( self.repo.get_label( self.labelName ) )
+ def testRemoveLabelFromIssue(self):
+ self.issue.remove_from_labels(self.repo.get_label(self.labelName))
- def testSetIssueLabels( self ):
- self.issue.set_labels( self.repo.get_label( "Bug" ), self.repo.get_label( "RequestedByUser" ), self.repo.get_label( self.labelName ) )
+ def testSetIssueLabels(self):
+ self.issue.set_labels(self.repo.get_label("Bug"), self.repo.get_label("RequestedByUser"), self.repo.get_label(self.labelName))
- def testIssueLabels( self ):
- self.assertListKeyEqual( self.issue.labels, lambda l: l.name, [ "Bug", self.labelName, "RequestedByUser" ] )
+ def testIssueLabels(self):
+ self.assertListKeyEqual(self.issue.labels, lambda l: l.name, ["Bug", self.labelName, "RequestedByUser"])
- def testIssueGetLabels( self ):
- self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", self.labelName, "RequestedByUser" ] )
+ def testIssueGetLabels(self):
+ self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", self.labelName, "RequestedByUser"])
- def testGetIssuesWithLabel( self ):
- self.assertListKeyEqual( self.repo.get_issues( labels = [ self.repo.get_label( self.labelName ) ] ), lambda i: i.number, [ 52, 50 ] )
+ def testGetIssuesWithLabel(self):
+ self.assertListKeyEqual(self.repo.get_issues(labels=[self.repo.get_label(self.labelName)]), lambda i: i.number, [52, 50])
- def testCreateIssueWithLabel( self ):
- issue = self.repo.create_issue( "Issue created by PyGithub to test issue #50", labels = [ self.repo.get_label( self.labelName ) ] )
- self.assertListKeyEqual( issue.labels, lambda l: l.name, [ self.labelName ] )
- self.assertEqual( issue.number, 52 )
+ def testCreateIssueWithLabel(self):
+ issue = self.repo.create_issue("Issue created by PyGithub to test issue #50", labels=[self.repo.get_label(self.labelName)])
+ self.assertListKeyEqual(issue.labels, lambda l: l.name, [self.labelName])
+ self.assertEqual(issue.number, 52)
diff --git a/github/tests/Issue54.py b/github/tests/Issue54.py
index c759831d..a8d0888a 100644
--- a/github/tests/Issue54.py
+++ b/github/tests/Issue54.py
@@ -15,12 +15,13 @@ import datetime
import Framework
-class Issue54( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.repo = self.g.get_user().get_repo( "TestRepo" )
- def testConversion( self ):
- commit = self.repo.get_git_commit( "73f320ae06cd565cf38faca34b6a482addfc721b" )
- self.assertEqual( commit.message, "Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n" )
- self.assertEqual( commit.author.date, datetime.datetime( 2012, 7, 13, 18, 47, 10 ) )
+class Issue54(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.repo = self.g.get_user().get_repo("TestRepo")
+
+ def testConversion(self):
+ commit = self.repo.get_git_commit("73f320ae06cd565cf38faca34b6a482addfc721b")
+ self.assertEqual(commit.message, "Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n")
+ self.assertEqual(commit.author.date, datetime.datetime(2012, 7, 13, 18, 47, 10))
diff --git a/github/tests/Issue80.py b/github/tests/Issue80.py
index b51841bf..d5a63322 100644
--- a/github/tests/Issue80.py
+++ b/github/tests/Issue80.py
@@ -15,15 +15,16 @@ import github
import Framework
-class Issue80( Framework.BasicTestCase ): # https://github.com/jacquev6/PyGithub/issues/80
- def testIgnoreHttpsFromGithubEnterprise( self ):
- g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com/some/prefix" ) # http here
- org = g.get_organization( "BeaverSoftware" )
- self.assertEqual( org.url, "https://my.enterprise.com/some/prefix/orgs/BeaverSoftware" ) # https returned
- self.assertListKeyEqual( org.get_repos(), lambda r: r.name, [ "FatherBeaver", "TestPyGithub" ] ) # But still http in second request based on org.url
- def testIgnoreHttpsFromGithubEnterpriseWithPort( self ):
- g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com:1234/some/prefix" ) # http here
- org = g.get_organization( "BeaverSoftware" )
- self.assertEqual( org.url, "https://my.enterprise.com:1234/some/prefix/orgs/BeaverSoftware" ) # https returned
- self.assertListKeyEqual( org.get_repos(), lambda r: r.name, [ "FatherBeaver", "TestPyGithub" ] ) # But still http in second request based on org.url
+class Issue80(Framework.BasicTestCase): # https://github.com/jacquev6/PyGithub/issues/80
+ def testIgnoreHttpsFromGithubEnterprise(self):
+ g = github.Github(self.login, self.password, base_url="http://my.enterprise.com/some/prefix") # http here
+ org = g.get_organization("BeaverSoftware")
+ self.assertEqual(org.url, "https://my.enterprise.com/some/prefix/orgs/BeaverSoftware") # https returned
+ self.assertListKeyEqual(org.get_repos(), lambda r: r.name, ["FatherBeaver", "TestPyGithub"]) # But still http in second request based on org.url
+
+ def testIgnoreHttpsFromGithubEnterpriseWithPort(self):
+ g = github.Github(self.login, self.password, base_url="http://my.enterprise.com:1234/some/prefix") # http here
+ org = g.get_organization("BeaverSoftware")
+ self.assertEqual(org.url, "https://my.enterprise.com:1234/some/prefix/orgs/BeaverSoftware") # https returned
+ self.assertListKeyEqual(org.get_repos(), lambda r: r.name, ["FatherBeaver", "TestPyGithub"]) # But still http in second request based on org.url
diff --git a/github/tests/IssueComment.py b/github/tests/IssueComment.py
index c919928c..6090b4d0 100644
--- a/github/tests/IssueComment.py
+++ b/github/tests/IssueComment.py
@@ -15,23 +15,24 @@ import Framework
import datetime
-class IssueComment( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.comment = self.g.get_user().get_repo( "PyGithub" ).get_issue( 28 ).get_comment( 5808311 )
- def testAttributes( self ):
- self.assertEqual( self.comment.body, "Comment created by PyGithub" )
- self.assertEqual( self.comment.created_at, datetime.datetime( 2012, 5, 20, 11, 46, 42 ) )
- self.assertEqual( self.comment.id, 5808311 )
- self.assertEqual( self.comment.updated_at, datetime.datetime( 2012, 5, 20, 11, 46, 42 ) )
- self.assertEqual( self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5808311" )
- self.assertEqual( self.comment.user.login, "jacquev6" )
+class IssueComment(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.comment = self.g.get_user().get_repo("PyGithub").get_issue(28).get_comment(5808311)
- def testEdit( self ):
- self.comment.edit( "Comment edited by PyGithub" )
- self.assertEqual( self.comment.body, "Comment edited by PyGithub" )
- self.assertEqual( self.comment.updated_at, datetime.datetime( 2012, 5, 20, 11, 53, 59 ) )
+ def testAttributes(self):
+ self.assertEqual(self.comment.body, "Comment created by PyGithub")
+ self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 20, 11, 46, 42))
+ self.assertEqual(self.comment.id, 5808311)
+ self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 20, 11, 46, 42))
+ self.assertEqual(self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5808311")
+ self.assertEqual(self.comment.user.login, "jacquev6")
- def testDelete( self ):
+ def testEdit(self):
+ self.comment.edit("Comment edited by PyGithub")
+ self.assertEqual(self.comment.body, "Comment edited by PyGithub")
+ self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 20, 11, 53, 59))
+
+ def testDelete(self):
self.comment.delete()
diff --git a/github/tests/IssueEvent.py b/github/tests/IssueEvent.py
index 200795f6..688508b8 100644
--- a/github/tests/IssueEvent.py
+++ b/github/tests/IssueEvent.py
@@ -15,16 +15,17 @@ import Framework
import datetime
-class IssueEvent( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.event = self.g.get_user().get_repo( "PyGithub" ).get_issues_event( 16348656 )
- def testAttributes( self ):
- self.assertEqual( self.event.actor.login, "jacquev6" )
- self.assertEqual( self.event.commit_id, "ed866fc43833802ab553e5ff8581c81bb00dd433" )
- self.assertEqual( self.event.created_at, datetime.datetime( 2012, 5, 27, 7, 29, 25 ) )
- self.assertEqual( self.event.event, "referenced" )
- self.assertEqual( self.event.id, 16348656 )
- self.assertEqual( self.event.issue.number, 30 )
- self.assertEqual( self.event.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656" )
+class IssueEvent(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.event = self.g.get_user().get_repo("PyGithub").get_issues_event(16348656)
+
+ def testAttributes(self):
+ self.assertEqual(self.event.actor.login, "jacquev6")
+ self.assertEqual(self.event.commit_id, "ed866fc43833802ab553e5ff8581c81bb00dd433")
+ self.assertEqual(self.event.created_at, datetime.datetime(2012, 5, 27, 7, 29, 25))
+ self.assertEqual(self.event.event, "referenced")
+ self.assertEqual(self.event.id, 16348656)
+ self.assertEqual(self.event.issue.number, 30)
+ self.assertEqual(self.event.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656")
diff --git a/github/tests/Label.py b/github/tests/Label.py
index 0e1c1ee4..4be91a16 100644
--- a/github/tests/Label.py
+++ b/github/tests/Label.py
@@ -13,21 +13,22 @@
import Framework
-class Label( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.label = self.g.get_user().get_repo( "PyGithub" ).get_label( "Bug" )
- def testAttributes( self ):
- self.assertEqual( self.label.color, "e10c02" )
- self.assertEqual( self.label.name, "Bug" )
- self.assertEqual( self.label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Bug" )
+class Label(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.label = self.g.get_user().get_repo("PyGithub").get_label("Bug")
- def testEdit( self ):
- self.label.edit( "LabelEditedByPyGithub", "0000ff" )
- self.assertEqual( self.label.color, "0000ff" )
- self.assertEqual( self.label.name, "LabelEditedByPyGithub" )
- self.assertEqual( self.label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/LabelEditedByPyGithub" )
+ def testAttributes(self):
+ self.assertEqual(self.label.color, "e10c02")
+ self.assertEqual(self.label.name, "Bug")
+ self.assertEqual(self.label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Bug")
- def testDelete( self ):
+ def testEdit(self):
+ self.label.edit("LabelEditedByPyGithub", "0000ff")
+ self.assertEqual(self.label.color, "0000ff")
+ self.assertEqual(self.label.name, "LabelEditedByPyGithub")
+ self.assertEqual(self.label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/LabelEditedByPyGithub")
+
+ def testDelete(self):
self.label.delete()
diff --git a/github/tests/Logging.py b/github/tests/Logging.py
index 8f1b1ee3..f5ae745a 100644
--- a/github/tests/Logging.py
+++ b/github/tests/Logging.py
@@ -17,21 +17,22 @@ import github
import Framework
-class Logging( Framework.TestCase ):
+
+class Logging(Framework.TestCase):
class MockHandler:
- def __init__( self ):
+ def __init__(self):
self.level = logging.DEBUG
self.handled = None
- def handle( self, record ):
+ def handle(self, record):
self.handled = record.getMessage()
- def testLogging( self ):
+ def testLogging(self):
self.maxDiff = None
logger = github.get_logger()
- logger.setLevel( logging.DEBUG )
+ logger.setLevel(logging.DEBUG)
handler = self.MockHandler()
- logger.addHandler( handler )
-
- self.assertEqual( self.g.get_user().name, "Vincent Jacques" )
- self.assertEqual( handler.handled, u'GET https://api.github.com/user None None ==> 200 {\'status\': \'200 OK\', \'content-length\': \'806\', \'x-github-media-type\': \'github.beta; format=json\', \'x-content-type-options\': \'nosniff\', \'vary\': \'Accept, Authorization, Cookie\', \'x-ratelimit-remaining\': \'4993\', \'server\': \'nginx\', \'last-modified\': \'Fri, 14 Sep 2012 18:47:46 GMT\', \'connection\': \'keep-alive\', \'x-ratelimit-limit\': \'5000\', \'etag\': \'"434dfe5d3f50558fe3cea087cb95c401"\', \'cache-control\': \'private, s-maxage=60, max-age=60\', \'date\': \'Mon, 17 Sep 2012 17:12:32 GMT\', \'content-type\': \'application/json; charset=utf-8\'} {"owned_private_repos":3,"disk_usage":18612,"following":28,"type":"User","public_repos":13,"location":"Paris, France","company":"Criteo","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","plan":{"space":614400,"private_repos":5,"name":"micro","collaborators":1},"blog":"http://vincent-jacques.net","login":"jacquev6","public_gists":3,"html_url":"https://github.com/jacquev6","hireable":false,"created_at":"2010-07-09T06:10:06Z","private_gists":5,"followers":13,"name":"Vincent Jacques","email":"vincent@vincent-jacques.net","bio":"","total_private_repos":3,"collaborators":0,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"url":"https://api.github.com/users/jacquev6"}' )
+ logger.addHandler(handler)
+
+ self.assertEqual(self.g.get_user().name, "Vincent Jacques")
+ self.assertEqual(handler.handled, u'GET https://api.github.com/user None None ==> 200 {\'status\': \'200 OK\', \'content-length\': \'806\', \'x-github-media-type\': \'github.beta; format=json\', \'x-content-type-options\': \'nosniff\', \'vary\': \'Accept, Authorization, Cookie\', \'x-ratelimit-remaining\': \'4993\', \'server\': \'nginx\', \'last-modified\': \'Fri, 14 Sep 2012 18:47:46 GMT\', \'connection\': \'keep-alive\', \'x-ratelimit-limit\': \'5000\', \'etag\': \'"434dfe5d3f50558fe3cea087cb95c401"\', \'cache-control\': \'private, s-maxage=60, max-age=60\', \'date\': \'Mon, 17 Sep 2012 17:12:32 GMT\', \'content-type\': \'application/json; charset=utf-8\'} {"owned_private_repos":3,"disk_usage":18612,"following":28,"type":"User","public_repos":13,"location":"Paris, France","company":"Criteo","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","plan":{"space":614400,"private_repos":5,"name":"micro","collaborators":1},"blog":"http://vincent-jacques.net","login":"jacquev6","public_gists":3,"html_url":"https://github.com/jacquev6","hireable":false,"created_at":"2010-07-09T06:10:06Z","private_gists":5,"followers":13,"name":"Vincent Jacques","email":"vincent@vincent-jacques.net","bio":"","total_private_repos":3,"collaborators":0,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"url":"https://api.github.com/users/jacquev6"}')
diff --git a/github/tests/Markdown.py b/github/tests/Markdown.py
index bab5ff01..a9bc2dd8 100644
--- a/github/tests/Markdown.py
+++ b/github/tests/Markdown.py
@@ -13,14 +13,15 @@
import Framework
-class Markdown( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
+
+class Markdown(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
self.text = "MyTitle\n=======\n\nIssue #1"
- self.repo = self.g.get_user().get_repo( "PyGithub" )
+ self.repo = self.g.get_user().get_repo("PyGithub")
- def testRenderMarkdown( self ):
- self.assertEqual( self.g.render_markdown( self.text ), '
MyTitle
Issue #1
' )
+ def testRenderMarkdown(self):
+ self.assertEqual(self.g.render_markdown(self.text), 'MyTitle
Issue #1
')
- def testRenderGithubFlavoredMarkdown( self ):
- self.assertEqual( self.g.render_markdown( self.text, self.repo ), 'MyTitle
Issue #1
' )
+ def testRenderGithubFlavoredMarkdown(self):
+ self.assertEqual(self.g.render_markdown(self.text, self.repo), 'MyTitle
Issue #1
')
diff --git a/github/tests/Milestone.py b/github/tests/Milestone.py
index 9433e2b5..55446d9b 100644
--- a/github/tests/Milestone.py
+++ b/github/tests/Milestone.py
@@ -15,37 +15,38 @@ import Framework
import datetime
-class Milestone( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.milestone = self.g.get_user().get_repo( "PyGithub" ).get_milestone( 1 )
- def testAttributes( self ):
- self.assertEqual( self.milestone.closed_issues, 2 )
- self.assertEqual( self.milestone.created_at, datetime.datetime( 2012, 3, 8, 12, 22, 10 ) )
- self.assertEqual( self.milestone.description, "" )
- self.assertEqual( self.milestone.due_on, datetime.datetime( 2012, 3, 13, 7, 0, 0 ) )
- self.assertEqual( self.milestone.id, 93546 )
- self.assertEqual( self.milestone.number, 1 )
- self.assertEqual( self.milestone.open_issues, 0 )
- self.assertEqual( self.milestone.state, "closed" )
- self.assertEqual( self.milestone.title, "Version 0.4" )
- self.assertEqual( self.milestone.url, "https://api.github.com/repos/jacquev6/PyGithub/milestones/1" )
- self.assertEqual( self.milestone.creator.login, "jacquev6" )
+class Milestone(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.milestone = self.g.get_user().get_repo("PyGithub").get_milestone(1)
- def testEditWithMinimalParameters( self ):
- self.milestone.edit( "Title edited by PyGithub" )
- self.assertEqual( self.milestone.title, "Title edited by PyGithub" )
+ def testAttributes(self):
+ self.assertEqual(self.milestone.closed_issues, 2)
+ self.assertEqual(self.milestone.created_at, datetime.datetime(2012, 3, 8, 12, 22, 10))
+ self.assertEqual(self.milestone.description, "")
+ self.assertEqual(self.milestone.due_on, datetime.datetime(2012, 3, 13, 7, 0, 0))
+ self.assertEqual(self.milestone.id, 93546)
+ self.assertEqual(self.milestone.number, 1)
+ self.assertEqual(self.milestone.open_issues, 0)
+ self.assertEqual(self.milestone.state, "closed")
+ self.assertEqual(self.milestone.title, "Version 0.4")
+ self.assertEqual(self.milestone.url, "https://api.github.com/repos/jacquev6/PyGithub/milestones/1")
+ self.assertEqual(self.milestone.creator.login, "jacquev6")
- def testEditWithAllParameters( self ):
- self.milestone.edit( "Title edited twice by PyGithub", "closed", "Description edited by PyGithub", due_on = datetime.date( 2012, 6, 16 ) )
- self.assertEqual( self.milestone.title, "Title edited twice by PyGithub" )
- self.assertEqual( self.milestone.state, "closed" )
- self.assertEqual( self.milestone.description, "Description edited by PyGithub" )
- self.assertEqual( self.milestone.due_on, datetime.datetime( 2012, 6, 16, 7, 0, 0 ) )
+ def testEditWithMinimalParameters(self):
+ self.milestone.edit("Title edited by PyGithub")
+ self.assertEqual(self.milestone.title, "Title edited by PyGithub")
- def testGetLabels( self ):
- self.assertListKeyEqual( self.milestone.get_labels(), lambda l: l.name, [ "Public interface", "Project management" ] )
+ def testEditWithAllParameters(self):
+ self.milestone.edit("Title edited twice by PyGithub", "closed", "Description edited by PyGithub", due_on=datetime.date(2012, 6, 16))
+ self.assertEqual(self.milestone.title, "Title edited twice by PyGithub")
+ self.assertEqual(self.milestone.state, "closed")
+ self.assertEqual(self.milestone.description, "Description edited by PyGithub")
+ self.assertEqual(self.milestone.due_on, datetime.datetime(2012, 6, 16, 7, 0, 0))
- def testDelete( self ):
+ def testGetLabels(self):
+ self.assertListKeyEqual(self.milestone.get_labels(), lambda l: l.name, ["Public interface", "Project management"])
+
+ def testDelete(self):
self.milestone.delete()
diff --git a/github/tests/NamedUser.py b/github/tests/NamedUser.py
index 8f76a6e6..90768009 100644
--- a/github/tests/NamedUser.py
+++ b/github/tests/NamedUser.py
@@ -16,115 +16,116 @@ import Framework
import github
import datetime
-class NamedUser( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.user = self.g.get_user( "jacquev6" )
- def testAttributesOfOtherUser( self ):
- self.user = self.g.get_user( "nvie" )
- self.assertEqual( self.user.avatar_url, "https://secure.gravatar.com/avatar/c5a7f21b46df698f3db31c37ed0cf55a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" )
- self.assertEqual( self.user.bio, None )
- self.assertEqual( self.user.blog, "http://nvie.com" )
- self.assertEqual( self.user.collaborators, None )
- self.assertEqual( self.user.company, "3rd Cloud" )
- self.assertEqual( self.user.created_at, datetime.datetime( 2009, 5, 12, 21, 19, 38 ) )
- self.assertEqual( self.user.disk_usage, None )
- self.assertEqual( self.user.email, "vincent@3rdcloud.com" )
- self.assertEqual( self.user.followers, 296 )
- self.assertEqual( self.user.following, 41 )
- self.assertEqual( self.user.gravatar_id, "c5a7f21b46df698f3db31c37ed0cf55a" )
- self.assertEqual( self.user.hireable, False )
- self.assertEqual( self.user.html_url, "https://github.com/nvie" )
- self.assertEqual( self.user.id, 83844 )
- self.assertEqual( self.user.location, "Netherlands" )
- self.assertEqual( self.user.login, "nvie" )
- self.assertEqual( self.user.name, "Vincent Driessen" )
- self.assertEqual( self.user.owned_private_repos, None )
- self.assertEqual( self.user.plan, None )
- self.assertEqual( self.user.private_gists, None )
- self.assertEqual( self.user.public_gists, 16 )
- self.assertEqual( self.user.public_repos, 61 )
- self.assertEqual( self.user.total_private_repos, None )
- self.assertEqual( self.user.type, "User" )
- self.assertEqual( self.user.url, "https://api.github.com/users/nvie" )
+class NamedUser(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.user = self.g.get_user("jacquev6")
- def testAttributesOfSelf( self ):
- self.assertEqual( self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" )
- self.assertEqual( self.user.bio, "" )
- self.assertEqual( self.user.blog, "http://vincent-jacques.net" )
- self.assertEqual( self.user.collaborators, 0 )
- self.assertEqual( self.user.company, "Criteo" )
- self.assertEqual( self.user.created_at, datetime.datetime( 2010, 7, 9, 6, 10, 6 ) )
- self.assertEqual( self.user.disk_usage, 17080 )
- self.assertEqual( self.user.email, "vincent@vincent-jacques.net" )
- self.assertEqual( self.user.followers, 13 )
- self.assertEqual( self.user.following, 24 )
- self.assertEqual( self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225" )
- self.assertEqual( self.user.hireable, False )
- self.assertEqual( self.user.html_url, "https://github.com/jacquev6" )
- self.assertEqual( self.user.id, 327146 )
- self.assertEqual( self.user.location, "Paris, France" )
- self.assertEqual( self.user.login, "jacquev6" )
- self.assertEqual( self.user.name, "Vincent Jacques" )
- self.assertEqual( self.user.owned_private_repos, 5 )
- self.assertEqual( self.user.plan.name, "micro" )
- self.assertEqual( self.user.plan.collaborators, 1 )
- self.assertEqual( self.user.plan.space, 614400 )
- self.assertEqual( self.user.plan.private_repos, 5 )
- self.assertEqual( self.user.private_gists, 5 )
- self.assertEqual( self.user.public_gists, 2 )
- self.assertEqual( self.user.public_repos, 11 )
- self.assertEqual( self.user.total_private_repos, 5 )
- self.assertEqual( self.user.type, "User" )
- self.assertEqual( self.user.url, "https://api.github.com/users/jacquev6" )
+ def testAttributesOfOtherUser(self):
+ self.user = self.g.get_user("nvie")
+ self.assertEqual(self.user.avatar_url, "https://secure.gravatar.com/avatar/c5a7f21b46df698f3db31c37ed0cf55a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png")
+ self.assertEqual(self.user.bio, None)
+ self.assertEqual(self.user.blog, "http://nvie.com")
+ self.assertEqual(self.user.collaborators, None)
+ self.assertEqual(self.user.company, "3rd Cloud")
+ self.assertEqual(self.user.created_at, datetime.datetime(2009, 5, 12, 21, 19, 38))
+ self.assertEqual(self.user.disk_usage, None)
+ self.assertEqual(self.user.email, "vincent@3rdcloud.com")
+ self.assertEqual(self.user.followers, 296)
+ self.assertEqual(self.user.following, 41)
+ self.assertEqual(self.user.gravatar_id, "c5a7f21b46df698f3db31c37ed0cf55a")
+ self.assertEqual(self.user.hireable, False)
+ self.assertEqual(self.user.html_url, "https://github.com/nvie")
+ self.assertEqual(self.user.id, 83844)
+ self.assertEqual(self.user.location, "Netherlands")
+ self.assertEqual(self.user.login, "nvie")
+ self.assertEqual(self.user.name, "Vincent Driessen")
+ self.assertEqual(self.user.owned_private_repos, None)
+ self.assertEqual(self.user.plan, None)
+ self.assertEqual(self.user.private_gists, None)
+ self.assertEqual(self.user.public_gists, 16)
+ self.assertEqual(self.user.public_repos, 61)
+ self.assertEqual(self.user.total_private_repos, None)
+ self.assertEqual(self.user.type, "User")
+ self.assertEqual(self.user.url, "https://api.github.com/users/nvie")
- def testCreateGist( self ):
- gist = self.user.create_gist( True, { "foobar.txt": github.InputFileContent( "File created by PyGithub" ) }, "Gist created by PyGithub on a NamedUser" )
- self.assertEqual( gist.description, "Gist created by PyGithub on a NamedUser" )
+ def testAttributesOfSelf(self):
+ self.assertEqual(self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png")
+ self.assertEqual(self.user.bio, "")
+ self.assertEqual(self.user.blog, "http://vincent-jacques.net")
+ self.assertEqual(self.user.collaborators, 0)
+ self.assertEqual(self.user.company, "Criteo")
+ self.assertEqual(self.user.created_at, datetime.datetime(2010, 7, 9, 6, 10, 6))
+ self.assertEqual(self.user.disk_usage, 17080)
+ self.assertEqual(self.user.email, "vincent@vincent-jacques.net")
+ self.assertEqual(self.user.followers, 13)
+ self.assertEqual(self.user.following, 24)
+ self.assertEqual(self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225")
+ self.assertEqual(self.user.hireable, False)
+ self.assertEqual(self.user.html_url, "https://github.com/jacquev6")
+ self.assertEqual(self.user.id, 327146)
+ self.assertEqual(self.user.location, "Paris, France")
+ self.assertEqual(self.user.login, "jacquev6")
+ self.assertEqual(self.user.name, "Vincent Jacques")
+ self.assertEqual(self.user.owned_private_repos, 5)
+ self.assertEqual(self.user.plan.name, "micro")
+ self.assertEqual(self.user.plan.collaborators, 1)
+ self.assertEqual(self.user.plan.space, 614400)
+ self.assertEqual(self.user.plan.private_repos, 5)
+ self.assertEqual(self.user.private_gists, 5)
+ self.assertEqual(self.user.public_gists, 2)
+ self.assertEqual(self.user.public_repos, 11)
+ self.assertEqual(self.user.total_private_repos, 5)
+ self.assertEqual(self.user.type, "User")
+ self.assertEqual(self.user.url, "https://api.github.com/users/jacquev6")
- def testCreateGistWithoutDescription( self ):
- gist = self.user.create_gist( True, { "foobar.txt": github.InputFileContent( "File created by PyGithub" ) } )
- self.assertEqual( gist.description, None )
+ def testCreateGist(self):
+ gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")}, "Gist created by PyGithub on a NamedUser")
+ self.assertEqual(gist.description, "Gist created by PyGithub on a NamedUser")
- def testGetGists( self ):
- self.assertListKeyEqual( self.user.get_gists(), lambda g: g.description, [ "Gist created by PyGithub", "FairThreadPoolPool.cpp", "How to error 500 Github API v3, as requested by Rick (GitHub Staff)", "Cadfael: order of episodes in French DVD edition" ] )
+ def testCreateGistWithoutDescription(self):
+ gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")})
+ self.assertEqual(gist.description, None)
- def testGetFollowers( self ):
- self.assertListKeyEqual( self.user.get_followers(), lambda f: f.login, [ "jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y" ] )
+ def testGetGists(self):
+ self.assertListKeyEqual(self.user.get_gists(), lambda g: g.description, ["Gist created by PyGithub", "FairThreadPoolPool.cpp", "How to error 500 Github API v3, as requested by Rick (GitHub Staff)", "Cadfael: order of episodes in French DVD edition"])
- def testGetFollowing( self ):
- self.assertListKeyEqual( self.user.get_following(), lambda f: f.login, [ "nvie", "schacon", "jamis", "chad", "unclebob", "dabrahams", "jnorthrup", "brugidou", "regisb", "walidk", "tanzilli", "fjardon", "r3c", "sdanzan", "vineus", "cjuniet", "gturri", "ant9000", "asquini", "claudyus", "jardon-u", "s-bernard", "kamaradclimber", "Lyloa" ] )
+ def testGetFollowers(self):
+ self.assertListKeyEqual(self.user.get_followers(), lambda f: f.login, ["jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y"])
- def testGetOrgs( self ):
- self.assertListKeyEqual( self.user.get_orgs(), lambda o: o.login, [ "BeaverSoftware" ] )
+ def testGetFollowing(self):
+ self.assertListKeyEqual(self.user.get_following(), lambda f: f.login, ["nvie", "schacon", "jamis", "chad", "unclebob", "dabrahams", "jnorthrup", "brugidou", "regisb", "walidk", "tanzilli", "fjardon", "r3c", "sdanzan", "vineus", "cjuniet", "gturri", "ant9000", "asquini", "claudyus", "jardon-u", "s-bernard", "kamaradclimber", "Lyloa"])
- def testGetRepo( self ):
- self.assertEqual( self.user.get_repo( "PyGithub" ).description, "Python library implementing the full Github API v3" )
+ def testGetOrgs(self):
+ self.assertListKeyEqual(self.user.get_orgs(), lambda o: o.login, ["BeaverSoftware"])
- def testGetRepos( self ):
- self.assertListKeyEqual( self.user.get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] )
+ def testGetRepo(self):
+ self.assertEqual(self.user.get_repo("PyGithub").description, "Python library implementing the full Github API v3")
- def testGetReposWithType( self ):
- self.assertListKeyEqual( self.user.get_repos( "owner" ), lambda r: r.name, [ "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] )
+ def testGetRepos(self):
+ self.assertListKeyEqual(self.user.get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
- def testGetWatched( self ):
- self.assertListKeyEqual( self.user.get_watched(), lambda r: r.name, [ "git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "PyGithub", "django", "django", "TestPyGithub" ] )
+ def testGetReposWithType(self):
+ self.assertListKeyEqual(self.user.get_repos("owner"), lambda r: r.name, ["django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
- def testGetStarred( self ):
- self.assertListKeyEqual( self.user.get_starred(), lambda r: r.name, [ "git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "amaunet", "django", "django", "moviePlanning", "folly" ] )
+ def testGetWatched(self):
+ self.assertListKeyEqual(self.user.get_watched(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "PyGithub", "django", "django", "TestPyGithub"])
- def testGetSubscriptions( self ):
- self.assertListKeyEqual( self.user.get_subscriptions(), lambda r: r.name, [ "ViDE", "Boost.HierarchicalEnum", "QuadProgMm", "DrawSyntax", "DrawTurksHead", "PrivateStuff", "vincent-jacques.net", "Hacking", "C4Planner", "developer.github.com", "PyGithub", "PyGithub", "django", "CinePlanning", "PyGithub", "PyGithub", "PyGithub", "IpMap", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub" ] )
+ def testGetStarred(self):
+ self.assertListKeyEqual(self.user.get_starred(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "amaunet", "django", "django", "moviePlanning", "folly"])
- def testGetEvents( self ):
- self.assertListKeyBegin( self.user.get_events(), lambda e: e.type, [ "GistEvent", "IssueCommentEvent", "PushEvent", "IssuesEvent" ] )
+ def testGetSubscriptions(self):
+ self.assertListKeyEqual(self.user.get_subscriptions(), lambda r: r.name, ["ViDE", "Boost.HierarchicalEnum", "QuadProgMm", "DrawSyntax", "DrawTurksHead", "PrivateStuff", "vincent-jacques.net", "Hacking", "C4Planner", "developer.github.com", "PyGithub", "PyGithub", "django", "CinePlanning", "PyGithub", "PyGithub", "PyGithub", "IpMap", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub"])
- def testGetPublicEvents( self ):
- self.assertListKeyBegin( self.user.get_public_events(), lambda e: e.type, [ "PushEvent", "CreateEvent", "GistEvent", "IssuesEvent" ] )
+ def testGetEvents(self):
+ self.assertListKeyBegin(self.user.get_events(), lambda e: e.type, ["GistEvent", "IssueCommentEvent", "PushEvent", "IssuesEvent"])
- def testGetPublicReceivedEvents( self ):
- self.assertListKeyBegin( self.user.get_public_received_events(), lambda e: e.type, [ "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent" ] )
+ def testGetPublicEvents(self):
+ self.assertListKeyBegin(self.user.get_public_events(), lambda e: e.type, ["PushEvent", "CreateEvent", "GistEvent", "IssuesEvent"])
- def testGetReceivedEvents( self ):
- self.assertListKeyBegin( self.user.get_received_events(), lambda e: e.type, [ "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent" ] )
+ def testGetPublicReceivedEvents(self):
+ self.assertListKeyBegin(self.user.get_public_received_events(), lambda e: e.type, ["IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent"])
+
+ def testGetReceivedEvents(self):
+ self.assertListKeyBegin(self.user.get_received_events(), lambda e: e.type, ["IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent"])
diff --git a/github/tests/Organization.py b/github/tests/Organization.py
index 10dc001c..7610d18f 100644
--- a/github/tests/Organization.py
+++ b/github/tests/Organization.py
@@ -15,102 +15,103 @@ import Framework
import datetime
-class Organization( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.org = self.g.get_organization( "BeaverSoftware" )
- def testAttributes( self ):
- self.assertEqual( self.org.avatar_url, "https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png" )
- self.assertEqual( self.org.billing_email, "BeaverSoftware@vincent-jacques.net" )
- self.assertEqual( self.org.blog, None )
- self.assertEqual( self.org.collaborators, 0 )
- self.assertEqual( self.org.company, None )
- self.assertEqual( self.org.created_at, datetime.datetime( 2012, 2, 9, 19, 20, 12 ) )
- self.assertEqual( self.org.disk_usage, 112 )
- self.assertEqual( self.org.email, None )
- self.assertEqual( self.org.followers, 0 )
- self.assertEqual( self.org.following, 0 )
- self.assertEqual( self.org.gravatar_id, None )
- self.assertEqual( self.org.html_url, "https://github.com/BeaverSoftware" )
- self.assertEqual( self.org.id, 1424031 )
- self.assertEqual( self.org.location, "Paris, France" )
- self.assertEqual( self.org.login, "BeaverSoftware" )
- self.assertEqual( self.org.name, None )
- self.assertEqual( self.org.owned_private_repos, 0 )
- self.assertEqual( self.org.plan.name, "free" )
- self.assertEqual( self.org.plan.private_repos, 0 )
- self.assertEqual( self.org.plan.space, 307200 )
- self.assertEqual( self.org.private_gists, 0 )
- self.assertEqual( self.org.public_gists, 0 )
- self.assertEqual( self.org.public_repos, 2 )
- self.assertEqual( self.org.total_private_repos, 0 )
- self.assertEqual( self.org.type, "Organization" )
- self.assertEqual( self.org.url, "https://api.github.com/orgs/BeaverSoftware" )
+class Organization(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.org = self.g.get_organization("BeaverSoftware")
- def testEditWithoutArguments( self ):
+ def testAttributes(self):
+ self.assertEqual(self.org.avatar_url, "https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png")
+ self.assertEqual(self.org.billing_email, "BeaverSoftware@vincent-jacques.net")
+ self.assertEqual(self.org.blog, None)
+ self.assertEqual(self.org.collaborators, 0)
+ self.assertEqual(self.org.company, None)
+ self.assertEqual(self.org.created_at, datetime.datetime(2012, 2, 9, 19, 20, 12))
+ self.assertEqual(self.org.disk_usage, 112)
+ self.assertEqual(self.org.email, None)
+ self.assertEqual(self.org.followers, 0)
+ self.assertEqual(self.org.following, 0)
+ self.assertEqual(self.org.gravatar_id, None)
+ self.assertEqual(self.org.html_url, "https://github.com/BeaverSoftware")
+ self.assertEqual(self.org.id, 1424031)
+ self.assertEqual(self.org.location, "Paris, France")
+ self.assertEqual(self.org.login, "BeaverSoftware")
+ self.assertEqual(self.org.name, None)
+ self.assertEqual(self.org.owned_private_repos, 0)
+ self.assertEqual(self.org.plan.name, "free")
+ self.assertEqual(self.org.plan.private_repos, 0)
+ self.assertEqual(self.org.plan.space, 307200)
+ self.assertEqual(self.org.private_gists, 0)
+ self.assertEqual(self.org.public_gists, 0)
+ self.assertEqual(self.org.public_repos, 2)
+ self.assertEqual(self.org.total_private_repos, 0)
+ self.assertEqual(self.org.type, "Organization")
+ self.assertEqual(self.org.url, "https://api.github.com/orgs/BeaverSoftware")
+
+ def testEditWithoutArguments(self):
self.org.edit()
- def testEditWithAllArguments( self ):
- self.org.edit( "BeaverSoftware2@vincent-jacques.net", "http://vincent-jacques.net", "Company edited by PyGithub", "BeaverSoftware2@vincent-jacques.net", "Location edited by PyGithub", "Name edited by PyGithub" )
- self.assertEqual( self.org.billing_email, "BeaverSoftware2@vincent-jacques.net" )
- self.assertEqual( self.org.blog, "http://vincent-jacques.net" )
- self.assertEqual( self.org.company, "Company edited by PyGithub" )
- self.assertEqual( self.org.email, "BeaverSoftware2@vincent-jacques.net" )
- self.assertEqual( self.org.location, "Location edited by PyGithub" )
- self.assertEqual( self.org.name, "Name edited by PyGithub" )
+ def testEditWithAllArguments(self):
+ self.org.edit("BeaverSoftware2@vincent-jacques.net", "http://vincent-jacques.net", "Company edited by PyGithub", "BeaverSoftware2@vincent-jacques.net", "Location edited by PyGithub", "Name edited by PyGithub")
+ self.assertEqual(self.org.billing_email, "BeaverSoftware2@vincent-jacques.net")
+ self.assertEqual(self.org.blog, "http://vincent-jacques.net")
+ self.assertEqual(self.org.company, "Company edited by PyGithub")
+ self.assertEqual(self.org.email, "BeaverSoftware2@vincent-jacques.net")
+ self.assertEqual(self.org.location, "Location edited by PyGithub")
+ self.assertEqual(self.org.name, "Name edited by PyGithub")
- def testCreateTeam( self ):
- team = self.org.create_team( "Team created by PyGithub" )
- self.assertEqual( team.id, 189850 )
+ def testCreateTeam(self):
+ team = self.org.create_team("Team created by PyGithub")
+ self.assertEqual(team.id, 189850)
- def testCreateTeamWithAllArguments( self ):
- repo = self.org.get_repo( "FatherBeaver" )
- team = self.org.create_team( "Team also created by PyGithub", [ repo ], "push" )
- self.assertEqual( team.id, 189852 )
+ def testCreateTeamWithAllArguments(self):
+ repo = self.org.get_repo("FatherBeaver")
+ team = self.org.create_team("Team also created by PyGithub", [repo], "push")
+ self.assertEqual(team.id, 189852)
- def testPublicMembers( self ):
- lyloa = self.g.get_user( "Lyloa" )
- self.assertFalse( self.org.has_in_public_members( lyloa ) )
- self.org.add_to_public_members( lyloa )
- self.assertTrue( self.org.has_in_public_members( lyloa ) )
- self.org.remove_from_public_members( lyloa )
- self.assertFalse( self.org.has_in_public_members( lyloa ) )
+ def testPublicMembers(self):
+ lyloa = self.g.get_user("Lyloa")
+ self.assertFalse(self.org.has_in_public_members(lyloa))
+ self.org.add_to_public_members(lyloa)
+ self.assertTrue(self.org.has_in_public_members(lyloa))
+ self.org.remove_from_public_members(lyloa)
+ self.assertFalse(self.org.has_in_public_members(lyloa))
- def testGetPublicMembers( self ):
- self.assertListKeyEqual( self.org.get_public_members(), lambda u: u.login, [ "jacquev6" ] )
+ def testGetPublicMembers(self):
+ self.assertListKeyEqual(self.org.get_public_members(), lambda u: u.login, ["jacquev6"])
- def testGetMembers( self ):
- self.assertListKeyEqual( self.org.get_members(), lambda u: u.login, [ "cjuniet", "jacquev6", "Lyloa" ] )
+ def testGetMembers(self):
+ self.assertListKeyEqual(self.org.get_members(), lambda u: u.login, ["cjuniet", "jacquev6", "Lyloa"])
- def testMembers( self ):
- lyloa = self.g.get_user( "Lyloa" )
- self.assertTrue( self.org.has_in_members( lyloa ) )
- self.org.remove_from_members( lyloa )
- self.assertFalse( self.org.has_in_members( lyloa ) )
+ def testMembers(self):
+ lyloa = self.g.get_user("Lyloa")
+ self.assertTrue(self.org.has_in_members(lyloa))
+ self.org.remove_from_members(lyloa)
+ self.assertFalse(self.org.has_in_members(lyloa))
- def testGetRepos( self ):
- self.assertListKeyEqual( self.org.get_repos(), lambda r: r.name, [ "FatherBeaver", "TestPyGithub" ] )
+ def testGetRepos(self):
+ self.assertListKeyEqual(self.org.get_repos(), lambda r: r.name, ["FatherBeaver", "TestPyGithub"])
- def testGetReposWithType( self ):
- self.assertListKeyEqual( self.org.get_repos( "public" ), lambda r: r.name, [ "FatherBeaver", "PyGithub" ] )
+ def testGetReposWithType(self):
+ self.assertListKeyEqual(self.org.get_repos("public"), lambda r: r.name, ["FatherBeaver", "PyGithub"])
- def testGetEvents( self ):
- self.assertListKeyEqual( self.org.get_events(), lambda e: e.type, [ "CreateEvent", "CreateEvent", "PushEvent", "PushEvent", "DeleteEvent", "DeleteEvent", "PushEvent", "PushEvent", "DeleteEvent", "DeleteEvent", "PushEvent", "PushEvent", "PushEvent", "CreateEvent", "CreateEvent", "CreateEvent", "CreateEvent", "CreateEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "ForkEvent", "CreateEvent" ] )
+ def testGetEvents(self):
+ self.assertListKeyEqual(self.org.get_events(), lambda e: e.type, ["CreateEvent", "CreateEvent", "PushEvent", "PushEvent", "DeleteEvent", "DeleteEvent", "PushEvent", "PushEvent", "DeleteEvent", "DeleteEvent", "PushEvent", "PushEvent", "PushEvent", "CreateEvent", "CreateEvent", "CreateEvent", "CreateEvent", "CreateEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "ForkEvent", "CreateEvent"])
- def testGetTeams( self ):
- self.assertListKeyEqual( self.org.get_teams(), lambda t: t.name, [ "Members", "Owners" ] )
+ def testGetTeams(self):
+ self.assertListKeyEqual(self.org.get_teams(), lambda t: t.name, ["Members", "Owners"])
- def testCreateRepoWithMinimalArguments( self ):
- repo = self.org.create_repo( "TestPyGithub" )
- self.assertEqual( repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub" )
+ def testCreateRepoWithMinimalArguments(self):
+ repo = self.org.create_repo("TestPyGithub")
+ self.assertEqual(repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub")
- def testCreateRepoWithAllArguments( self ):
- team = self.org.get_team( 141496 )
- repo = self.org.create_repo( "TestPyGithub2", "Repo created by PyGithub", "http://foobar.com", False, False, False, False, team )
- self.assertEqual( repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub2" )
+ def testCreateRepoWithAllArguments(self):
+ team = self.org.get_team(141496)
+ repo = self.org.create_repo("TestPyGithub2", "Repo created by PyGithub", "http://foobar.com", False, False, False, False, team)
+ self.assertEqual(repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub2")
- def testCreateFork( self ):
- pygithub = self.g.get_user( "jacquev6" ).get_repo( "PyGithub" )
- repo = self.org.create_fork( pygithub )
- self.assertEqual( repo.url, "https://api.github.com/repos/BeaverSoftware/PyGithub" )
+ def testCreateFork(self):
+ pygithub = self.g.get_user("jacquev6").get_repo("PyGithub")
+ repo = self.org.create_fork(pygithub)
+ self.assertEqual(repo.url, "https://api.github.com/repos/BeaverSoftware/PyGithub")
diff --git a/github/tests/PaginatedList.py b/github/tests/PaginatedList.py
index 016b93bb..00c45db1 100644
--- a/github/tests/PaginatedList.py
+++ b/github/tests/PaginatedList.py
@@ -13,56 +13,57 @@
import Framework
-class PaginatedList( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.list = self.g.get_user( "openframeworks" ).get_repo( "openFrameworks" ).get_issues()
- def testIteration( self ):
- self.assertEqual( len( list( self.list ) ), 333 )
+class PaginatedList(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.list = self.g.get_user("openframeworks").get_repo("openFrameworks").get_issues()
- def testSeveralIterations( self ):
- self.assertEqual( len( list( self.list ) ), 333 )
- self.assertEqual( len( list( self.list ) ), 333 )
- self.assertEqual( len( list( self.list ) ), 333 )
- self.assertEqual( len( list( self.list ) ), 333 )
+ def testIteration(self):
+ self.assertEqual(len(list(self.list)), 333)
- def testIntIndexingInFirstPage( self ):
- self.assertEqual( self.list[ 0 ].id, 4772349 )
- self.assertEqual( self.list[ 24 ].id, 4286936 )
+ def testSeveralIterations(self):
+ self.assertEqual(len(list(self.list)), 333)
+ self.assertEqual(len(list(self.list)), 333)
+ self.assertEqual(len(list(self.list)), 333)
+ self.assertEqual(len(list(self.list)), 333)
- def testIntIndexingInThirdPage( self ):
- self.assertEqual( self.list[ 50 ].id, 3911629 )
- self.assertEqual( self.list[ 74 ].id, 3605277 )
+ def testIntIndexingInFirstPage(self):
+ self.assertEqual(self.list[0].id, 4772349)
+ self.assertEqual(self.list[24].id, 4286936)
- def testGetFirstPage( self ):
- self.assertListKeyEqual( self.list.get_page( 0 ), lambda i: i.id, [ 4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492, 4507416, 4447561, 4406584, 4384548, 4383465, 4373361, 4373201, 4370619, 4356530, 4352401, 4317009, 4286936 ] )
+ def testIntIndexingInThirdPage(self):
+ self.assertEqual(self.list[50].id, 3911629)
+ self.assertEqual(self.list[74].id, 3605277)
- def testGetThirdPage( self ):
- self.assertListKeyEqual( self.list.get_page( 2 ), lambda i: i.id, [ 3911629, 3911537, 3910580, 3910555, 3910549, 3897090, 3883598, 3856005, 3850655, 3825582, 3813852, 3812318, 3812275, 3807459, 3799872, 3799653, 3795495, 3754055, 3710293, 3662214, 3647640, 3631618, 3627067, 3614231, 3605277 ] )
+ def testGetFirstPage(self):
+ self.assertListKeyEqual(self.list.get_page(0), lambda i: i.id, [4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492, 4507416, 4447561, 4406584, 4384548, 4383465, 4373361, 4373201, 4370619, 4356530, 4352401, 4317009, 4286936])
- def testIntIndexingAfterIteration( self ):
- self.assertEqual( len( list( self.list ) ), 333 )
- self.assertEqual( self.list[ 11 ].id, 4507572 )
- self.assertEqual( self.list[ 73 ].id, 3614231 )
- self.assertEqual( self.list[ 332 ].id, 94898 )
+ def testGetThirdPage(self):
+ self.assertListKeyEqual(self.list.get_page(2), lambda i: i.id, [3911629, 3911537, 3910580, 3910555, 3910549, 3897090, 3883598, 3856005, 3850655, 3825582, 3813852, 3812318, 3812275, 3807459, 3799872, 3799653, 3795495, 3754055, 3710293, 3662214, 3647640, 3631618, 3627067, 3614231, 3605277])
- def testSliceIndexingInFirstPage( self ):
- self.assertListKeyEqual( self.list[ : 13 ], lambda i: i.id, [ 4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492 ] )
- self.assertListKeyEqual( self.list[ : 13 : 3 ], lambda i: i.id, [ 4772349, 4700182, 4604661, 4554058, 4507492 ] )
- self.assertListKeyEqual( self.list[ 10 : 13 ], lambda i: i.id, [ 4539985, 4507572, 4507492 ] )
- self.assertListKeyEqual( self.list[ 5 : 13 : 3 ], lambda i: i.id, [ 4608132, 4557803, 4507572 ] )
+ def testIntIndexingAfterIteration(self):
+ self.assertEqual(len(list(self.list)), 333)
+ self.assertEqual(self.list[11].id, 4507572)
+ self.assertEqual(self.list[73].id, 3614231)
+ self.assertEqual(self.list[332].id, 94898)
- def testSliceIndexingUntilFourthPage( self ):
- self.assertListKeyEqual( self.list[ : 99 : 10 ], lambda i: i.id, [ 4772349, 4539985, 4370619, 4207350, 4063366, 3911629, 3813852, 3647640, 3528378, 3438233 ] )
- self.assertListKeyEqual( self.list[ 73 : 78 ], lambda i: i.id, [ 3614231, 3605277, 3596240, 3594731, 3593619 ] )
- self.assertListKeyEqual( self.list[ 70 : 80 : 2 ], lambda i: i.id, [ 3647640, 3627067, 3605277, 3594731, 3593430 ] )
+ def testSliceIndexingInFirstPage(self):
+ self.assertListKeyEqual(self.list[:13], lambda i: i.id, [4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492])
+ self.assertListKeyEqual(self.list[:13:3], lambda i: i.id, [4772349, 4700182, 4604661, 4554058, 4507492])
+ self.assertListKeyEqual(self.list[10:13], lambda i: i.id, [4539985, 4507572, 4507492])
+ self.assertListKeyEqual(self.list[5:13:3], lambda i: i.id, [4608132, 4557803, 4507572])
- def testSliceIndexingUntilEnd( self ):
- self.assertListKeyEqual( self.list[ 310 : : 3 ], lambda i: i.id, [ 268332, 204247, 169176, 166211, 165898, 163959, 132373, 104702 ] )
- self.assertListKeyEqual( self.list[ 310 : ], lambda i: i.id, [ 268332, 211418, 205935, 204247, 172424, 171615, 169176, 166214, 166212, 166211, 166209, 166208, 165898, 165537, 165409, 163959, 132671, 132377, 132373, 130269, 111018, 104702, 94898 ] )
+ def testSliceIndexingUntilFourthPage(self):
+ self.assertListKeyEqual(self.list[:99:10], lambda i: i.id, [4772349, 4539985, 4370619, 4207350, 4063366, 3911629, 3813852, 3647640, 3528378, 3438233])
+ self.assertListKeyEqual(self.list[73:78], lambda i: i.id, [3614231, 3605277, 3596240, 3594731, 3593619])
+ self.assertListKeyEqual(self.list[70:80:2], lambda i: i.id, [3647640, 3627067, 3605277, 3594731, 3593430])
- def testInterruptedIteration( self ):
+ def testSliceIndexingUntilEnd(self):
+ self.assertListKeyEqual(self.list[310::3], lambda i: i.id, [268332, 204247, 169176, 166211, 165898, 163959, 132373, 104702])
+ self.assertListKeyEqual(self.list[310:], lambda i: i.id, [268332, 211418, 205935, 204247, 172424, 171615, 169176, 166214, 166212, 166211, 166209, 166208, 165898, 165537, 165409, 163959, 132671, 132377, 132373, 130269, 111018, 104702, 94898])
+
+ def testInterruptedIteration(self):
# No asserts, but checks that only three pages are fetched
l = 0
for element in self.list:
@@ -70,10 +71,10 @@ class PaginatedList( Framework.TestCase ):
if l == 75:
break
- def testInterruptedIterationInSlice( self ):
+ def testInterruptedIterationInSlice(self):
# No asserts, but checks that only three pages are fetched
l = 0
- for element in self.list[ :100 ]:
+ for element in self.list[:100]:
l += 1
if l == 75:
break
diff --git a/github/tests/PullRequest.py b/github/tests/PullRequest.py
index 9f6331e9..7afaf576 100644
--- a/github/tests/PullRequest.py
+++ b/github/tests/PullRequest.py
@@ -15,85 +15,86 @@ import Framework
import datetime
-class PullRequest( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.repo = self.g.get_user().get_repo( "PyGithub" )
- self.pull = self.repo.get_pull( 31 )
- def testAttributes( self ):
- self.assertEqual( self.pull.additions, 511 )
- self.assertEqual( self.pull.base.label, "jacquev6:topic/RewriteWithGeneratedCode" )
- self.assertEqual( self.pull.base.sha, "ed866fc43833802ab553e5ff8581c81bb00dd433" )
- self.assertEqual( self.pull.base.user.login, "jacquev6" )
- self.assertEqual( self.pull.base.ref, "topic/RewriteWithGeneratedCode" )
- self.assertEqual( self.pull.base.repo.full_name, "jacquev6/PyGithub" )
- self.assertEqual( self.pull.body, "Body edited by PyGithub" )
- self.assertEqual( self.pull.changed_files, 45 )
- self.assertEqual( self.pull.closed_at, datetime.datetime( 2012, 5, 27, 10, 29, 7 ) )
- self.assertEqual( self.pull.comments, 0 )
- self.assertEqual( self.pull.commits, 3 )
- self.assertEqual( self.pull.created_at, datetime.datetime( 2012, 5, 27, 9, 25, 36 ) )
- self.assertEqual( self.pull.deletions, 384 )
- self.assertEqual( self.pull.diff_url, "https://github.com/jacquev6/PyGithub/pull/31.diff" )
- self.assertEqual( self.pull.head.label, "BeaverSoftware:master" )
- self.assertEqual( self.pull.html_url, "https://github.com/jacquev6/PyGithub/pull/31" )
- self.assertEqual( self.pull.id, 1436215 )
- self.assertEqual( self.pull.issue_url, "https://github.com/jacquev6/PyGithub/issues/31" )
- self.assertEqual( self.pull.mergeable, None )
- self.assertEqual( self.pull.merged, True )
- self.assertEqual( self.pull.merged_at, datetime.datetime( 2012, 5, 27, 10, 29, 7 ) )
- self.assertEqual( self.pull.merged_by.login, "jacquev6" )
- self.assertEqual( self.pull.number, 31 )
- self.assertEqual( self.pull.patch_url, "https://github.com/jacquev6/PyGithub/pull/31.patch" )
- self.assertEqual( self.pull.review_comments, 1 )
- self.assertEqual( self.pull.state, "closed" )
- self.assertEqual( self.pull.title, "Title edited by PyGithub" )
- self.assertEqual( self.pull.updated_at, datetime.datetime( 2012, 5, 27, 10, 29, 7 ) )
- self.assertEqual( self.pull.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/31" )
- self.assertEqual( self.pull.user.login, "jacquev6" )
+class PullRequest(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.repo = self.g.get_user().get_repo("PyGithub")
+ self.pull = self.repo.get_pull(31)
- def testCreateComment( self ):
- commit = self.repo.get_commit( "8a4f306d4b223682dd19410d4a9150636ebe4206" )
- comment = self.pull.create_comment( "Comment created by PyGithub", commit, "src/github/Issue.py", 5 )
- self.assertEqual( comment.id, 886298 )
+ def testAttributes(self):
+ self.assertEqual(self.pull.additions, 511)
+ self.assertEqual(self.pull.base.label, "jacquev6:topic/RewriteWithGeneratedCode")
+ self.assertEqual(self.pull.base.sha, "ed866fc43833802ab553e5ff8581c81bb00dd433")
+ self.assertEqual(self.pull.base.user.login, "jacquev6")
+ self.assertEqual(self.pull.base.ref, "topic/RewriteWithGeneratedCode")
+ self.assertEqual(self.pull.base.repo.full_name, "jacquev6/PyGithub")
+ self.assertEqual(self.pull.body, "Body edited by PyGithub")
+ self.assertEqual(self.pull.changed_files, 45)
+ self.assertEqual(self.pull.closed_at, datetime.datetime(2012, 5, 27, 10, 29, 7))
+ self.assertEqual(self.pull.comments, 0)
+ self.assertEqual(self.pull.commits, 3)
+ self.assertEqual(self.pull.created_at, datetime.datetime(2012, 5, 27, 9, 25, 36))
+ self.assertEqual(self.pull.deletions, 384)
+ self.assertEqual(self.pull.diff_url, "https://github.com/jacquev6/PyGithub/pull/31.diff")
+ self.assertEqual(self.pull.head.label, "BeaverSoftware:master")
+ self.assertEqual(self.pull.html_url, "https://github.com/jacquev6/PyGithub/pull/31")
+ self.assertEqual(self.pull.id, 1436215)
+ self.assertEqual(self.pull.issue_url, "https://github.com/jacquev6/PyGithub/issues/31")
+ self.assertEqual(self.pull.mergeable, None)
+ self.assertEqual(self.pull.merged, True)
+ self.assertEqual(self.pull.merged_at, datetime.datetime(2012, 5, 27, 10, 29, 7))
+ self.assertEqual(self.pull.merged_by.login, "jacquev6")
+ self.assertEqual(self.pull.number, 31)
+ self.assertEqual(self.pull.patch_url, "https://github.com/jacquev6/PyGithub/pull/31.patch")
+ self.assertEqual(self.pull.review_comments, 1)
+ self.assertEqual(self.pull.state, "closed")
+ self.assertEqual(self.pull.title, "Title edited by PyGithub")
+ self.assertEqual(self.pull.updated_at, datetime.datetime(2012, 5, 27, 10, 29, 7))
+ self.assertEqual(self.pull.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/31")
+ self.assertEqual(self.pull.user.login, "jacquev6")
- def testGetComments( self ):
- self.assertListKeyEqual( self.pull.get_comments(), lambda c: c.id, [ 886298 ] )
+ def testCreateComment(self):
+ commit = self.repo.get_commit("8a4f306d4b223682dd19410d4a9150636ebe4206")
+ comment = self.pull.create_comment("Comment created by PyGithub", commit, "src/github/Issue.py", 5)
+ self.assertEqual(comment.id, 886298)
- def testCreateIssueComment( self ):
- comment = self.pull.create_issue_comment( "Issue comment created by PyGithub" )
- self.assertEqual( comment.id, 8387331 )
+ def testGetComments(self):
+ self.assertListKeyEqual(self.pull.get_comments(), lambda c: c.id, [886298])
- def testGetIssueComments( self ):
- self.assertListKeyEqual( self.pull.get_issue_comments(), lambda c: c.id, [ 8387331 ] )
+ def testCreateIssueComment(self):
+ comment = self.pull.create_issue_comment("Issue comment created by PyGithub")
+ self.assertEqual(comment.id, 8387331)
- def testGetIssueComment( self ):
- comment = self.pull.get_issue_comment( 8387331 )
- self.assertEqual( comment.body, "Issue comment created by PyGithub" )
+ def testGetIssueComments(self):
+ self.assertListKeyEqual(self.pull.get_issue_comments(), lambda c: c.id, [8387331])
- def testEditWithoutArguments( self ):
+ def testGetIssueComment(self):
+ comment = self.pull.get_issue_comment(8387331)
+ self.assertEqual(comment.body, "Issue comment created by PyGithub")
+
+ def testEditWithoutArguments(self):
self.pull.edit()
- def testEditWithAllArguments( self ):
- self.pull.edit( "Title edited by PyGithub", "Body edited by PyGithub", "open" )
- self.assertEqual( self.pull.title, "Title edited by PyGithub" )
- self.assertEqual( self.pull.body, "Body edited by PyGithub" )
- self.assertEqual( self.pull.state, "open" )
+ def testEditWithAllArguments(self):
+ self.pull.edit("Title edited by PyGithub", "Body edited by PyGithub", "open")
+ self.assertEqual(self.pull.title, "Title edited by PyGithub")
+ self.assertEqual(self.pull.body, "Body edited by PyGithub")
+ self.assertEqual(self.pull.state, "open")
- def testGetCommits( self ):
- self.assertListKeyEqual( self.pull.get_commits(), lambda c: c.sha, [ "4aadfff21cdd2d2566b0e4bd7309c233b5f4ae23", "93dcae5cf207de376c91d0599226e7c7563e1d16", "8a4f306d4b223682dd19410d4a9150636ebe4206" ] )
+ def testGetCommits(self):
+ self.assertListKeyEqual(self.pull.get_commits(), lambda c: c.sha, ["4aadfff21cdd2d2566b0e4bd7309c233b5f4ae23", "93dcae5cf207de376c91d0599226e7c7563e1d16", "8a4f306d4b223682dd19410d4a9150636ebe4206"])
- def testGetFiles( self ):
- self.assertListKeyEqual( self.pull.get_files(), lambda f: f.filename, [ "codegen/templates/GithubObject.py", "src/github/AuthenticatedUser.py", "src/github/Authorization.py", "src/github/Branch.py", "src/github/Commit.py", "src/github/CommitComment.py", "src/github/CommitFile.py", "src/github/CommitStats.py", "src/github/Download.py", "src/github/Event.py", "src/github/Gist.py", "src/github/GistComment.py", "src/github/GistHistoryState.py", "src/github/GitAuthor.py", "src/github/GitBlob.py", "src/github/GitCommit.py", "src/github/GitObject.py", "src/github/GitRef.py", "src/github/GitTag.py", "src/github/GitTree.py", "src/github/GitTreeElement.py", "src/github/Hook.py", "src/github/Issue.py", "src/github/IssueComment.py", "src/github/IssueEvent.py", "src/github/Label.py", "src/github/Milestone.py", "src/github/NamedUser.py", "src/github/Organization.py", "src/github/Permissions.py", "src/github/Plan.py", "src/github/PullRequest.py", "src/github/PullRequestComment.py", "src/github/PullRequestFile.py", "src/github/Repository.py", "src/github/RepositoryKey.py", "src/github/Tag.py", "src/github/Team.py", "src/github/UserKey.py", "test/Issue.py", "test/IssueEvent.py", "test/ReplayData/Issue.testAddAndRemoveLabels.txt", "test/ReplayData/Issue.testDeleteAndSetLabels.txt", "test/ReplayData/Issue.testGetLabels.txt", "test/ReplayData/IssueEvent.setUp.txt" ] )
+ def testGetFiles(self):
+ self.assertListKeyEqual(self.pull.get_files(), lambda f: f.filename, ["codegen/templates/GithubObject.py", "src/github/AuthenticatedUser.py", "src/github/Authorization.py", "src/github/Branch.py", "src/github/Commit.py", "src/github/CommitComment.py", "src/github/CommitFile.py", "src/github/CommitStats.py", "src/github/Download.py", "src/github/Event.py", "src/github/Gist.py", "src/github/GistComment.py", "src/github/GistHistoryState.py", "src/github/GitAuthor.py", "src/github/GitBlob.py", "src/github/GitCommit.py", "src/github/GitObject.py", "src/github/GitRef.py", "src/github/GitTag.py", "src/github/GitTree.py", "src/github/GitTreeElement.py", "src/github/Hook.py", "src/github/Issue.py", "src/github/IssueComment.py", "src/github/IssueEvent.py", "src/github/Label.py", "src/github/Milestone.py", "src/github/NamedUser.py", "src/github/Organization.py", "src/github/Permissions.py", "src/github/Plan.py", "src/github/PullRequest.py", "src/github/PullRequestComment.py", "src/github/PullRequestFile.py", "src/github/Repository.py", "src/github/RepositoryKey.py", "src/github/Tag.py", "src/github/Team.py", "src/github/UserKey.py", "test/Issue.py", "test/IssueEvent.py", "test/ReplayData/Issue.testAddAndRemoveLabels.txt", "test/ReplayData/Issue.testDeleteAndSetLabels.txt", "test/ReplayData/Issue.testGetLabels.txt", "test/ReplayData/IssueEvent.setUp.txt"])
- def testMerge( self ):
- self.assertFalse( self.pull.is_merged() )
+ def testMerge(self):
+ self.assertFalse(self.pull.is_merged())
status = self.pull.merge()
- self.assertEqual( status.sha, "688208b1a5a074871d0e9376119556897439697d" )
- self.assertEqual( status.merged, True )
- self.assertEqual( status.message, "Pull Request successfully merged" )
- self.assertTrue( self.pull.is_merged() )
+ self.assertEqual(status.sha, "688208b1a5a074871d0e9376119556897439697d")
+ self.assertEqual(status.merged, True)
+ self.assertEqual(status.message, "Pull Request successfully merged")
+ self.assertTrue(self.pull.is_merged())
- def testMergeWithCommitMessage( self ):
- self.g.get_user().get_repo( "PyGithub" ).get_pull( 39 ).merge( "Custom commit message created by PyGithub" )
+ def testMergeWithCommitMessage(self):
+ self.g.get_user().get_repo("PyGithub").get_pull(39).merge("Custom commit message created by PyGithub")
diff --git a/github/tests/PullRequestComment.py b/github/tests/PullRequestComment.py
index 920f46f3..1830f110 100644
--- a/github/tests/PullRequestComment.py
+++ b/github/tests/PullRequestComment.py
@@ -15,27 +15,28 @@ import Framework
import datetime
-class PullRequestComment( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.comment = self.g.get_user().get_repo( "PyGithub" ).get_pull( 31 ).get_comment( 886298 )
- def testAttributes( self ):
- self.assertEqual( self.comment.body, "Comment created by PyGithub" )
- self.assertEqual( self.comment.commit_id, "8a4f306d4b223682dd19410d4a9150636ebe4206" )
- self.assertEqual( self.comment.created_at, datetime.datetime( 2012, 5, 27, 9, 40, 12 ) )
- self.assertEqual( self.comment.id, 886298 )
- self.assertEqual( self.comment.original_commit_id, "8a4f306d4b223682dd19410d4a9150636ebe4206" )
- self.assertEqual( self.comment.original_position, 5 )
- self.assertEqual( self.comment.path, "src/github/Issue.py" )
- self.assertEqual( self.comment.position, 5 )
- self.assertEqual( self.comment.updated_at, datetime.datetime( 2012, 5, 27, 9, 40, 12 ) )
- self.assertEqual( self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298" )
- self.assertEqual( self.comment.user.login, "jacquev6" )
+class PullRequestComment(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.comment = self.g.get_user().get_repo("PyGithub").get_pull(31).get_comment(886298)
- def testEdit( self ):
- self.comment.edit( "Comment edited by PyGithub" )
- self.assertEqual( self.comment.body, "Comment edited by PyGithub" )
+ def testAttributes(self):
+ self.assertEqual(self.comment.body, "Comment created by PyGithub")
+ self.assertEqual(self.comment.commit_id, "8a4f306d4b223682dd19410d4a9150636ebe4206")
+ self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 27, 9, 40, 12))
+ self.assertEqual(self.comment.id, 886298)
+ self.assertEqual(self.comment.original_commit_id, "8a4f306d4b223682dd19410d4a9150636ebe4206")
+ self.assertEqual(self.comment.original_position, 5)
+ self.assertEqual(self.comment.path, "src/github/Issue.py")
+ self.assertEqual(self.comment.position, 5)
+ self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 27, 9, 40, 12))
+ self.assertEqual(self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298")
+ self.assertEqual(self.comment.user.login, "jacquev6")
- def testDelete( self ): # Test PullRequest.get_comments before
+ def testEdit(self):
+ self.comment.edit("Comment edited by PyGithub")
+ self.assertEqual(self.comment.body, "Comment edited by PyGithub")
+
+ def testDelete(self):
self.comment.delete()
diff --git a/github/tests/PullRequestFile.py b/github/tests/PullRequestFile.py
index c4fbae7d..4ebb09ed 100644
--- a/github/tests/PullRequestFile.py
+++ b/github/tests/PullRequestFile.py
@@ -13,18 +13,19 @@
import Framework
-class PullRequestFile( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.file = self.g.get_user().get_repo( "PyGithub" ).get_pull( 31 ).get_files()[ 0 ]
- def testAttributes( self ):
- self.assertEqual( self.file.additions, 1 )
- self.assertEqual( self.file.blob_url, "https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py" )
- self.assertEqual( self.file.changes, 2 )
- self.assertEqual( self.file.deletions, 1 )
- self.assertEqual( self.file.filename, "codegen/templates/GithubObject.py" )
- self.assertEqual( self.file.patch, '@@ -70,7 +70,7 @@ def __useAttributes( self, attributes ):\n \n # @toto No need to check if attribute is in attributes when attribute is mandatory\n {% for attribute in class.attributes|dictsort:"name" %}\n- if "{{ attribute.name }}" in attributes and attributes[ "{{ attribute.name }}" ] is not None:\n+ if "{{ attribute.name }}" in attributes and attributes[ "{{ attribute.name }}" ] is not None: # pragma no branch\n \n {% if attribute.type.cardinality == "scalar" %}\n {% if attribute.type.simple %}' )
- self.assertEqual( self.file.raw_url, "https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py" )
- self.assertEqual( self.file.sha, "8a4f306d4b223682dd19410d4a9150636ebe4206" )
- self.assertEqual( self.file.status, "modified" )
+class PullRequestFile(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.file = self.g.get_user().get_repo("PyGithub").get_pull(31).get_files()[0]
+
+ def testAttributes(self):
+ self.assertEqual(self.file.additions, 1)
+ self.assertEqual(self.file.blob_url, "https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py")
+ self.assertEqual(self.file.changes, 2)
+ self.assertEqual(self.file.deletions, 1)
+ self.assertEqual(self.file.filename, "codegen/templates/GithubObject.py")
+ self.assertEqual(self.file.patch, '@@ -70,7 +70,7 @@ def __useAttributes( self, attributes ):\n \n # @toto No need to check if attribute is in attributes when attribute is mandatory\n {% for attribute in class.attributes|dictsort:"name" %}\n- if "{{ attribute.name }}" in attributes and attributes[ "{{ attribute.name }}" ] is not None:\n+ if "{{ attribute.name }}" in attributes and attributes[ "{{ attribute.name }}" ] is not None: # pragma no branch\n \n {% if attribute.type.cardinality == "scalar" %}\n {% if attribute.type.simple %}')
+ self.assertEqual(self.file.raw_url, "https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py")
+ self.assertEqual(self.file.sha, "8a4f306d4b223682dd19410d4a9150636ebe4206")
+ self.assertEqual(self.file.status, "modified")
diff --git a/github/tests/RateLimiting.py b/github/tests/RateLimiting.py
index 3cda5ca1..7f3c2e0b 100644
--- a/github/tests/RateLimiting.py
+++ b/github/tests/RateLimiting.py
@@ -13,8 +13,9 @@
import Framework
-class RateLimiting( Framework.TestCase ):
- def testRateLimiting( self ):
- self.assertEqual( self.g.rate_limiting, ( 5000, 5000 ) )
- self.g.get_user( "jacquev6" )
- self.assertEqual( self.g.rate_limiting, ( 4999, 5000 ) )
+
+class RateLimiting(Framework.TestCase):
+ def testRateLimiting(self):
+ self.assertEqual(self.g.rate_limiting, (5000, 5000))
+ self.g.get_user("jacquev6")
+ self.assertEqual(self.g.rate_limiting, (4999, 5000))
diff --git a/github/tests/Repository.py b/github/tests/Repository.py
index a216befd..9835973a 100644
--- a/github/tests/Repository.py
+++ b/github/tests/Repository.py
@@ -16,227 +16,228 @@ import Framework
import github
import datetime
-class Repository( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.repo = self.g.get_user().get_repo( "PyGithub" )
- def testAttributes( self ):
- self.assertEqual( self.repo.clone_url, "https://github.com/jacquev6/PyGithub.git" )
- self.assertEqual( self.repo.created_at, datetime.datetime( 2012, 2, 25, 12, 53, 47 ) )
- self.assertEqual( self.repo.description, "Python library implementing the full Github API v3" )
- self.assertEqual( self.repo.fork, False )
- self.assertEqual( self.repo.forks, 3 )
- self.assertEqual( self.repo.full_name, "jacquev6/PyGithub" )
- self.assertEqual( self.repo.git_url, "git://github.com/jacquev6/PyGithub.git" )
- self.assertEqual( self.repo.has_downloads, True )
- self.assertEqual( self.repo.has_issues, True )
- self.assertEqual( self.repo.has_wiki, False )
- self.assertEqual( self.repo.homepage, "http://vincent-jacques.net/PyGithub" )
- self.assertEqual( self.repo.html_url, "https://github.com/jacquev6/PyGithub" )
- self.assertEqual( self.repo.id, 3544490 )
- self.assertEqual( self.repo.language, "Python" )
- self.assertEqual( self.repo.master_branch, None )
- self.assertEqual( self.repo.name, "PyGithub" )
- self.assertEqual( self.repo.open_issues, 16 )
- self.assertEqual( self.repo.organization, None )
- self.assertEqual( self.repo.owner.login, "jacquev6" )
- self.assertEqual( self.repo.parent, None )
- self.assertEqual( self.repo.permissions.admin, True )
- self.assertEqual( self.repo.permissions.pull, True )
- self.assertEqual( self.repo.permissions.push, True )
- self.assertEqual( self.repo.private, False )
- self.assertEqual( self.repo.pushed_at, datetime.datetime( 2012, 5, 27, 6, 0, 28 ) )
- self.assertEqual( self.repo.size, 308 )
- self.assertEqual( self.repo.source, None )
- self.assertEqual( self.repo.ssh_url, "git@github.com:jacquev6/PyGithub.git" )
- self.assertEqual( self.repo.svn_url, "https://github.com/jacquev6/PyGithub" )
- self.assertEqual( self.repo.updated_at, datetime.datetime( 2012, 5, 27, 6, 55, 28 ) )
- self.assertEqual( self.repo.url, "https://api.github.com/repos/jacquev6/PyGithub" )
- self.assertEqual( self.repo.watchers, 15 )
+class Repository(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.repo = self.g.get_user().get_repo("PyGithub")
- def testEditWithoutArguments( self ):
- self.repo.edit( "PyGithub" )
+ def testAttributes(self):
+ self.assertEqual(self.repo.clone_url, "https://github.com/jacquev6/PyGithub.git")
+ self.assertEqual(self.repo.created_at, datetime.datetime(2012, 2, 25, 12, 53, 47))
+ self.assertEqual(self.repo.description, "Python library implementing the full Github API v3")
+ self.assertEqual(self.repo.fork, False)
+ self.assertEqual(self.repo.forks, 3)
+ self.assertEqual(self.repo.full_name, "jacquev6/PyGithub")
+ self.assertEqual(self.repo.git_url, "git://github.com/jacquev6/PyGithub.git")
+ self.assertEqual(self.repo.has_downloads, True)
+ self.assertEqual(self.repo.has_issues, True)
+ self.assertEqual(self.repo.has_wiki, False)
+ self.assertEqual(self.repo.homepage, "http://vincent-jacques.net/PyGithub")
+ self.assertEqual(self.repo.html_url, "https://github.com/jacquev6/PyGithub")
+ self.assertEqual(self.repo.id, 3544490)
+ self.assertEqual(self.repo.language, "Python")
+ self.assertEqual(self.repo.master_branch, None)
+ self.assertEqual(self.repo.name, "PyGithub")
+ self.assertEqual(self.repo.open_issues, 16)
+ self.assertEqual(self.repo.organization, None)
+ self.assertEqual(self.repo.owner.login, "jacquev6")
+ self.assertEqual(self.repo.parent, None)
+ self.assertEqual(self.repo.permissions.admin, True)
+ self.assertEqual(self.repo.permissions.pull, True)
+ self.assertEqual(self.repo.permissions.push, True)
+ self.assertEqual(self.repo.private, False)
+ self.assertEqual(self.repo.pushed_at, datetime.datetime(2012, 5, 27, 6, 0, 28))
+ self.assertEqual(self.repo.size, 308)
+ self.assertEqual(self.repo.source, None)
+ self.assertEqual(self.repo.ssh_url, "git@github.com:jacquev6/PyGithub.git")
+ self.assertEqual(self.repo.svn_url, "https://github.com/jacquev6/PyGithub")
+ self.assertEqual(self.repo.updated_at, datetime.datetime(2012, 5, 27, 6, 55, 28))
+ self.assertEqual(self.repo.url, "https://api.github.com/repos/jacquev6/PyGithub")
+ self.assertEqual(self.repo.watchers, 15)
- def testEditWithAllArguments( self ):
- self.repo.edit( "PyGithub", "Description edited by PyGithub", "http://vincent-jacques.net/PyGithub", public = True, has_issues = True, has_wiki = False, has_downloads = True )
- self.assertEqual( self.repo.description, "Description edited by PyGithub" )
- self.repo.edit( "PyGithub", "Python library implementing the full Github API v3" )
- self.assertEqual( self.repo.description, "Python library implementing the full Github API v3" )
+ def testEditWithoutArguments(self):
+ self.repo.edit("PyGithub")
- def testDelete( self ):
- repo = self.g.get_user().get_repo( "TestPyGithub" )
+ def testEditWithAllArguments(self):
+ self.repo.edit("PyGithub", "Description edited by PyGithub", "http://vincent-jacques.net/PyGithub", public=True, has_issues=True, has_wiki=False, has_downloads=True)
+ self.assertEqual(self.repo.description, "Description edited by PyGithub")
+ self.repo.edit("PyGithub", "Python library implementing the full Github API v3")
+ self.assertEqual(self.repo.description, "Python library implementing the full Github API v3")
+
+ def testDelete(self):
+ repo = self.g.get_user().get_repo("TestPyGithub")
repo.delete()
- def testGetContributors( self ):
- self.assertListKeyEqual( self.repo.get_contributors(), lambda c: ( c.login, c.contributions ), [ ( "jacquev6", 355 ) ] )
+ def testGetContributors(self):
+ self.assertListKeyEqual(self.repo.get_contributors(), lambda c: (c.login, c.contributions), [("jacquev6", 355)])
- def testCreateMilestone( self ):
- milestone = self.repo.create_milestone( "Milestone created by PyGithub", state = "open", description = "Description created by PyGithub", due_on = datetime.date( 2012, 6, 15 ) )
- self.assertEqual( milestone.number, 5 )
+ def testCreateMilestone(self):
+ milestone = self.repo.create_milestone("Milestone created by PyGithub", state="open", description="Description created by PyGithub", due_on=datetime.date(2012, 6, 15))
+ self.assertEqual(milestone.number, 5)
- def testCreateMilestoneWithMinimalArguments( self ):
- milestone = self.repo.create_milestone( "Milestone also created by PyGithub" )
- self.assertEqual( milestone.number, 6 )
+ def testCreateMilestoneWithMinimalArguments(self):
+ milestone = self.repo.create_milestone("Milestone also created by PyGithub")
+ self.assertEqual(milestone.number, 6)
- def testCreateIssue( self ):
- issue = self.repo.create_issue( "Issue created by PyGithub" )
- self.assertEqual( issue.number, 28 )
+ def testCreateIssue(self):
+ issue = self.repo.create_issue("Issue created by PyGithub")
+ self.assertEqual(issue.number, 28)
- def testCreateIssueWithAllArguments( self ):
- user = self.g.get_user( "jacquev6" )
- milestone = self.repo.get_milestone( 2 )
- question = self.repo.get_label( "Question" )
- issue = self.repo.create_issue( "Issue also created by PyGithub", "Body created by PyGithub", user, milestone, [ question ] )
- self.assertEqual( issue.number, 30 )
+ def testCreateIssueWithAllArguments(self):
+ user = self.g.get_user("jacquev6")
+ milestone = self.repo.get_milestone(2)
+ question = self.repo.get_label("Question")
+ issue = self.repo.create_issue("Issue also created by PyGithub", "Body created by PyGithub", user, milestone, [question])
+ self.assertEqual(issue.number, 30)
- def testCreateLabel( self ):
- label = self.repo.create_label( "Label with silly name % * + created by PyGithub", "00ff00" )
- self.assertEqual( label.color, "00ff00" )
- self.assertEqual( label.name, "Label with silly name % * + created by PyGithub" )
- self.assertEqual( label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub" )
+ def testCreateLabel(self):
+ label = self.repo.create_label("Label with silly name % * + created by PyGithub", "00ff00")
+ self.assertEqual(label.color, "00ff00")
+ self.assertEqual(label.name, "Label with silly name % * + created by PyGithub")
+ self.assertEqual(label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub")
- def testGetLabel( self ):
- label = self.repo.get_label( "Label with silly name % * + created by PyGithub" )
- self.assertEqual( label.color, "00ff00" )
- self.assertEqual( label.name, "Label with silly name % * + created by PyGithub" )
- self.assertEqual( label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub" )
+ def testGetLabel(self):
+ label = self.repo.get_label("Label with silly name % * + created by PyGithub")
+ self.assertEqual(label.color, "00ff00")
+ self.assertEqual(label.name, "Label with silly name % * + created by PyGithub")
+ self.assertEqual(label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub")
- def testCreateHookWithMinimalParameters( self ):
- hook = self.repo.create_hook( "web", { "url": "http://foobar.com" } )
- self.assertEqual( hook.id, 257967 )
+ def testCreateHookWithMinimalParameters(self):
+ hook = self.repo.create_hook("web", {"url": "http://foobar.com"})
+ self.assertEqual(hook.id, 257967)
- def testCreateHookWithAllParameters( self ):
- hook = self.repo.create_hook( "web", { "url": "http://foobar.com" }, [ "fork" ], False )
- self.assertEqual( hook.active, True ) # WTF
- self.assertEqual( hook.id, 257993 )
+ def testCreateHookWithAllParameters(self):
+ hook = self.repo.create_hook("web", {"url": "http://foobar.com"}, ["fork"], False)
+ self.assertEqual(hook.active, True) # WTF
+ self.assertEqual(hook.id, 257993)
- def testCreateDownloadWithMinimalArguments( self ):
- download = self.repo.create_download( "Foobar.txt", 1024 )
- self.assertEqual( download.id, 242562 )
+ def testCreateDownloadWithMinimalArguments(self):
+ download = self.repo.create_download("Foobar.txt", 1024)
+ self.assertEqual(download.id, 242562)
- def testCreateDownloadWithAllArguments( self ):
- download = self.repo.create_download( "Foobar.txt", 1024, "Download created by PyGithub", "text/richtext" )
- self.assertEqual( download.accesskeyid, "1DWESVTPGHQVTX38V182" )
- self.assertEqual( download.acl, "public-read" )
- self.assertEqual( download.bucket, "github" )
- self.assertEqual( download.content_type, "text/richtext" )
- self.assertEqual( download.created_at, datetime.datetime( 2012, 5, 22, 19, 11, 49 ) )
- self.assertEqual( download.description, "Download created by PyGithub" )
- self.assertEqual( download.download_count, 0 )
- self.assertEqual( download.expirationdate, datetime.datetime( 2112, 5, 22, 19, 11, 49 ) )
- self.assertEqual( download.html_url, "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt" )
- self.assertEqual( download.id, 242556 )
- self.assertEqual( download.mime_type, "text/richtext" )
- self.assertEqual( download.name, "Foobar.txt" )
- self.assertEqual( download.path, "downloads/jacquev6/PyGithub/Foobar.txt" )
- self.assertEqual( download.policy, "ewogICAgJ2V4cGlyYXRpb24nOiAnMjExMi0wNS0yMlQxOToxMTo0OS4wMDBaJywKICAgICdjb25kaXRpb25zJzogWwogICAgICAgIHsnYnVja2V0JzogJ2dpdGh1Yid9LAogICAgICAgIHsna2V5JzogJ2Rvd25sb2Fkcy9qYWNxdWV2Ni9QeUdpdGh1Yi9Gb29iYXIudHh0J30sCiAgICAgICAgeydhY2wnOiAncHVibGljLXJlYWQnfSwKICAgICAgICB7J3N1Y2Nlc3NfYWN0aW9uX3N0YXR1cyc6ICcyMDEnfSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRGaWxlbmFtZScsICcnXSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRDb250ZW50LVR5cGUnLCAnJ10KICAgIF0KfQ==" )
- self.assertEqual( download.prefix, "downloads/jacquev6/PyGithub" )
- self.assertEqual( download.redirect, False )
- self.assertEqual( download.s3_url, "https://github.s3.amazonaws.com/" )
- self.assertEqual( download.signature, "8FCU/4rgT3ohXfE9N6HO7JgbuK4=" )
- self.assertEqual( download.size, 1024 )
- self.assertEqual( download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242556" )
+ def testCreateDownloadWithAllArguments(self):
+ download = self.repo.create_download("Foobar.txt", 1024, "Download created by PyGithub", "text/richtext")
+ self.assertEqual(download.accesskeyid, "1DWESVTPGHQVTX38V182")
+ self.assertEqual(download.acl, "public-read")
+ self.assertEqual(download.bucket, "github")
+ self.assertEqual(download.content_type, "text/richtext")
+ self.assertEqual(download.created_at, datetime.datetime(2012, 5, 22, 19, 11, 49))
+ self.assertEqual(download.description, "Download created by PyGithub")
+ self.assertEqual(download.download_count, 0)
+ self.assertEqual(download.expirationdate, datetime.datetime(2112, 5, 22, 19, 11, 49))
+ self.assertEqual(download.html_url, "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt")
+ self.assertEqual(download.id, 242556)
+ self.assertEqual(download.mime_type, "text/richtext")
+ self.assertEqual(download.name, "Foobar.txt")
+ self.assertEqual(download.path, "downloads/jacquev6/PyGithub/Foobar.txt")
+ self.assertEqual(download.policy, "ewogICAgJ2V4cGlyYXRpb24nOiAnMjExMi0wNS0yMlQxOToxMTo0OS4wMDBaJywKICAgICdjb25kaXRpb25zJzogWwogICAgICAgIHsnYnVja2V0JzogJ2dpdGh1Yid9LAogICAgICAgIHsna2V5JzogJ2Rvd25sb2Fkcy9qYWNxdWV2Ni9QeUdpdGh1Yi9Gb29iYXIudHh0J30sCiAgICAgICAgeydhY2wnOiAncHVibGljLXJlYWQnfSwKICAgICAgICB7J3N1Y2Nlc3NfYWN0aW9uX3N0YXR1cyc6ICcyMDEnfSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRGaWxlbmFtZScsICcnXSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRDb250ZW50LVR5cGUnLCAnJ10KICAgIF0KfQ==")
+ self.assertEqual(download.prefix, "downloads/jacquev6/PyGithub")
+ self.assertEqual(download.redirect, False)
+ self.assertEqual(download.s3_url, "https://github.s3.amazonaws.com/")
+ self.assertEqual(download.signature, "8FCU/4rgT3ohXfE9N6HO7JgbuK4=")
+ self.assertEqual(download.size, 1024)
+ self.assertEqual(download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242556")
- def testCreateGitRef( self ):
- ref = self.repo.create_git_ref( "refs/heads/BranchCreatedByPyGithub", "4303c5b90e2216d927155e9609436ccb8984c495" )
- self.assertEqual( ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub" )
+ def testCreateGitRef(self):
+ ref = self.repo.create_git_ref("refs/heads/BranchCreatedByPyGithub", "4303c5b90e2216d927155e9609436ccb8984c495")
+ self.assertEqual(ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub")
- def testCreateGitBlob( self ):
- blob = self.repo.create_git_blob( "Blob created by PyGithub", "latin1" )
- self.assertEqual( blob.sha, "5dd930f591cd5188e9ea7200e308ad355182a1d8" )
+ def testCreateGitBlob(self):
+ blob = self.repo.create_git_blob("Blob created by PyGithub", "latin1")
+ self.assertEqual(blob.sha, "5dd930f591cd5188e9ea7200e308ad355182a1d8")
- def testCreateGitTree( self ):
+ def testCreateGitTree(self):
tree = self.repo.create_git_tree(
- [ github.InputGitTreeElement(
+ [github.InputGitTreeElement(
"Foobar.txt",
"100644",
"blob",
- content = "File created by PyGithub"
- ) ]
+ content="File created by PyGithub"
+ )]
)
- self.assertEqual( tree.sha, "41cf8c178c636a018d537cb20daae09391efd70b" )
+ self.assertEqual(tree.sha, "41cf8c178c636a018d537cb20daae09391efd70b")
- def testCreateGitTreeWithBaseTree( self ):
- base_tree = self.repo.get_git_tree( "41cf8c178c636a018d537cb20daae09391efd70b" )
+ def testCreateGitTreeWithBaseTree(self):
+ base_tree = self.repo.get_git_tree("41cf8c178c636a018d537cb20daae09391efd70b")
tree = self.repo.create_git_tree(
- [ github.InputGitTreeElement(
+ [github.InputGitTreeElement(
"Barbaz.txt",
"100644",
"blob",
- content = "File also created by PyGithub"
- ) ],
+ content="File also created by PyGithub"
+ )],
base_tree
)
- self.assertEqual( tree.sha, "107139a922f33bab6fbeb9f9eb8787e7f19e0528" )
+ self.assertEqual(tree.sha, "107139a922f33bab6fbeb9f9eb8787e7f19e0528")
- def testCreateGitTreeWithSha( self ):
+ def testCreateGitTreeWithSha(self):
tree = self.repo.create_git_tree(
- [ github.InputGitTreeElement(
+ [github.InputGitTreeElement(
"Barbaz.txt",
"100644",
"blob",
- sha = "5dd930f591cd5188e9ea7200e308ad355182a1d8"
- ) ]
+ sha="5dd930f591cd5188e9ea7200e308ad355182a1d8"
+ )]
)
- self.assertEqual( tree.sha, "fae707821159639589bf94f3fb0a7154ec5d441b" )
+ self.assertEqual(tree.sha, "fae707821159639589bf94f3fb0a7154ec5d441b")
- def testCreateGitCommit( self ):
- tree = self.repo.get_git_tree( "107139a922f33bab6fbeb9f9eb8787e7f19e0528" )
- commit = self.repo.create_git_commit( "Commit created by PyGithub", tree, [] )
- self.assertEqual( commit.sha, "0b820628236ab8bab3890860fc414fa757ca15f4" )
+ def testCreateGitCommit(self):
+ tree = self.repo.get_git_tree("107139a922f33bab6fbeb9f9eb8787e7f19e0528")
+ commit = self.repo.create_git_commit("Commit created by PyGithub", tree, [])
+ self.assertEqual(commit.sha, "0b820628236ab8bab3890860fc414fa757ca15f4")
- def testCreateGitCommitWithParents( self ):
+ def testCreateGitCommitWithParents(self):
parents = [
- self.repo.get_git_commit( "7248e66831d4ffe09ef1f30a1df59ec0a9331ece" ),
- self.repo.get_git_commit( "12d427464f8d91c8e981043a86ba8a2a9e7319ea" ),
+ self.repo.get_git_commit("7248e66831d4ffe09ef1f30a1df59ec0a9331ece"),
+ self.repo.get_git_commit("12d427464f8d91c8e981043a86ba8a2a9e7319ea"),
]
- tree = self.repo.get_git_tree( "fae707821159639589bf94f3fb0a7154ec5d441b" )
- commit = self.repo.create_git_commit( "Commit created by PyGithub", tree, parents )
- self.assertEqual( commit.sha, "6adf9ea25ff8a8f2a42bcb1c09e42526339037cd" )
+ tree = self.repo.get_git_tree("fae707821159639589bf94f3fb0a7154ec5d441b")
+ commit = self.repo.create_git_commit("Commit created by PyGithub", tree, parents)
+ self.assertEqual(commit.sha, "6adf9ea25ff8a8f2a42bcb1c09e42526339037cd")
- def testCreateGitCommitWithAllArguments( self ):
- tree = self.repo.get_git_tree( "107139a922f33bab6fbeb9f9eb8787e7f19e0528" )
- commit = self.repo.create_git_commit( "Commit created by PyGithub", tree, [], github.InputGitAuthor( "John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00" ), github.InputGitAuthor( "John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00" ) )
- self.assertEqual( commit.sha, "526946197ae9da59c6507cacd13ad6f1cfb686ea" )
+ def testCreateGitCommitWithAllArguments(self):
+ tree = self.repo.get_git_tree("107139a922f33bab6fbeb9f9eb8787e7f19e0528")
+ commit = self.repo.create_git_commit("Commit created by PyGithub", tree, [], github.InputGitAuthor("John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00"), github.InputGitAuthor("John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00"))
+ self.assertEqual(commit.sha, "526946197ae9da59c6507cacd13ad6f1cfb686ea")
- def testCreateGitTag( self ):
- tag = self.repo.create_git_tag( "TaggedByPyGithub", "Tag created by PyGithub", "0b820628236ab8bab3890860fc414fa757ca15f4", "commit" )
- self.assertEqual( tag.sha, "5ba561eaa2b7ca9015662510157b15d8f3b0232a" )
+ def testCreateGitTag(self):
+ tag = self.repo.create_git_tag("TaggedByPyGithub", "Tag created by PyGithub", "0b820628236ab8bab3890860fc414fa757ca15f4", "commit")
+ self.assertEqual(tag.sha, "5ba561eaa2b7ca9015662510157b15d8f3b0232a")
- def testCreateGitTagWithAllArguments( self ):
- tag = self.repo.create_git_tag( "TaggedByPyGithub2", "Tag also created by PyGithub", "526946197ae9da59c6507cacd13ad6f1cfb686ea", "commit", github.InputGitAuthor( "John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00" ) )
- self.assertEqual( tag.sha, "f0e99a8335fbc84c53366c4a681118468f266625" )
+ def testCreateGitTagWithAllArguments(self):
+ tag = self.repo.create_git_tag("TaggedByPyGithub2", "Tag also created by PyGithub", "526946197ae9da59c6507cacd13ad6f1cfb686ea", "commit", github.InputGitAuthor("John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00"))
+ self.assertEqual(tag.sha, "f0e99a8335fbc84c53366c4a681118468f266625")
- def testCreateKey( self ):
- key = self.repo.create_key( "Key added through PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE" )
- self.assertEqual( key.id, 2626761 )
+ def testCreateKey(self):
+ key = self.repo.create_key("Key added through PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE")
+ self.assertEqual(key.id, 2626761)
- def testCollaborators( self ):
- lyloa = self.g.get_user( "Lyloa" )
- self.assertFalse( self.repo.has_in_collaborators( lyloa ) )
- self.repo.add_to_collaborators( lyloa )
- self.assertTrue( self.repo.has_in_collaborators( lyloa ) )
- self.assertListKeyEqual( self.repo.get_collaborators(), lambda u: u.login, [ "jacquev6", "Lyloa" ] )
- self.repo.remove_from_collaborators( lyloa )
- self.assertFalse( self.repo.has_in_collaborators( lyloa ) )
+ def testCollaborators(self):
+ lyloa = self.g.get_user("Lyloa")
+ self.assertFalse(self.repo.has_in_collaborators(lyloa))
+ self.repo.add_to_collaborators(lyloa)
+ self.assertTrue(self.repo.has_in_collaborators(lyloa))
+ self.assertListKeyEqual(self.repo.get_collaborators(), lambda u: u.login, ["jacquev6", "Lyloa"])
+ self.repo.remove_from_collaborators(lyloa)
+ self.assertFalse(self.repo.has_in_collaborators(lyloa))
- def testCompare( self ):
- comparison = self.repo.compare( "v0.6", "v0.7" )
- self.assertEqual( comparison.status, "ahead" )
- self.assertEqual( comparison.ahead_by, 4 )
- self.assertEqual( comparison.behind_by, 0 )
- self.assertEqual( comparison.diff_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7.diff" )
- self.assertEqual( comparison.html_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7" )
- self.assertEqual( comparison.url, "https://api.github.com/repos/jacquev6/PyGithub/compare/v0.6...v0.7" )
- self.assertEqual( comparison.patch_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7.patch" )
- self.assertEqual( comparison.permalink_url, "https://github.com/jacquev6/PyGithub/compare/jacquev6:4303c5b...jacquev6:ecda065" )
- self.assertEqual( comparison.total_commits, 4 )
- self.assertListKeyEqual( comparison.files, lambda f: f.filename, [ "ReferenceOfClasses.md", "github/Github.py", "github/Requester.py", "setup.py" ] )
- self.assertEqual( comparison.base_commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495" )
- self.assertListKeyEqual( comparison.commits, lambda c: c.sha, [ "5bb654d26dd014d36794acd1e6ecf3736f12aad7", "cb0313157bf904f2d364377d35d9397b269547a5", "0cec0d25e606c023a62a4fc7cdc815309ebf6d16", "ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7" ] )
+ def testCompare(self):
+ comparison = self.repo.compare("v0.6", "v0.7")
+ self.assertEqual(comparison.status, "ahead")
+ self.assertEqual(comparison.ahead_by, 4)
+ self.assertEqual(comparison.behind_by, 0)
+ self.assertEqual(comparison.diff_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7.diff")
+ self.assertEqual(comparison.html_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7")
+ self.assertEqual(comparison.url, "https://api.github.com/repos/jacquev6/PyGithub/compare/v0.6...v0.7")
+ self.assertEqual(comparison.patch_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7.patch")
+ self.assertEqual(comparison.permalink_url, "https://github.com/jacquev6/PyGithub/compare/jacquev6:4303c5b...jacquev6:ecda065")
+ self.assertEqual(comparison.total_commits, 4)
+ self.assertListKeyEqual(comparison.files, lambda f: f.filename, ["ReferenceOfClasses.md", "github/Github.py", "github/Requester.py", "setup.py"])
+ self.assertEqual(comparison.base_commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495")
+ self.assertListKeyEqual(comparison.commits, lambda c: c.sha, ["5bb654d26dd014d36794acd1e6ecf3736f12aad7", "cb0313157bf904f2d364377d35d9397b269547a5", "0cec0d25e606c023a62a4fc7cdc815309ebf6d16", "ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7"])
- def testGetComments( self ):
+ def testGetComments(self):
self.assertListKeyEqual(
self.repo.get_comments(),
lambda c: c.body,
@@ -248,158 +249,158 @@ class Repository( Framework.TestCase ):
]
)
- def testGetCommits( self ):
- self.assertListKeyBegin( self.repo.get_commits(), lambda c: c.sha, [ u'ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'cb0313157bf904f2d364377d35d9397b269547a5', u'5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'4303c5b90e2216d927155e9609436ccb8984c495', u'2a7e80e6421c5d4d201d60619068dea6bae612cb', u'0af24499a98e85f8ab2191898e8b809e5cebd4c5', u'e5ae923a68a9ae295ce5aa20b1227253de60e918', u'2f64b625f7e2afc9bef61d0decb459e2ef65c550', u'590798d349cba7de6e83b43aa5d4f8b0a38e685d', u'e7dca9143a23b8e2045a4a910a4a329007b10086', u'ab3f9b422cb3043d35cf6002fc9c042f8ead8c2a', u'632d8b63c32a2b79e87eb3b93e1ad228724de4bd', u'64c6a1e975e61b9c1449bed016cd19f33ee4b1c5', u'99963536fc81db3b9986c761b9dd08de22089aa2', u'8d57522bbd15d1fb6b616fae795cd8721deb1c4d', u'1140a91f3e45d09bc15463724f178a7ebf8e3149', u'936f4a97f1a86392637ec002bbf89ff036a5062d', u'e10470481795506e2c232720e2a9ecf588c8b567', u'e456549e5265406f8090ae5145255c8ca9ea5e4e', u'a91131be42eb328ae030f584af500f56aa08424b', u'2469c6e1aeb7919126a8271f6980b555b167e8b0', u'a655d0424135befd3a0d53f3f7eff2d1c754854f', u'ce62e91268aa34dad0ba0dbee4769933e3a71e50', u'1c88ee221b7f995855a1fdfac7d0ba19db918739', u'bd1a5dff3c547c634b2d89f5847218820e343883', u'b226b5b4e2f44107dde674e7a5d3e88d4e3518df', u'25dbd4053e982402c7d92139f167dbe46008c932', u'a0cc821c1beada4aa9ca0d5218664c5372720936', u'c1440bdf20bfeb62684c6d1779448719dce9d2df', u'1095d304b7fab3818dcb4c42093c8c56d3ac05e4', u'bd39726f7cf86ea7ffb33b5718241fdab5fc8f53', u'1d2b27824d20612066d84be42d6691c66bb18ef4', u'6af2bfd0d46bc0eeb8c37b85c7b3003e0e4ae297', u'a475d685d8ae709095d09094ea0962ac182d33f0', u'a85de99ea5b5e7b38bd68e076d09c49207b8687e', u'd24cf209ddd1758188c5f35344f76df818d09a46', u'0909fec395bb1f97e2580d6a029cfc64b352aff9', u'6e421e9e85e12008758870bc046bc2c6120af72a', u'32ed0ebc377efbed5b482b3d49ff54bf1715d55a', u'8213df1d744f251aa8e52229643a9f6ce352f3c0', u'69cc298fd159f19eb204dd09f17d31dc4abc3d41', u'85eef756353e13efcb24c726320cd2617c2a7bd8', u'50ac55b25ceba555b84709839f80447552450697', u'767d75a580279e457f9bc52bc308a17ff8ea0509', u'75e72ffa3066693291f7da03070666e8f885097a', u'504047e218e6b34a3828ccc408431634f17b9504', u'960db1d5c9853e9f5fbbc9237c2c166ceef1f080', u'877dde23e140bbf038f9a2d8f0f07b4e3a965c61', u'1c95ddfa09ec0aa1f07ee9ad50a77be1dd74b55e', u'99564c1cab139d1e4678f5f83f60d26f1210db7e', u'231926207709ceaa61e87b64e34e17d85adecd9c', u'fb722625dddb9a32f75190723f7da12683b7c4b2', u'cab9d71603e127bdd1f600a759dccea1781fa1ab', u'e648e5aeb5edc1fbf83e9d37d2a3cb57c005019a', u'4a5cf98e7f959f1b5d9af484760c25cd27d9180d', u'5d1add448e0b0b1dadb8c6094a9e5e19b255f67e', u'0d9fc99a4b5d1ec6473c9c81c888917c132ffa65', u'b56aa09011378b014221f86dffb8304957a9e6bd', u'3e8169c0a98ce1e2c6a32ae1256ae0f735065df5', u'378558f6cac6183b4a7100c0ce5eaad1cfff6717', u'58b4396aa0e7cb72911b75cb035798143a06e0ee', u'a3be28756101370fbc689eec3a7825c4c385a6c9', u'3d6bd49ce229243fea4bb46a937622d0ec7d4d1c', u'58cb0dbdef9765e0e913c726f923a47315aaf80e', u'7b7ac20c6fa27f72a24483c73ab1bf4deffc89f0', u'97f308e67383368a2d15788cac28e126c8528bb2', u'fc33a6de4f0e08d7ff2de05935517ec3932d212e', u'cc6d0fc044eadf2e6fde5da699f61654c1e691f3', u'2dd71f3777b87f2ba61cb20d2c67f10401e3eb2c', u'366ca58ca004b9129f9d435db8204ce0f5bc57c3', u'0d3b3ffd1e5c143af8725fdee808101f626f683d', u'157f9c13275738b6b39b8d7a874f5f0aee47cb18' ] )
+ def testGetCommits(self):
+ self.assertListKeyBegin(self.repo.get_commits(), lambda c: c.sha, [u'ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'cb0313157bf904f2d364377d35d9397b269547a5', u'5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'4303c5b90e2216d927155e9609436ccb8984c495', u'2a7e80e6421c5d4d201d60619068dea6bae612cb', u'0af24499a98e85f8ab2191898e8b809e5cebd4c5', u'e5ae923a68a9ae295ce5aa20b1227253de60e918', u'2f64b625f7e2afc9bef61d0decb459e2ef65c550', u'590798d349cba7de6e83b43aa5d4f8b0a38e685d', u'e7dca9143a23b8e2045a4a910a4a329007b10086', u'ab3f9b422cb3043d35cf6002fc9c042f8ead8c2a', u'632d8b63c32a2b79e87eb3b93e1ad228724de4bd', u'64c6a1e975e61b9c1449bed016cd19f33ee4b1c5', u'99963536fc81db3b9986c761b9dd08de22089aa2', u'8d57522bbd15d1fb6b616fae795cd8721deb1c4d', u'1140a91f3e45d09bc15463724f178a7ebf8e3149', u'936f4a97f1a86392637ec002bbf89ff036a5062d', u'e10470481795506e2c232720e2a9ecf588c8b567', u'e456549e5265406f8090ae5145255c8ca9ea5e4e', u'a91131be42eb328ae030f584af500f56aa08424b', u'2469c6e1aeb7919126a8271f6980b555b167e8b0', u'a655d0424135befd3a0d53f3f7eff2d1c754854f', u'ce62e91268aa34dad0ba0dbee4769933e3a71e50', u'1c88ee221b7f995855a1fdfac7d0ba19db918739', u'bd1a5dff3c547c634b2d89f5847218820e343883', u'b226b5b4e2f44107dde674e7a5d3e88d4e3518df', u'25dbd4053e982402c7d92139f167dbe46008c932', u'a0cc821c1beada4aa9ca0d5218664c5372720936', u'c1440bdf20bfeb62684c6d1779448719dce9d2df', u'1095d304b7fab3818dcb4c42093c8c56d3ac05e4', u'bd39726f7cf86ea7ffb33b5718241fdab5fc8f53', u'1d2b27824d20612066d84be42d6691c66bb18ef4', u'6af2bfd0d46bc0eeb8c37b85c7b3003e0e4ae297', u'a475d685d8ae709095d09094ea0962ac182d33f0', u'a85de99ea5b5e7b38bd68e076d09c49207b8687e', u'd24cf209ddd1758188c5f35344f76df818d09a46', u'0909fec395bb1f97e2580d6a029cfc64b352aff9', u'6e421e9e85e12008758870bc046bc2c6120af72a', u'32ed0ebc377efbed5b482b3d49ff54bf1715d55a', u'8213df1d744f251aa8e52229643a9f6ce352f3c0', u'69cc298fd159f19eb204dd09f17d31dc4abc3d41', u'85eef756353e13efcb24c726320cd2617c2a7bd8', u'50ac55b25ceba555b84709839f80447552450697', u'767d75a580279e457f9bc52bc308a17ff8ea0509', u'75e72ffa3066693291f7da03070666e8f885097a', u'504047e218e6b34a3828ccc408431634f17b9504', u'960db1d5c9853e9f5fbbc9237c2c166ceef1f080', u'877dde23e140bbf038f9a2d8f0f07b4e3a965c61', u'1c95ddfa09ec0aa1f07ee9ad50a77be1dd74b55e', u'99564c1cab139d1e4678f5f83f60d26f1210db7e', u'231926207709ceaa61e87b64e34e17d85adecd9c', u'fb722625dddb9a32f75190723f7da12683b7c4b2', u'cab9d71603e127bdd1f600a759dccea1781fa1ab', u'e648e5aeb5edc1fbf83e9d37d2a3cb57c005019a', u'4a5cf98e7f959f1b5d9af484760c25cd27d9180d', u'5d1add448e0b0b1dadb8c6094a9e5e19b255f67e', u'0d9fc99a4b5d1ec6473c9c81c888917c132ffa65', u'b56aa09011378b014221f86dffb8304957a9e6bd', u'3e8169c0a98ce1e2c6a32ae1256ae0f735065df5', u'378558f6cac6183b4a7100c0ce5eaad1cfff6717', u'58b4396aa0e7cb72911b75cb035798143a06e0ee', u'a3be28756101370fbc689eec3a7825c4c385a6c9', u'3d6bd49ce229243fea4bb46a937622d0ec7d4d1c', u'58cb0dbdef9765e0e913c726f923a47315aaf80e', u'7b7ac20c6fa27f72a24483c73ab1bf4deffc89f0', u'97f308e67383368a2d15788cac28e126c8528bb2', u'fc33a6de4f0e08d7ff2de05935517ec3932d212e', u'cc6d0fc044eadf2e6fde5da699f61654c1e691f3', u'2dd71f3777b87f2ba61cb20d2c67f10401e3eb2c', u'366ca58ca004b9129f9d435db8204ce0f5bc57c3', u'0d3b3ffd1e5c143af8725fdee808101f626f683d', u'157f9c13275738b6b39b8d7a874f5f0aee47cb18'])
- def testGetCommitsWithArguments( self ):
- self.assertListKeyEqual( self.repo.get_commits( "topic/RewriteWithGeneratedCode", "codegen/GenerateCode.py" ), lambda c: c.sha, [ "de386d5dc9cf103c90c4128eeca0e6abdd382065", "5b44982f6111bff2454243869df2e1c3086ccbba", "d6835ff949141957a733c8ddfa147026515ae493", "075d3d961d4614a2a0835d5583248adfc0687a7d", "8956796e7f462a49f499eac52fab901cdb59abdb", "283da5e7de6a4a3b6aaae7045909d70b643ad380", "d631e83b7901b0a0b6061b361130700a79505319" ] )
+ def testGetCommitsWithArguments(self):
+ self.assertListKeyEqual(self.repo.get_commits("topic/RewriteWithGeneratedCode", "codegen/GenerateCode.py"), lambda c: c.sha, ["de386d5dc9cf103c90c4128eeca0e6abdd382065", "5b44982f6111bff2454243869df2e1c3086ccbba", "d6835ff949141957a733c8ddfa147026515ae493", "075d3d961d4614a2a0835d5583248adfc0687a7d", "8956796e7f462a49f499eac52fab901cdb59abdb", "283da5e7de6a4a3b6aaae7045909d70b643ad380", "d631e83b7901b0a0b6061b361130700a79505319"])
- def testGetDownloads( self ):
- self.assertListKeyEqual( self.repo.get_downloads(), lambda d: d.id, [ 245143 ] )
+ def testGetDownloads(self):
+ self.assertListKeyEqual(self.repo.get_downloads(), lambda d: d.id, [245143])
- def testGetEvents( self ):
- self.assertListKeyBegin( self.repo.get_events(), lambda e: e.type, [ "DownloadEvent", "DownloadEvent", "PushEvent", "IssuesEvent", "MemberEvent", "MemberEvent" ] )
+ def testGetEvents(self):
+ self.assertListKeyBegin(self.repo.get_events(), lambda e: e.type, ["DownloadEvent", "DownloadEvent", "PushEvent", "IssuesEvent", "MemberEvent", "MemberEvent"])
- def testGetForks( self ):
- self.assertListKeyEqual( self.repo.get_forks(), lambda r: r.owner.login, [ "abersager" ] )
+ def testGetForks(self):
+ self.assertListKeyEqual(self.repo.get_forks(), lambda r: r.owner.login, ["abersager"])
- def testGetGitRefs( self ):
- self.assertListKeyEqual( self.repo.get_git_refs(), lambda r: r.ref, [ "refs/heads/develop", "refs/heads/master", "refs/heads/topic/DependencyGraph", "refs/heads/topic/RewriteWithGeneratedCode", "refs/tags/v0.1", "refs/tags/v0.2", "refs/tags/v0.3", "refs/tags/v0.4", "refs/tags/v0.5", "refs/tags/v0.6", "refs/tags/v0.7" ] )
+ def testGetGitRefs(self):
+ self.assertListKeyEqual(self.repo.get_git_refs(), lambda r: r.ref, ["refs/heads/develop", "refs/heads/master", "refs/heads/topic/DependencyGraph", "refs/heads/topic/RewriteWithGeneratedCode", "refs/tags/v0.1", "refs/tags/v0.2", "refs/tags/v0.3", "refs/tags/v0.4", "refs/tags/v0.5", "refs/tags/v0.6", "refs/tags/v0.7"])
- def testGetGitTreeWithRecursive( self ):
- tree = self.repo.get_git_tree( "f492784d8ca837779650d1fb406a1a3587a764ad", True )
- self.assertEqual( len( tree.tree ), 90 )
- self.assertEqual( tree.tree[ 50 ].path, "github/GithubObjects/Gist.py" )
+ def testGetGitTreeWithRecursive(self):
+ tree = self.repo.get_git_tree("f492784d8ca837779650d1fb406a1a3587a764ad", True)
+ self.assertEqual(len(tree.tree), 90)
+ self.assertEqual(tree.tree[50].path, "github/GithubObjects/Gist.py")
- def testGetHooks( self ):
- self.assertListKeyEqual( self.repo.get_hooks(), lambda h: h.id, [ 257993 ] )
+ def testGetHooks(self):
+ self.assertListKeyEqual(self.repo.get_hooks(), lambda h: h.id, [257993])
- def testGetIssues( self ):
- self.assertListKeyEqual( self.repo.get_issues(), lambda i: i.id, [ 4769659, 4639931, 4452000, 4356743, 3716033, 3715946, 3643837, 3628022, 3624595, 3624570, 3624561, 3624556, 3619973, 3527266, 3527245, 3527231 ] )
+ def testGetIssues(self):
+ self.assertListKeyEqual(self.repo.get_issues(), lambda i: i.id, [4769659, 4639931, 4452000, 4356743, 3716033, 3715946, 3643837, 3628022, 3624595, 3624570, 3624561, 3624556, 3619973, 3527266, 3527245, 3527231])
- def testGetIssuesWithArguments( self ):
- milestone = self.repo.get_milestone( 3 )
- user = self.g.get_user( "jacquev6" )
- otherUser = self.g.get_user( "Lyloa" )
- bug = self.repo.get_label( "Bug" )
- self.assertListKeyEqual( self.repo.get_issues( milestone, "closed" ), lambda i: i.id, [ 3624472, 3620132, 3619658, 3561926 ] )
- self.assertListKeyEqual( self.repo.get_issues( labels = [ bug ] ), lambda i: i.id, [ 4780155 ] )
- self.assertListKeyEqual( self.repo.get_issues( assignee = user, sort = "comments", direction = "asc" ), lambda i: i.id, [ 4793106, 3527231, 3527266, 3624556, 4793216, 3619973, 3624595, 4452000, 3643837, 3628022, 3527245, 4793162, 4356743, 4780155 ] )
- self.assertListKeyEqual( self.repo.get_issues( since = datetime.datetime( 2012, 5, 28, 23, 0, 0 ) ), lambda i: i.id, [ 4793216, 4793162, 4793106, 3624556, 3619973, 3527266 ] )
- self.assertListKeyEqual( self.repo.get_issues( mentioned = otherUser ), lambda i: i.id, [ 4793162 ] )
+ def testGetIssuesWithArguments(self):
+ milestone = self.repo.get_milestone(3)
+ user = self.g.get_user("jacquev6")
+ otherUser = self.g.get_user("Lyloa")
+ bug = self.repo.get_label("Bug")
+ self.assertListKeyEqual(self.repo.get_issues(milestone, "closed"), lambda i: i.id, [3624472, 3620132, 3619658, 3561926])
+ self.assertListKeyEqual(self.repo.get_issues(labels=[bug]), lambda i: i.id, [4780155])
+ self.assertListKeyEqual(self.repo.get_issues(assignee=user, sort="comments", direction="asc"), lambda i: i.id, [4793106, 3527231, 3527266, 3624556, 4793216, 3619973, 3624595, 4452000, 3643837, 3628022, 3527245, 4793162, 4356743, 4780155])
+ self.assertListKeyEqual(self.repo.get_issues(since=datetime.datetime(2012, 5, 28, 23, 0, 0)), lambda i: i.id, [4793216, 4793162, 4793106, 3624556, 3619973, 3527266])
+ self.assertListKeyEqual(self.repo.get_issues(mentioned=otherUser), lambda i: i.id, [4793162])
- def testGetIssuesWithWildcards( self ):
- self.assertListKeyEqual( self.repo.get_issues( milestone = "*" ), lambda i: i.id, [ 4809786, 4793216, 4789817, 4452000, 3628022, 3624595, 3619973, 3527231 ] )
- self.assertListKeyEqual( self.repo.get_issues( milestone = "none" ), lambda i: i.id, [ 4823331, 4809803, 4809778, 4793106, 3643837, 3527245 ] )
- self.assertListKeyEqual( self.repo.get_issues( assignee = "*" ), lambda i: i.id, [ 4823331, 4809803, 4809786, 4809778, 4793216, 4793106, 4789817, 4452000, 3643837, 3628022, 3624595, 3527245, 3527231 ] )
- self.assertListKeyEqual( self.repo.get_issues( assignee = "none" ), lambda i: i.id, [ 3619973 ] )
+ def testGetIssuesWithWildcards(self):
+ self.assertListKeyEqual(self.repo.get_issues(milestone="*"), lambda i: i.id, [4809786, 4793216, 4789817, 4452000, 3628022, 3624595, 3619973, 3527231])
+ self.assertListKeyEqual(self.repo.get_issues(milestone="none"), lambda i: i.id, [4823331, 4809803, 4809778, 4793106, 3643837, 3527245])
+ self.assertListKeyEqual(self.repo.get_issues(assignee="*"), lambda i: i.id, [4823331, 4809803, 4809786, 4809778, 4793216, 4793106, 4789817, 4452000, 3643837, 3628022, 3624595, 3527245, 3527231])
+ self.assertListKeyEqual(self.repo.get_issues(assignee="none"), lambda i: i.id, [3619973])
- def testGetKeys( self ):
- self.assertListKeyEqual( self.repo.get_keys(), lambda k: k.title, [ "Key added through PyGithub" ] )
+ def testGetKeys(self):
+ self.assertListKeyEqual(self.repo.get_keys(), lambda k: k.title, ["Key added through PyGithub"])
- def testGetLabels( self ):
- self.assertListKeyEqual( self.repo.get_labels(), lambda l: l.name, [ "Refactoring", "Public interface", "Functionalities", "Project management", "Bug", "Question" ] )
+ def testGetLabels(self):
+ self.assertListKeyEqual(self.repo.get_labels(), lambda l: l.name, ["Refactoring", "Public interface", "Functionalities", "Project management", "Bug", "Question"])
- def testGetLanguages( self ):
- self.assertEqual( self.repo.get_languages(), { "Python": 127266, "Shell": 673} )
+ def testGetLanguages(self):
+ self.assertEqual(self.repo.get_languages(), {"Python": 127266, "Shell": 673})
- def testGetMilestones( self ):
- self.assertListKeyEqual( self.repo.get_milestones(), lambda m: m.id, [ 93547 ] )
+ def testGetMilestones(self):
+ self.assertListKeyEqual(self.repo.get_milestones(), lambda m: m.id, [93547])
- def testGetMilestonesWithArguments( self ):
- self.assertListKeyEqual( self.repo.get_milestones( "closed", "due_date", "asc" ), lambda m: m.id, [ 93546, 95354, 108652, 124045 ] )
+ def testGetMilestonesWithArguments(self):
+ self.assertListKeyEqual(self.repo.get_milestones("closed", "due_date", "asc"), lambda m: m.id, [93546, 95354, 108652, 124045])
- def testGetIssuesEvents( self ):
- self.assertListKeyBegin( self.repo.get_issues_events(), lambda e: e.event, [ "assigned", "subscribed", "closed", "assigned", "closed" ] )
+ def testGetIssuesEvents(self):
+ self.assertListKeyBegin(self.repo.get_issues_events(), lambda e: e.event, ["assigned", "subscribed", "closed", "assigned", "closed"])
- def testGetNetworkEvents( self ):
- self.assertListKeyBegin( self.repo.get_network_events(), lambda e: e.type, [ "DownloadEvent", "DownloadEvent", "PushEvent", "IssuesEvent", "MemberEvent" ] )
+ def testGetNetworkEvents(self):
+ self.assertListKeyBegin(self.repo.get_network_events(), lambda e: e.type, ["DownloadEvent", "DownloadEvent", "PushEvent", "IssuesEvent", "MemberEvent"])
- def testGetTeams( self ):
- repo = self.g.get_organization( "BeaverSoftware" ).get_repo( "FatherBeaver" )
- self.assertListKeyEqual( repo.get_teams(), lambda t: t.name, [ "Members" ] )
+ def testGetTeams(self):
+ repo = self.g.get_organization("BeaverSoftware").get_repo("FatherBeaver")
+ self.assertListKeyEqual(repo.get_teams(), lambda t: t.name, ["Members"])
- def testGetWatchers( self ):
- self.assertListKeyEqual( self.repo.get_watchers(), lambda u: u.login, [ "Stals", "att14", "jardon-u", "huxley", "mikofski", "L42y", "fanzeyi", "abersager", "waylan", "adericbourg", "tallforasmurf", "pvicente", "roskakori", "michaelpedersen", "BeaverSoftware" ] )
+ def testGetWatchers(self):
+ self.assertListKeyEqual(self.repo.get_watchers(), lambda u: u.login, ["Stals", "att14", "jardon-u", "huxley", "mikofski", "L42y", "fanzeyi", "abersager", "waylan", "adericbourg", "tallforasmurf", "pvicente", "roskakori", "michaelpedersen", "BeaverSoftware"])
- def testGetStargazers( self ):
- self.assertListKeyEqual( self.repo.get_stargazers(), lambda u: u.login, [ "Stals", "att14", "jardon-u", "huxley", "mikofski", "L42y", "fanzeyi", "abersager", "waylan", "adericbourg", "tallforasmurf", "pvicente", "roskakori", "michaelpedersen", "stefanfoulis", "equus12", "JuRogn", "joshmoore", "jsilter", "dasapich", "ritratt", "hcilab", "vxnick", "pmuilu", "herlo", "malexw", "ahmetvurgun", "PengGu", "cosmin", "Swop", "kennethreitz", "bryandyck", "jason2506", "zsiciarz", "waawal", "gregorynicholas", "sente", "richmiller55", "thouis", "mazubieta", "michaelhood", "engie", "jtriley", "oangeor", "coryking", "noddi", "alejo8591", "omab", "Carreau", "bilderbuchi", "schwa", "rlerallut", "PengHub", "zoek1", "xobb1t", "notgary", "hattya", "ZebtinRis", "aaronhall", "youngsterxyf", "ailling", "gregwjacobs", "n0rmrx", "awylie", "firstthumb", "joshbrand", "berndca" ] )
+ def testGetStargazers(self):
+ self.assertListKeyEqual(self.repo.get_stargazers(), lambda u: u.login, ["Stals", "att14", "jardon-u", "huxley", "mikofski", "L42y", "fanzeyi", "abersager", "waylan", "adericbourg", "tallforasmurf", "pvicente", "roskakori", "michaelpedersen", "stefanfoulis", "equus12", "JuRogn", "joshmoore", "jsilter", "dasapich", "ritratt", "hcilab", "vxnick", "pmuilu", "herlo", "malexw", "ahmetvurgun", "PengGu", "cosmin", "Swop", "kennethreitz", "bryandyck", "jason2506", "zsiciarz", "waawal", "gregorynicholas", "sente", "richmiller55", "thouis", "mazubieta", "michaelhood", "engie", "jtriley", "oangeor", "coryking", "noddi", "alejo8591", "omab", "Carreau", "bilderbuchi", "schwa", "rlerallut", "PengHub", "zoek1", "xobb1t", "notgary", "hattya", "ZebtinRis", "aaronhall", "youngsterxyf", "ailling", "gregwjacobs", "n0rmrx", "awylie", "firstthumb", "joshbrand", "berndca"])
- def testGetSubscribers( self ):
- self.assertListKeyEqual( self.repo.get_subscribers(), lambda u: u.login, [ "jacquev6", "equus12", "bilderbuchi", "hcilab", "hattya", "firstthumb", "gregwjacobs", "sagarsane", "liang456", "berndca", "Lyloa" ] )
+ def testGetSubscribers(self):
+ self.assertListKeyEqual(self.repo.get_subscribers(), lambda u: u.login, ["jacquev6", "equus12", "bilderbuchi", "hcilab", "hattya", "firstthumb", "gregwjacobs", "sagarsane", "liang456", "berndca", "Lyloa"])
- def testCreatePull( self ):
- pull = self.repo.create_pull( "Pull request created by PyGithub", "Body of the pull request", "topic/RewriteWithGeneratedCode", "BeaverSoftware:master" )
- self.assertEqual( pull.id, 1436215 )
+ def testCreatePull(self):
+ pull = self.repo.create_pull("Pull request created by PyGithub", "Body of the pull request", "topic/RewriteWithGeneratedCode", "BeaverSoftware:master")
+ self.assertEqual(pull.id, 1436215)
- def testCreatePullFromIssue( self ):
- issue = self.repo.get_issue( 32 )
- pull = self.repo.create_pull( issue, "topic/RewriteWithGeneratedCode", "BeaverSoftware:master" )
- self.assertEqual( pull.id, 1436310 )
+ def testCreatePullFromIssue(self):
+ issue = self.repo.get_issue(32)
+ pull = self.repo.create_pull(issue, "topic/RewriteWithGeneratedCode", "BeaverSoftware:master")
+ self.assertEqual(pull.id, 1436310)
- def testGetPulls( self ):
- self.assertListKeyEqual( self.repo.get_pulls(), lambda p: p.id, [ 1436310 ] )
+ def testGetPulls(self):
+ self.assertListKeyEqual(self.repo.get_pulls(), lambda p: p.id, [1436310])
- def testGetPullsWithArguments( self ):
- self.assertListKeyEqual( self.repo.get_pulls( "closed" ), lambda p: p.id, [ 1448168, 1436310, 1436215 ] )
+ def testGetPullsWithArguments(self):
+ self.assertListKeyEqual(self.repo.get_pulls("closed"), lambda p: p.id, [1448168, 1436310, 1436215])
- def testLegacySearchIssues( self ):
- issues = self.repo.legacy_search_issues( "open", "search" )
- self.assertListKeyEqual( issues, lambda i: i.title, [ "Support new Search API" ] )
+ def testLegacySearchIssues(self):
+ issues = self.repo.legacy_search_issues("open", "search")
+ self.assertListKeyEqual(issues, lambda i: i.title, ["Support new Search API"])
# Attributes retrieved from legacy API without lazy completion call
- self.assertEqual( issues[ 0 ].number, 49 )
- self.assertEqual( issues[ 0 ].created_at, datetime.datetime( 2012, 6, 21, 12, 27, 38 ) )
- self.assertEqual( issues[ 0 ].comments, 4 )
- self.assertEqual( issues[ 0 ].body[ : 20 ], "New API ported from " )
- self.assertEqual( issues[ 0 ].title, "Support new Search API" )
- self.assertEqual( issues[ 0 ].updated_at, datetime.datetime( 2012, 6, 28, 21, 13, 25 ) )
- self.assertEqual( issues[ 0 ].user.login, "kukuts" )
- self.assertEqual( issues[ 0 ].user.url, "/users/kukuts" )
- self.assertListKeyEqual( issues[ 0 ].labels, lambda l: l.name, [ "Functionalities", "RequestedByUser" ] )
- self.assertEqual( issues[ 0 ].state, "open" )
+ self.assertEqual(issues[0].number, 49)
+ self.assertEqual(issues[0].created_at, datetime.datetime(2012, 6, 21, 12, 27, 38))
+ self.assertEqual(issues[0].comments, 4)
+ self.assertEqual(issues[0].body[: 20], "New API ported from ")
+ self.assertEqual(issues[0].title, "Support new Search API")
+ self.assertEqual(issues[0].updated_at, datetime.datetime(2012, 6, 28, 21, 13, 25))
+ self.assertEqual(issues[0].user.login, "kukuts")
+ self.assertEqual(issues[0].user.url, "/users/kukuts")
+ self.assertListKeyEqual(issues[0].labels, lambda l: l.name, ["Functionalities", "RequestedByUser"])
+ self.assertEqual(issues[0].state, "open")
- def testAssignees( self ):
- lyloa = self.g.get_user( "Lyloa" )
- jacquev6 = self.g.get_user( "jacquev6" )
- self.assertTrue( self.repo.has_in_assignees( jacquev6 ) )
- self.assertFalse( self.repo.has_in_assignees( lyloa ) )
- self.repo.add_to_collaborators( lyloa )
- self.assertTrue( self.repo.has_in_assignees( lyloa ) )
- self.assertListKeyEqual( self.repo.get_assignees(), lambda u: u.login, [ "jacquev6", "Lyloa" ] )
- self.repo.remove_from_collaborators( lyloa )
- self.assertFalse( self.repo.has_in_assignees( lyloa ) )
+ def testAssignees(self):
+ lyloa = self.g.get_user("Lyloa")
+ jacquev6 = self.g.get_user("jacquev6")
+ self.assertTrue(self.repo.has_in_assignees(jacquev6))
+ self.assertFalse(self.repo.has_in_assignees(lyloa))
+ self.repo.add_to_collaborators(lyloa)
+ self.assertTrue(self.repo.has_in_assignees(lyloa))
+ self.assertListKeyEqual(self.repo.get_assignees(), lambda u: u.login, ["jacquev6", "Lyloa"])
+ self.repo.remove_from_collaborators(lyloa)
+ self.assertFalse(self.repo.has_in_assignees(lyloa))
- def testGetContents( self ):
- self.assertEqual( len( self.repo.get_readme().content ), 10212 )
- self.assertEqual( len( self.repo.get_contents( "doc/ReferenceOfClasses.md" ).content ), 38121 )
+ def testGetContents(self):
+ self.assertEqual(len(self.repo.get_readme().content), 10212)
+ self.assertEqual(len(self.repo.get_contents("doc/ReferenceOfClasses.md").content), 38121)
- def testGetArchiveLink( self ):
- self.assertEqual( self.repo.get_archive_link( "tarball" ), "https://nodeload.github.com/jacquev6/PyGithub/tarball/master" )
- self.assertEqual( self.repo.get_archive_link( "zipball" ), "https://nodeload.github.com/jacquev6/PyGithub/zipball/master" )
- self.assertEqual( self.repo.get_archive_link( "zipball", "master" ), "https://nodeload.github.com/jacquev6/PyGithub/zipball/master" )
- self.assertEqual( self.repo.get_archive_link( "tarball", "develop" ), "https://nodeload.github.com/jacquev6/PyGithub/tarball/develop" )
+ def testGetArchiveLink(self):
+ self.assertEqual(self.repo.get_archive_link("tarball"), "https://nodeload.github.com/jacquev6/PyGithub/tarball/master")
+ self.assertEqual(self.repo.get_archive_link("zipball"), "https://nodeload.github.com/jacquev6/PyGithub/zipball/master")
+ self.assertEqual(self.repo.get_archive_link("zipball", "master"), "https://nodeload.github.com/jacquev6/PyGithub/zipball/master")
+ self.assertEqual(self.repo.get_archive_link("tarball", "develop"), "https://nodeload.github.com/jacquev6/PyGithub/tarball/develop")
- def testGetBranch( self ):
- branch = self.repo.get_branch( "develop" )
- self.assertEqual( branch.commit.sha, "03058a36164d2a7d946db205f25538434fa27d94" )
+ def testGetBranch(self):
+ branch = self.repo.get_branch("develop")
+ self.assertEqual(branch.commit.sha, "03058a36164d2a7d946db205f25538434fa27d94")
- def testMergeWithoutMessage( self ):
- commit = self.repo.merge( "branchForBase", "branchForHead" )
- self.assertEqual( commit.commit.message, "Merge branchForHead into branchForBase" )
+ def testMergeWithoutMessage(self):
+ commit = self.repo.merge("branchForBase", "branchForHead")
+ self.assertEqual(commit.commit.message, "Merge branchForHead into branchForBase")
- def testMergeWithMessage( self ):
- commit = self.repo.merge( "branchForBase", "branchForHead", "Commit message created by PyGithub" )
- self.assertEqual( commit.commit.message, "Commit message created by PyGithub" )
+ def testMergeWithMessage(self):
+ commit = self.repo.merge("branchForBase", "branchForHead", "Commit message created by PyGithub")
+ self.assertEqual(commit.commit.message, "Commit message created by PyGithub")
- def testMergeWithNothingToDo( self ):
- commit = self.repo.merge( "branchForBase", "branchForHead", "Commit message created by PyGithub" )
- self.assertEqual( commit, None )
+ def testMergeWithNothingToDo(self):
+ commit = self.repo.merge("branchForBase", "branchForHead", "Commit message created by PyGithub")
+ self.assertEqual(commit, None)
- def testMergeWithConflict( self ):
+ def testMergeWithConflict(self):
try:
- commit = self.repo.merge( "branchForBase", "branchForHead" )
- self.fail( "Should have raised" )
+ commit = self.repo.merge("branchForBase", "branchForHead")
+ self.fail("Should have raised")
except github.GithubException, exception:
- self.assertEqual( exception.status, 409 )
- self.assertEqual( exception.data, { "message": "Merge conflict" } )
+ self.assertEqual(exception.status, 409)
+ self.assertEqual(exception.data, {"message": "Merge conflict"})
diff --git a/github/tests/RepositoryKey.py b/github/tests/RepositoryKey.py
index 118df084..bfc82936 100644
--- a/github/tests/RepositoryKey.py
+++ b/github/tests/RepositoryKey.py
@@ -13,25 +13,26 @@
import Framework
-class RepositoryKey( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.key = self.g.get_user().get_repo( "PyGithub" ).get_key( 2626761 )
- def testAttributes( self ):
- self.assertEqual( self.key.id, 2626761 )
- self.assertEqual( self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==" )
- self.assertEqual( self.key.title, "Key added through PyGithub" )
- self.assertEqual( self.key.url, "https://api.github.com/user/keys/2626761" )
- self.assertEqual( self.key.verified, True )
+class RepositoryKey(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.key = self.g.get_user().get_repo("PyGithub").get_key(2626761)
- def testEdit( self ):
- self.key.edit( "Title edited by PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==" )
- self.assertEqual( self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==" )
- self.assertEqual( self.key.title, "Title edited by PyGithub" )
+ def testAttributes(self):
+ self.assertEqual(self.key.id, 2626761)
+ self.assertEqual(self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==")
+ self.assertEqual(self.key.title, "Key added through PyGithub")
+ self.assertEqual(self.key.url, "https://api.github.com/user/keys/2626761")
+ self.assertEqual(self.key.verified, True)
- def testEditWithoutParameters( self ):
+ def testEdit(self):
+ self.key.edit("Title edited by PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==")
+ self.assertEqual(self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==")
+ self.assertEqual(self.key.title, "Title edited by PyGithub")
+
+ def testEditWithoutParameters(self):
self.key.edit()
- def testDelete( self ):
+ def testDelete(self):
self.key.delete()
diff --git a/github/tests/Tag.py b/github/tests/Tag.py
index cee1e060..9421d343 100644
--- a/github/tests/Tag.py
+++ b/github/tests/Tag.py
@@ -13,13 +13,14 @@
import Framework
-class Tag( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.tag = self.g.get_user().get_repo( "PyGithub" ).get_tags()[ 0 ]
- def testAttributes( self ):
- self.assertEqual( self.tag.commit.sha, "636e6112deb72277b3bffcc3303cd7e8a7431a5d" )
- self.assertEqual( self.tag.name, "v0.3" )
- self.assertEqual( self.tag.tarball_url, "https://github.com/jacquev6/PyGithub/tarball/v0.3" )
- self.assertEqual( self.tag.zipball_url, "https://github.com/jacquev6/PyGithub/zipball/v0.3" )
+class Tag(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.tag = self.g.get_user().get_repo("PyGithub").get_tags()[0]
+
+ def testAttributes(self):
+ self.assertEqual(self.tag.commit.sha, "636e6112deb72277b3bffcc3303cd7e8a7431a5d")
+ self.assertEqual(self.tag.name, "v0.3")
+ self.assertEqual(self.tag.tarball_url, "https://github.com/jacquev6/PyGithub/tarball/v0.3")
+ self.assertEqual(self.tag.zipball_url, "https://github.com/jacquev6/PyGithub/zipball/v0.3")
diff --git a/github/tests/Team.py b/github/tests/Team.py
index 10b622a8..c2469886 100644
--- a/github/tests/Team.py
+++ b/github/tests/Team.py
@@ -13,50 +13,51 @@
import Framework
-class Team( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.org = self.g.get_organization( "BeaverSoftware" )
- self.team = self.org.get_team( 189850 )
- def testAttributes( self ):
- self.assertEqual( self.team.id, 189850 )
- self.assertEqual( self.team.members_count, 0 )
- self.assertEqual( self.team.name, "Team created by PyGithub" )
- self.assertEqual( self.team.permission, "pull" )
- self.assertEqual( self.team.repos_count, 0 )
- self.assertEqual( self.team.url, "https://api.github.com/teams/189850" )
+class Team(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.org = self.g.get_organization("BeaverSoftware")
+ self.team = self.org.get_team(189850)
- def testMembers( self ):
- user = self.g.get_user( "jacquev6" )
- self.assertListKeyEqual( self.team.get_members(), lambda u: u.login, [] )
- self.assertFalse( self.team.has_in_members( user ) )
- self.team.add_to_members( user )
- self.assertListKeyEqual( self.team.get_members(), lambda u: u.login, [ "jacquev6" ] )
- self.assertTrue( self.team.has_in_members( user ) )
- self.team.remove_from_members( user )
- self.assertListKeyEqual( self.team.get_members(), lambda u: u.login, [] )
- self.assertFalse( self.team.has_in_members( user ) )
+ def testAttributes(self):
+ self.assertEqual(self.team.id, 189850)
+ self.assertEqual(self.team.members_count, 0)
+ self.assertEqual(self.team.name, "Team created by PyGithub")
+ self.assertEqual(self.team.permission, "pull")
+ self.assertEqual(self.team.repos_count, 0)
+ self.assertEqual(self.team.url, "https://api.github.com/teams/189850")
- def testRepos( self ):
- repo = self.org.get_repo( "FatherBeaver" )
- self.assertListKeyEqual( self.team.get_repos(), lambda r: r.name, [] )
- self.assertFalse( self.team.has_in_repos( repo ) )
- self.team.add_to_repos( repo )
- self.assertListKeyEqual( self.team.get_repos(), lambda r: r.name, [ "FatherBeaver" ] )
- self.assertTrue( self.team.has_in_repos( repo ) )
- self.team.remove_from_repos( repo )
- self.assertListKeyEqual( self.team.get_repos(), lambda r: r.name, [] )
- self.assertFalse( self.team.has_in_repos( repo ) )
+ def testMembers(self):
+ user = self.g.get_user("jacquev6")
+ self.assertListKeyEqual(self.team.get_members(), lambda u: u.login, [])
+ self.assertFalse(self.team.has_in_members(user))
+ self.team.add_to_members(user)
+ self.assertListKeyEqual(self.team.get_members(), lambda u: u.login, ["jacquev6"])
+ self.assertTrue(self.team.has_in_members(user))
+ self.team.remove_from_members(user)
+ self.assertListKeyEqual(self.team.get_members(), lambda u: u.login, [])
+ self.assertFalse(self.team.has_in_members(user))
- def testEditWithoutArguments( self ):
- self.team.edit( "Name edited by PyGithub" )
- self.assertEqual( self.team.name, "Name edited by PyGithub" )
+ def testRepos(self):
+ repo = self.org.get_repo("FatherBeaver")
+ self.assertListKeyEqual(self.team.get_repos(), lambda r: r.name, [])
+ self.assertFalse(self.team.has_in_repos(repo))
+ self.team.add_to_repos(repo)
+ self.assertListKeyEqual(self.team.get_repos(), lambda r: r.name, ["FatherBeaver"])
+ self.assertTrue(self.team.has_in_repos(repo))
+ self.team.remove_from_repos(repo)
+ self.assertListKeyEqual(self.team.get_repos(), lambda r: r.name, [])
+ self.assertFalse(self.team.has_in_repos(repo))
- def testEditWithAllArguments( self ):
- self.team.edit( "Name edited twice by PyGithub", "admin" )
- self.assertEqual( self.team.name, "Name edited twice by PyGithub" )
- self.assertEqual( self.team.permission, "admin" )
+ def testEditWithoutArguments(self):
+ self.team.edit("Name edited by PyGithub")
+ self.assertEqual(self.team.name, "Name edited by PyGithub")
- def testDelete( self ):
+ def testEditWithAllArguments(self):
+ self.team.edit("Name edited twice by PyGithub", "admin")
+ self.assertEqual(self.team.name, "Name edited twice by PyGithub")
+ self.assertEqual(self.team.permission, "admin")
+
+ def testDelete(self):
self.team.delete()
diff --git a/github/tests/UserKey.py b/github/tests/UserKey.py
index 948f7c04..6b4306b5 100644
--- a/github/tests/UserKey.py
+++ b/github/tests/UserKey.py
@@ -13,25 +13,26 @@
import Framework
-class UserKey( Framework.TestCase ):
- def setUp( self ):
- Framework.TestCase.setUp( self )
- self.key = self.g.get_user().get_key( 2626650 )
- def testAttributes( self ):
- self.assertEqual( self.key.id, 2626650 )
- self.assertEqual( self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==" )
- self.assertEqual( self.key.title, "Key added through PyGithub" )
- self.assertEqual( self.key.url, "https://api.github.com/user/keys/2626650" )
- self.assertEqual( self.key.verified, True )
+class UserKey(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.key = self.g.get_user().get_key(2626650)
- def testEditWithoutArguments( self ):
+ def testAttributes(self):
+ self.assertEqual(self.key.id, 2626650)
+ self.assertEqual(self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==")
+ self.assertEqual(self.key.title, "Key added through PyGithub")
+ self.assertEqual(self.key.url, "https://api.github.com/user/keys/2626650")
+ self.assertEqual(self.key.verified, True)
+
+ def testEditWithoutArguments(self):
self.key.edit()
- def testEditWithAllArguments( self ):
- self.key.edit( "Title edited by PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==" )
- self.assertEqual( self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==" )
- self.assertEqual( self.key.title, "Title edited by PyGithub" )
+ def testEditWithAllArguments(self):
+ self.key.edit("Title edited by PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==")
+ self.assertEqual(self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==")
+ self.assertEqual(self.key.title, "Title edited by PyGithub")
- def testDelete( self ):
+ def testDelete(self):
self.key.delete()
diff --git a/github/tests/__init__.py b/github/tests/__init__.py
index 7e573b50..8108507e 100644
--- a/github/tests/__init__.py
+++ b/github/tests/__init__.py
@@ -15,5 +15,6 @@ import unittest
import AllTests
+
def run():
- unittest.main( module = AllTests, argv = [ "Dummy Script Name" ] )
+ unittest.main(module=AllTests, argv=["Dummy Script Name"])
diff --git a/github/tests/__main__.py b/github/tests/__main__.py
index 494c50c1..802c3f69 100644
--- a/github/tests/__main__.py
+++ b/github/tests/__main__.py
@@ -1,15 +1,17 @@
-import sys
-import unittest
-
-import Framework
-import AllTests
-
-def main( argv ):
- if "--record" in argv:
- Framework.activateRecordMode()
- argv = [ arg for arg in argv if arg != "--record" ]
-
- unittest.main( module = AllTests, argv = argv )
-
-if __name__ == "__main__":
- main( sys.argv )
+import sys
+import unittest
+
+import Framework
+import AllTests
+
+
+def main(argv):
+ if "--record" in argv:
+ Framework.activateRecordMode()
+ argv = [arg for arg in argv if arg != "--record"]
+
+ unittest.main(module=AllTests, argv=argv)
+
+
+if __name__ == "__main__":
+ main(sys.argv)
diff --git a/publish.sh b/publish.sh
index 8bb6f9da..5fb0cdd7 100755
--- a/publish.sh
+++ b/publish.sh
@@ -1,5 +1,6 @@
#!/bin/sh
+pep8 --ignore=E501 github # pip install pep8
python setup.py test
previousVersion=$( grep 'version =' setup.py | sed 's/.*version = \"\(.*\)\".*/\1/' )