mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Factorize repeated code in base class GithubObject
This commit is contained in:
+184
-231
@@ -1,9 +1,10 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import Gist
|
||||
import Repository
|
||||
import NamedUser
|
||||
@@ -14,171 +15,162 @@ import Issue
|
||||
import Event
|
||||
import Authorization
|
||||
|
||||
class AuthenticatedUser( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class AuthenticatedUser( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def avatar_url( self ):
|
||||
self.__completeIfNeeded( self.__avatar_url )
|
||||
return self.__avatar_url
|
||||
self._completeIfNeeded( self._avatar_url )
|
||||
return self._avatar_url
|
||||
|
||||
@property
|
||||
def bio( self ):
|
||||
self.__completeIfNeeded( self.__bio )
|
||||
return self.__bio
|
||||
self._completeIfNeeded( self._bio )
|
||||
return self._bio
|
||||
|
||||
@property
|
||||
def blog( self ):
|
||||
self.__completeIfNeeded( self.__blog )
|
||||
return self.__blog
|
||||
self._completeIfNeeded( self._blog )
|
||||
return self._blog
|
||||
|
||||
@property
|
||||
def collaborators( self ):
|
||||
self.__completeIfNeeded( self.__collaborators )
|
||||
return self.__collaborators
|
||||
self._completeIfNeeded( self._collaborators )
|
||||
return self._collaborators
|
||||
|
||||
@property
|
||||
def company( self ):
|
||||
self.__completeIfNeeded( self.__company )
|
||||
return self.__company
|
||||
self._completeIfNeeded( self._company )
|
||||
return self._company
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def disk_usage( self ):
|
||||
self.__completeIfNeeded( self.__disk_usage )
|
||||
return self.__disk_usage
|
||||
self._completeIfNeeded( self._disk_usage )
|
||||
return self._disk_usage
|
||||
|
||||
@property
|
||||
def email( self ):
|
||||
self.__completeIfNeeded( self.__email )
|
||||
return self.__email
|
||||
self._completeIfNeeded( self._email )
|
||||
return self._email
|
||||
|
||||
@property
|
||||
def followers( self ):
|
||||
self.__completeIfNeeded( self.__followers )
|
||||
return self.__followers
|
||||
self._completeIfNeeded( self._followers )
|
||||
return self._followers
|
||||
|
||||
@property
|
||||
def following( self ):
|
||||
self.__completeIfNeeded( self.__following )
|
||||
return self.__following
|
||||
self._completeIfNeeded( self._following )
|
||||
return self._following
|
||||
|
||||
@property
|
||||
def gravatar_id( self ):
|
||||
self.__completeIfNeeded( self.__gravatar_id )
|
||||
return self.__gravatar_id
|
||||
self._completeIfNeeded( self._gravatar_id )
|
||||
return self._gravatar_id
|
||||
|
||||
@property
|
||||
def hireable( self ):
|
||||
self.__completeIfNeeded( self.__hireable )
|
||||
return self.__hireable
|
||||
self._completeIfNeeded( self._hireable )
|
||||
return self._hireable
|
||||
|
||||
@property
|
||||
def html_url( self ):
|
||||
self.__completeIfNeeded( self.__html_url )
|
||||
return self.__html_url
|
||||
self._completeIfNeeded( self._html_url )
|
||||
return self._html_url
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def location( self ):
|
||||
self.__completeIfNeeded( self.__location )
|
||||
return self.__location
|
||||
self._completeIfNeeded( self._location )
|
||||
return self._location
|
||||
|
||||
@property
|
||||
def login( self ):
|
||||
self.__completeIfNeeded( self.__login )
|
||||
return self.__login
|
||||
self._completeIfNeeded( self._login )
|
||||
return self._login
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
self.__completeIfNeeded( self.__name )
|
||||
return self.__name
|
||||
self._completeIfNeeded( self._name )
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def owned_private_repos( self ):
|
||||
self.__completeIfNeeded( self.__owned_private_repos )
|
||||
return self.__owned_private_repos
|
||||
self._completeIfNeeded( self._owned_private_repos )
|
||||
return self._owned_private_repos
|
||||
|
||||
@property
|
||||
def plan( self ):
|
||||
self.__completeIfNeeded( self.__plan )
|
||||
return self.__plan
|
||||
self._completeIfNeeded( self._plan )
|
||||
return self._plan
|
||||
|
||||
@property
|
||||
def private_gists( self ):
|
||||
self.__completeIfNeeded( self.__private_gists )
|
||||
return self.__private_gists
|
||||
self._completeIfNeeded( self._private_gists )
|
||||
return self._private_gists
|
||||
|
||||
@property
|
||||
def public_gists( self ):
|
||||
self.__completeIfNeeded( self.__public_gists )
|
||||
return self.__public_gists
|
||||
self._completeIfNeeded( self._public_gists )
|
||||
return self._public_gists
|
||||
|
||||
@property
|
||||
def public_repos( self ):
|
||||
self.__completeIfNeeded( self.__public_repos )
|
||||
return self.__public_repos
|
||||
self._completeIfNeeded( self._public_repos )
|
||||
return self._public_repos
|
||||
|
||||
@property
|
||||
def total_private_repos( self ):
|
||||
self.__completeIfNeeded( self.__total_private_repos )
|
||||
return self.__total_private_repos
|
||||
self._completeIfNeeded( self._total_private_repos )
|
||||
return self._total_private_repos
|
||||
|
||||
@property
|
||||
def type( self ):
|
||||
self.__completeIfNeeded( self.__type )
|
||||
return self.__type
|
||||
self._completeIfNeeded( self._type )
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
def add_to_emails( self, *emails ):
|
||||
assert all( isinstance( email, ( str, unicode ) ) for email in emails ), emails
|
||||
post_parameters = emails
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
"https://api.github.com/user/emails",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def add_to_following( self, following ):
|
||||
assert isinstance( following, NamedUser.NamedUser ), following
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PUT",
|
||||
"https://api.github.com/user/following/" + str( following._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def add_to_watched( self, watched ):
|
||||
assert isinstance( watched, Repository.Repository ), watched
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PUT",
|
||||
"https://api.github.com/user/watched/" + str( watched._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def create_authorization( self, scopes = DefaultValueForOptionalParameters, note = DefaultValueForOptionalParameters, note_url = DefaultValueForOptionalParameters ):
|
||||
if scopes is not DefaultValueForOptionalParameters:
|
||||
@@ -194,27 +186,25 @@ class AuthenticatedUser( object ):
|
||||
post_parameters[ "note" ] = note
|
||||
if note_url is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "note_url" ] = note_url
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
"https://api.github.com/authorizations",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Authorization.Authorization( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Authorization.Authorization( self._requester, data, completed = True )
|
||||
|
||||
def create_fork( self, repo ):
|
||||
assert isinstance( repo, Repository.Repository ), repo
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
"https://api.github.com/repos/" + str( repo.owner.login ) + "/" + str( repo.name ) + "/forks",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Repository.Repository( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Repository.Repository( self._requester, data, completed = True )
|
||||
|
||||
def create_gist( self, public, files, description = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( public, bool ), public
|
||||
@@ -226,15 +216,14 @@ class AuthenticatedUser( object ):
|
||||
}
|
||||
if description is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "description" ] = description
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
"https://api.github.com/gists",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Gist.Gist( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Gist.Gist( self._requester, data, completed = True )
|
||||
|
||||
def create_key( self, title, key ):
|
||||
assert isinstance( title, ( str, unicode ) ), title
|
||||
@@ -243,15 +232,14 @@ class AuthenticatedUser( object ):
|
||||
"title": title,
|
||||
"key": key,
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
"https://api.github.com/user/keys",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return UserKey.UserKey( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return UserKey.UserKey( self._requester, data, completed = True )
|
||||
|
||||
def create_repo( self, name, description = DefaultValueForOptionalParameters, homepage = DefaultValueForOptionalParameters, private = DefaultValueForOptionalParameters, has_issues = DefaultValueForOptionalParameters, has_wiki = DefaultValueForOptionalParameters, has_downloads = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( name, ( str, unicode ) ), name
|
||||
@@ -282,15 +270,14 @@ class AuthenticatedUser( object ):
|
||||
post_parameters[ "has_wiki" ] = has_wiki
|
||||
if has_downloads is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "has_downloads" ] = has_downloads
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
"https://api.github.com/user/repos",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Repository.Repository( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Repository.Repository( self._requester, data, completed = True )
|
||||
|
||||
def edit( self, name = DefaultValueForOptionalParameters, email = DefaultValueForOptionalParameters, blog = DefaultValueForOptionalParameters, company = DefaultValueForOptionalParameters, location = DefaultValueForOptionalParameters, hireable = DefaultValueForOptionalParameters, bio = DefaultValueForOptionalParameters ):
|
||||
if name is not DefaultValueForOptionalParameters:
|
||||
@@ -322,207 +309,193 @@ class AuthenticatedUser( object ):
|
||||
post_parameters[ "hireable" ] = hireable
|
||||
if bio is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "bio" ] = bio
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
"https://api.github.com/user",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_authorization( self, id ):
|
||||
assert isinstance( id, int ), id
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/authorizations/" + str( id ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Authorization.Authorization( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Authorization.Authorization( self._requester, data, completed = True )
|
||||
|
||||
def get_authorizations( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/authorizations",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Authorization.Authorization,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_emails( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/emails",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return data
|
||||
|
||||
def get_events( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_followers( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/followers",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_following( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/following",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_gists( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/gists",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_issues( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/issues",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Issue.Issue,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_key( self, id ):
|
||||
assert isinstance( id, int ), id
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/keys/" + str( id ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return UserKey.UserKey( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return UserKey.UserKey( self._requester, data, completed = True )
|
||||
|
||||
def get_keys( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/keys",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
UserKey.UserKey,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_organization_events( self, org ):
|
||||
assert isinstance( org, Organization.Organization ), org
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/users/" + str( self.login ) + "/events/orgs/" + str( org.login ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_orgs( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/orgs",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Organization.Organization,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_repo( self, name ):
|
||||
assert isinstance( name, ( str, unicode ) ), name
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/repos/" + str( self.login ) + "/" + str( name ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Repository.Repository( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Repository.Repository( self._requester, data, completed = True )
|
||||
|
||||
def get_repos( self, type = DefaultValueForOptionalParameters, sort = DefaultValueForOptionalParameters, direction = DefaultValueForOptionalParameters ):
|
||||
if type is not DefaultValueForOptionalParameters:
|
||||
@@ -538,56 +511,53 @@ class AuthenticatedUser( object ):
|
||||
url_parameters[ "sort" ] = sort
|
||||
if direction is not DefaultValueForOptionalParameters:
|
||||
url_parameters[ "direction" ] = direction
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/repos",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_starred_gists( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/gists/starred",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_watched( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/watched",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def has_in_following( self, following ):
|
||||
assert isinstance( following, NamedUser.NamedUser ), following
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/following/" + str( following._identity ),
|
||||
None,
|
||||
@@ -597,7 +567,7 @@ class AuthenticatedUser( object ):
|
||||
|
||||
def has_in_watched( self, watched ):
|
||||
assert isinstance( watched, Repository.Repository ), watched
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/user/watched/" + str( watched._identity ),
|
||||
None,
|
||||
@@ -608,151 +578,134 @@ class AuthenticatedUser( object ):
|
||||
def remove_from_emails( self, *emails ):
|
||||
assert all( isinstance( email, ( str, unicode ) ) for email in emails ), emails
|
||||
post_parameters = emails
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
"https://api.github.com/user/emails",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def remove_from_following( self, following ):
|
||||
assert isinstance( following, NamedUser.NamedUser ), following
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
"https://api.github.com/user/following/" + str( following._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def remove_from_watched( self, watched ):
|
||||
assert isinstance( watched, Repository.Repository ), watched
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
"https://api.github.com/user/watched/" + str( watched._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__avatar_url = None
|
||||
self.__bio = None
|
||||
self.__blog = None
|
||||
self.__collaborators = None
|
||||
self.__company = None
|
||||
self.__created_at = None
|
||||
self.__disk_usage = None
|
||||
self.__email = None
|
||||
self.__followers = None
|
||||
self.__following = None
|
||||
self.__gravatar_id = None
|
||||
self.__hireable = None
|
||||
self.__html_url = None
|
||||
self.__id = None
|
||||
self.__location = None
|
||||
self.__login = None
|
||||
self.__name = None
|
||||
self.__owned_private_repos = None
|
||||
self.__plan = None
|
||||
self.__private_gists = None
|
||||
self.__public_gists = None
|
||||
self.__public_repos = None
|
||||
self.__total_private_repos = None
|
||||
self.__type = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._avatar_url = None
|
||||
self._bio = None
|
||||
self._blog = None
|
||||
self._collaborators = None
|
||||
self._company = None
|
||||
self._created_at = None
|
||||
self._disk_usage = None
|
||||
self._email = None
|
||||
self._followers = None
|
||||
self._following = None
|
||||
self._gravatar_id = None
|
||||
self._hireable = None
|
||||
self._html_url = None
|
||||
self._id = None
|
||||
self._location = None
|
||||
self._login = None
|
||||
self._name = None
|
||||
self._owned_private_repos = None
|
||||
self._plan = None
|
||||
self._private_gists = None
|
||||
self._public_gists = None
|
||||
self._public_repos = None
|
||||
self._total_private_repos = None
|
||||
self._type = None
|
||||
self._url = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "avatar_url" in attributes and attributes[ "avatar_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ]
|
||||
self.__avatar_url = attributes[ "avatar_url" ]
|
||||
self._avatar_url = attributes[ "avatar_url" ]
|
||||
if "bio" in attributes and attributes[ "bio" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "bio" ], ( str, unicode ) ), attributes[ "bio" ]
|
||||
self.__bio = attributes[ "bio" ]
|
||||
self._bio = attributes[ "bio" ]
|
||||
if "blog" in attributes and attributes[ "blog" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ]
|
||||
self.__blog = attributes[ "blog" ]
|
||||
self._blog = attributes[ "blog" ]
|
||||
if "collaborators" in attributes and attributes[ "collaborators" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ]
|
||||
self.__collaborators = attributes[ "collaborators" ]
|
||||
self._collaborators = attributes[ "collaborators" ]
|
||||
if "company" in attributes and attributes[ "company" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ]
|
||||
self.__company = attributes[ "company" ]
|
||||
self._company = attributes[ "company" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "disk_usage" in attributes and attributes[ "disk_usage" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ]
|
||||
self.__disk_usage = attributes[ "disk_usage" ]
|
||||
self._disk_usage = attributes[ "disk_usage" ]
|
||||
if "email" in attributes and attributes[ "email" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ]
|
||||
self.__email = attributes[ "email" ]
|
||||
self._email = attributes[ "email" ]
|
||||
if "followers" in attributes and attributes[ "followers" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "followers" ], int ), attributes[ "followers" ]
|
||||
self.__followers = attributes[ "followers" ]
|
||||
self._followers = attributes[ "followers" ]
|
||||
if "following" in attributes and attributes[ "following" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "following" ], int ), attributes[ "following" ]
|
||||
self.__following = attributes[ "following" ]
|
||||
self._following = attributes[ "following" ]
|
||||
if "gravatar_id" in attributes and attributes[ "gravatar_id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ]
|
||||
self.__gravatar_id = attributes[ "gravatar_id" ]
|
||||
self._gravatar_id = attributes[ "gravatar_id" ]
|
||||
if "hireable" in attributes and attributes[ "hireable" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "hireable" ], bool ), attributes[ "hireable" ]
|
||||
self.__hireable = attributes[ "hireable" ]
|
||||
self._hireable = attributes[ "hireable" ]
|
||||
if "html_url" in attributes and attributes[ "html_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
|
||||
self.__html_url = attributes[ "html_url" ]
|
||||
self._html_url = attributes[ "html_url" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "location" in attributes and attributes[ "location" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ]
|
||||
self.__location = attributes[ "location" ]
|
||||
self._location = attributes[ "location" ]
|
||||
if "login" in attributes and attributes[ "login" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ]
|
||||
self.__login = attributes[ "login" ]
|
||||
self._login = attributes[ "login" ]
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "owned_private_repos" in attributes and attributes[ "owned_private_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ]
|
||||
self.__owned_private_repos = attributes[ "owned_private_repos" ]
|
||||
self._owned_private_repos = attributes[ "owned_private_repos" ]
|
||||
if "plan" in attributes and attributes[ "plan" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "plan" ], dict ), attributes[ "plan" ]
|
||||
self.__plan = Plan.Plan( self.__requester, attributes[ "plan" ], completed = False )
|
||||
self._plan = Plan.Plan( self._requester, attributes[ "plan" ], completed = False )
|
||||
if "private_gists" in attributes and attributes[ "private_gists" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ]
|
||||
self.__private_gists = attributes[ "private_gists" ]
|
||||
self._private_gists = attributes[ "private_gists" ]
|
||||
if "public_gists" in attributes and attributes[ "public_gists" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ]
|
||||
self.__public_gists = attributes[ "public_gists" ]
|
||||
self._public_gists = attributes[ "public_gists" ]
|
||||
if "public_repos" in attributes and attributes[ "public_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ]
|
||||
self.__public_repos = attributes[ "public_repos" ]
|
||||
self._public_repos = attributes[ "public_repos" ]
|
||||
if "total_private_repos" in attributes and attributes[ "total_private_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ]
|
||||
self.__total_private_repos = attributes[ "total_private_repos" ]
|
||||
self._total_private_repos = attributes[ "total_private_repos" ]
|
||||
if "type" in attributes and attributes[ "type" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
|
||||
self.__type = attributes[ "type" ]
|
||||
self._type = attributes[ "type" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+46
-68
@@ -1,72 +1,65 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
import GithubObject
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import AuthorizationApplication
|
||||
|
||||
class Authorization( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class Authorization( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def app( self ):
|
||||
self.__completeIfNeeded( self.__app )
|
||||
return self.__app
|
||||
self._completeIfNeeded( self._app )
|
||||
return self._app
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def note( self ):
|
||||
self.__completeIfNeeded( self.__note )
|
||||
return self.__note
|
||||
self._completeIfNeeded( self._note )
|
||||
return self._note
|
||||
|
||||
@property
|
||||
def note_url( self ):
|
||||
self.__completeIfNeeded( self.__note_url )
|
||||
return self.__note_url
|
||||
self._completeIfNeeded( self._note_url )
|
||||
return self._note_url
|
||||
|
||||
@property
|
||||
def scopes( self ):
|
||||
self.__completeIfNeeded( self.__scopes )
|
||||
return self.__scopes
|
||||
self._completeIfNeeded( self._scopes )
|
||||
return self._scopes
|
||||
|
||||
@property
|
||||
def token( self ):
|
||||
self.__completeIfNeeded( self.__token )
|
||||
return self.__token
|
||||
self._completeIfNeeded( self._token )
|
||||
return self._token
|
||||
|
||||
@property
|
||||
def updated_at( self ):
|
||||
self.__completeIfNeeded( self.__updated_at )
|
||||
return self.__updated_at
|
||||
self._completeIfNeeded( self._updated_at )
|
||||
return self._updated_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, scopes = DefaultValueForOptionalParameters, add_scopes = DefaultValueForOptionalParameters, remove_scopes = DefaultValueForOptionalParameters, note = DefaultValueForOptionalParameters, note_url = DefaultValueForOptionalParameters ):
|
||||
if scopes is not DefaultValueForOptionalParameters:
|
||||
@@ -90,66 +83,51 @@ class Authorization( object ):
|
||||
post_parameters[ "note" ] = note
|
||||
if note_url is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "note_url" ] = note_url
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__app = None
|
||||
self.__created_at = None
|
||||
self.__id = None
|
||||
self.__note = None
|
||||
self.__note_url = None
|
||||
self.__scopes = None
|
||||
self.__token = None
|
||||
self.__updated_at = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._app = None
|
||||
self._created_at = None
|
||||
self._id = None
|
||||
self._note = None
|
||||
self._note_url = None
|
||||
self._scopes = None
|
||||
self._token = None
|
||||
self._updated_at = None
|
||||
self._url = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "app" in attributes and attributes[ "app" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "app" ], dict ), attributes[ "app" ]
|
||||
self.__app = AuthorizationApplication.AuthorizationApplication( self.__requester, attributes[ "app" ], completed = False )
|
||||
self._app = AuthorizationApplication.AuthorizationApplication( self._requester, attributes[ "app" ], completed = False )
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "note" in attributes and attributes[ "note" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "note" ], ( str, unicode ) ), attributes[ "note" ]
|
||||
self.__note = attributes[ "note" ]
|
||||
self._note = attributes[ "note" ]
|
||||
if "note_url" in attributes and attributes[ "note_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "note_url" ], ( str, unicode ) ), attributes[ "note_url" ]
|
||||
self.__note_url = attributes[ "note_url" ]
|
||||
self._note_url = attributes[ "note_url" ]
|
||||
if "scopes" in attributes and attributes[ "scopes" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, ( str, unicode ) ) for element in attributes[ "scopes" ] ), attributes[ "scopes" ]
|
||||
self.__scopes = attributes[ "scopes" ]
|
||||
self._scopes = attributes[ "scopes" ]
|
||||
if "token" in attributes and attributes[ "token" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "token" ], ( str, unicode ) ), attributes[ "token" ]
|
||||
self.__token = attributes[ "token" ]
|
||||
self._token = attributes[ "token" ]
|
||||
if "updated_at" in attributes and attributes[ "updated_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
|
||||
self.__updated_at = attributes[ "updated_at" ]
|
||||
self._updated_at = attributes[ "updated_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
@@ -1,32 +1,25 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class AuthorizationApplication( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class AuthorizationApplication( GithubObject.GithubObject ):
|
||||
@property
|
||||
def name( self ):
|
||||
return self.__name
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__name = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._name = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+11
-17
@@ -1,33 +1,27 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import Commit
|
||||
|
||||
class Branch( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class Branch( GithubObject.GithubObject ):
|
||||
@property
|
||||
def commit( self ):
|
||||
return self.__commit
|
||||
return self._commit
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
return self.__name
|
||||
return self._name
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__commit = None
|
||||
self.__name = None
|
||||
def _initAttributes( self ):
|
||||
self._commit = None
|
||||
self._name = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "commit" in attributes and attributes[ "commit" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commit" ], dict ), attributes[ "commit" ]
|
||||
self.__commit = Commit.Commit( self.__requester, attributes[ "commit" ], completed = False )
|
||||
self._commit = Commit.Commit( self._requester, attributes[ "commit" ], completed = False )
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
|
||||
+45
-66
@@ -1,9 +1,10 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import CommitFile
|
||||
import NamedUser
|
||||
import GitCommit
|
||||
@@ -11,52 +12,46 @@ import CommitStats
|
||||
import Commit
|
||||
import CommitComment
|
||||
|
||||
class Commit( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class Commit( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def author( self ):
|
||||
self.__completeIfNeeded( self.__author )
|
||||
return self.__author
|
||||
self._completeIfNeeded( self._author )
|
||||
return self._author
|
||||
|
||||
@property
|
||||
def commit( self ):
|
||||
self.__completeIfNeeded( self.__commit )
|
||||
return self.__commit
|
||||
self._completeIfNeeded( self._commit )
|
||||
return self._commit
|
||||
|
||||
@property
|
||||
def committer( self ):
|
||||
self.__completeIfNeeded( self.__committer )
|
||||
return self.__committer
|
||||
self._completeIfNeeded( self._committer )
|
||||
return self._committer
|
||||
|
||||
@property
|
||||
def files( self ):
|
||||
self.__completeIfNeeded( self.__files )
|
||||
return self.__files
|
||||
self._completeIfNeeded( self._files )
|
||||
return self._files
|
||||
|
||||
@property
|
||||
def parents( self ):
|
||||
self.__completeIfNeeded( self.__parents )
|
||||
return self.__parents
|
||||
self._completeIfNeeded( self._parents )
|
||||
return self._parents
|
||||
|
||||
@property
|
||||
def sha( self ):
|
||||
self.__completeIfNeeded( self.__sha )
|
||||
return self.__sha
|
||||
self._completeIfNeeded( self._sha )
|
||||
return self._sha
|
||||
|
||||
@property
|
||||
def stats( self ):
|
||||
self.__completeIfNeeded( self.__stats )
|
||||
return self.__stats
|
||||
self._completeIfNeeded( self._stats )
|
||||
return self._stats
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
def create_comment( self, body, line = DefaultValueForOptionalParameters, path = DefaultValueForOptionalParameters, position = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( body, ( str, unicode ) ), body
|
||||
@@ -75,84 +70,68 @@ class Commit( object ):
|
||||
post_parameters[ "path" ] = path
|
||||
if position is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "position" ] = position
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/comments",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return CommitComment.CommitComment( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return CommitComment.CommitComment( self._requester, data, completed = True )
|
||||
|
||||
def get_comments( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
CommitComment.CommitComment,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__author = None
|
||||
self.__commit = None
|
||||
self.__committer = None
|
||||
self.__files = None
|
||||
self.__parents = None
|
||||
self.__sha = None
|
||||
self.__stats = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._author = None
|
||||
self._commit = None
|
||||
self._committer = None
|
||||
self._files = None
|
||||
self._parents = None
|
||||
self._sha = None
|
||||
self._stats = None
|
||||
self._url = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "author" in attributes and attributes[ "author" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "author" ], dict ), attributes[ "author" ]
|
||||
self.__author = NamedUser.NamedUser( self.__requester, attributes[ "author" ], completed = False )
|
||||
self._author = NamedUser.NamedUser( self._requester, attributes[ "author" ], completed = False )
|
||||
if "commit" in attributes and attributes[ "commit" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commit" ], dict ), attributes[ "commit" ]
|
||||
self.__commit = GitCommit.GitCommit( self.__requester, attributes[ "commit" ], completed = False )
|
||||
self._commit = GitCommit.GitCommit( self._requester, attributes[ "commit" ], completed = False )
|
||||
if "committer" in attributes and attributes[ "committer" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "committer" ], dict ), attributes[ "committer" ]
|
||||
self.__committer = NamedUser.NamedUser( self.__requester, attributes[ "committer" ], completed = False )
|
||||
self._committer = NamedUser.NamedUser( self._requester, attributes[ "committer" ], completed = False )
|
||||
if "files" in attributes and attributes[ "files" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, dict ) for element in attributes[ "files" ] ), attributes[ "files" ]
|
||||
self.__files = [
|
||||
CommitFile.CommitFile( self.__requester, element, completed = False )
|
||||
self._files = [
|
||||
CommitFile.CommitFile( self._requester, element, completed = False )
|
||||
for element in attributes[ "files" ]
|
||||
]
|
||||
if "parents" in attributes and attributes[ "parents" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, dict ) for element in attributes[ "parents" ] ), attributes[ "parents" ]
|
||||
self.__parents = [
|
||||
Commit( self.__requester, element, completed = False )
|
||||
self._parents = [
|
||||
Commit( self._requester, element, completed = False )
|
||||
for element in attributes[ "parents" ]
|
||||
]
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
if "stats" in attributes and attributes[ "stats" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "stats" ], dict ), attributes[ "stats" ]
|
||||
self.__stats = CommitStats.CommitStats( self.__requester, attributes[ "stats" ], completed = False )
|
||||
self._stats = CommitStats.CommitStats( self._requester, attributes[ "stats" ], completed = False )
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+54
-77
@@ -1,156 +1,133 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import NamedUser
|
||||
|
||||
class CommitComment( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class CommitComment( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def body( self ):
|
||||
self.__completeIfNeeded( self.__body )
|
||||
return self.__body
|
||||
self._completeIfNeeded( self._body )
|
||||
return self._body
|
||||
|
||||
@property
|
||||
def commit_id( self ):
|
||||
self.__completeIfNeeded( self.__commit_id )
|
||||
return self.__commit_id
|
||||
self._completeIfNeeded( self._commit_id )
|
||||
return self._commit_id
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def html_url( self ):
|
||||
self.__completeIfNeeded( self.__html_url )
|
||||
return self.__html_url
|
||||
self._completeIfNeeded( self._html_url )
|
||||
return self._html_url
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def line( self ):
|
||||
self.__completeIfNeeded( self.__line )
|
||||
return self.__line
|
||||
self._completeIfNeeded( self._line )
|
||||
return self._line
|
||||
|
||||
@property
|
||||
def path( self ):
|
||||
self.__completeIfNeeded( self.__path )
|
||||
return self.__path
|
||||
self._completeIfNeeded( self._path )
|
||||
return self._path
|
||||
|
||||
@property
|
||||
def position( self ):
|
||||
self.__completeIfNeeded( self.__position )
|
||||
return self.__position
|
||||
self._completeIfNeeded( self._position )
|
||||
return self._position
|
||||
|
||||
@property
|
||||
def updated_at( self ):
|
||||
self.__completeIfNeeded( self.__updated_at )
|
||||
return self.__updated_at
|
||||
self._completeIfNeeded( self._updated_at )
|
||||
return self._updated_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def user( self ):
|
||||
self.__completeIfNeeded( self.__user )
|
||||
return self.__user
|
||||
self._completeIfNeeded( self._user )
|
||||
return self._user
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, body ):
|
||||
assert isinstance( body, ( str, unicode ) ), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__body = None
|
||||
self.__commit_id = None
|
||||
self.__created_at = None
|
||||
self.__html_url = None
|
||||
self.__id = None
|
||||
self.__line = None
|
||||
self.__path = None
|
||||
self.__position = None
|
||||
self.__updated_at = None
|
||||
self.__url = None
|
||||
self.__user = None
|
||||
def _initAttributes( self ):
|
||||
self._body = None
|
||||
self._commit_id = None
|
||||
self._created_at = None
|
||||
self._html_url = None
|
||||
self._id = None
|
||||
self._line = None
|
||||
self._path = None
|
||||
self._position = None
|
||||
self._updated_at = None
|
||||
self._url = None
|
||||
self._user = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
|
||||
self.__body = attributes[ "body" ]
|
||||
self._body = attributes[ "body" ]
|
||||
if "commit_id" in attributes and attributes[ "commit_id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commit_id" ], ( str, unicode ) ), attributes[ "commit_id" ]
|
||||
self.__commit_id = attributes[ "commit_id" ]
|
||||
self._commit_id = attributes[ "commit_id" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "html_url" in attributes and attributes[ "html_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
|
||||
self.__html_url = attributes[ "html_url" ]
|
||||
self._html_url = attributes[ "html_url" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "line" in attributes and attributes[ "line" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "line" ], int ), attributes[ "line" ]
|
||||
self.__line = attributes[ "line" ]
|
||||
self._line = attributes[ "line" ]
|
||||
if "path" in attributes and attributes[ "path" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ]
|
||||
self.__path = attributes[ "path" ]
|
||||
self._path = attributes[ "path" ]
|
||||
if "position" in attributes and attributes[ "position" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "position" ], int ), attributes[ "position" ]
|
||||
self.__position = attributes[ "position" ]
|
||||
self._position = attributes[ "position" ]
|
||||
if "updated_at" in attributes and attributes[ "updated_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
|
||||
self.__updated_at = attributes[ "updated_at" ]
|
||||
self._updated_at = attributes[ "updated_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "user" in attributes and attributes[ "user" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "user" ], dict ), attributes[ "user" ]
|
||||
self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completed = False )
|
||||
self._user = NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False )
|
||||
|
||||
+31
-38
@@ -1,88 +1,81 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class CommitFile( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class CommitFile( GithubObject.GithubObject ):
|
||||
@property
|
||||
def additions( self ):
|
||||
return self.__additions
|
||||
return self._additions
|
||||
|
||||
@property
|
||||
def blob_url( self ):
|
||||
return self.__blob_url
|
||||
return self._blob_url
|
||||
|
||||
@property
|
||||
def changes( self ):
|
||||
return self.__changes
|
||||
return self._changes
|
||||
|
||||
@property
|
||||
def deletions( self ):
|
||||
return self.__deletions
|
||||
return self._deletions
|
||||
|
||||
@property
|
||||
def filename( self ):
|
||||
return self.__filename
|
||||
return self._filename
|
||||
|
||||
@property
|
||||
def patch( self ):
|
||||
return self.__patch
|
||||
return self._patch
|
||||
|
||||
@property
|
||||
def raw_url( self ):
|
||||
return self.__raw_url
|
||||
return self._raw_url
|
||||
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
return self._sha
|
||||
|
||||
@property
|
||||
def status( self ):
|
||||
return self.__status
|
||||
return self._status
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__additions = None
|
||||
self.__blob_url = None
|
||||
self.__changes = None
|
||||
self.__deletions = None
|
||||
self.__filename = None
|
||||
self.__patch = None
|
||||
self.__raw_url = None
|
||||
self.__sha = None
|
||||
self.__status = None
|
||||
def _initAttributes( self ):
|
||||
self._additions = None
|
||||
self._blob_url = None
|
||||
self._changes = None
|
||||
self._deletions = None
|
||||
self._filename = None
|
||||
self._patch = None
|
||||
self._raw_url = None
|
||||
self._sha = None
|
||||
self._status = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "additions" in attributes and attributes[ "additions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "additions" ], int ), attributes[ "additions" ]
|
||||
self.__additions = attributes[ "additions" ]
|
||||
self._additions = attributes[ "additions" ]
|
||||
if "blob_url" in attributes and attributes[ "blob_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "blob_url" ], ( str, unicode ) ), attributes[ "blob_url" ]
|
||||
self.__blob_url = attributes[ "blob_url" ]
|
||||
self._blob_url = attributes[ "blob_url" ]
|
||||
if "changes" in attributes and attributes[ "changes" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "changes" ], int ), attributes[ "changes" ]
|
||||
self.__changes = attributes[ "changes" ]
|
||||
self._changes = attributes[ "changes" ]
|
||||
if "deletions" in attributes and attributes[ "deletions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ]
|
||||
self.__deletions = attributes[ "deletions" ]
|
||||
self._deletions = attributes[ "deletions" ]
|
||||
if "filename" in attributes and attributes[ "filename" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "filename" ], ( str, unicode ) ), attributes[ "filename" ]
|
||||
self.__filename = attributes[ "filename" ]
|
||||
self._filename = attributes[ "filename" ]
|
||||
if "patch" in attributes and attributes[ "patch" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "patch" ], ( str, unicode ) ), attributes[ "patch" ]
|
||||
self.__patch = attributes[ "patch" ]
|
||||
self._patch = attributes[ "patch" ]
|
||||
if "raw_url" in attributes and attributes[ "raw_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "raw_url" ], ( str, unicode ) ), attributes[ "raw_url" ]
|
||||
self.__raw_url = attributes[ "raw_url" ]
|
||||
self._raw_url = attributes[ "raw_url" ]
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
if "status" in attributes and attributes[ "status" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "status" ], ( str, unicode ) ), attributes[ "status" ]
|
||||
self.__status = attributes[ "status" ]
|
||||
self._status = attributes[ "status" ]
|
||||
|
||||
+13
-20
@@ -1,40 +1,33 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class CommitStats( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class CommitStats( GithubObject.GithubObject ):
|
||||
@property
|
||||
def additions( self ):
|
||||
return self.__additions
|
||||
return self._additions
|
||||
|
||||
@property
|
||||
def deletions( self ):
|
||||
return self.__deletions
|
||||
return self._deletions
|
||||
|
||||
@property
|
||||
def total( self ):
|
||||
return self.__total
|
||||
return self._total
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__additions = None
|
||||
self.__deletions = None
|
||||
self.__total = None
|
||||
def _initAttributes( self ):
|
||||
self._additions = None
|
||||
self._deletions = None
|
||||
self._total = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "additions" in attributes and attributes[ "additions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "additions" ], int ), attributes[ "additions" ]
|
||||
self.__additions = attributes[ "additions" ]
|
||||
self._additions = attributes[ "additions" ]
|
||||
if "deletions" in attributes and attributes[ "deletions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ]
|
||||
self.__deletions = attributes[ "deletions" ]
|
||||
self._deletions = attributes[ "deletions" ]
|
||||
if "total" in attributes and attributes[ "total" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "total" ], int ), attributes[ "total" ]
|
||||
self.__total = attributes[ "total" ]
|
||||
self._total = attributes[ "total" ]
|
||||
|
||||
+86
-109
@@ -1,221 +1,198 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class Download( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
import GithubObject
|
||||
|
||||
class Download( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def accesskeyid( self ):
|
||||
self.__completeIfNeeded( self.__accesskeyid )
|
||||
return self.__accesskeyid
|
||||
self._completeIfNeeded( self._accesskeyid )
|
||||
return self._accesskeyid
|
||||
|
||||
@property
|
||||
def acl( self ):
|
||||
self.__completeIfNeeded( self.__acl )
|
||||
return self.__acl
|
||||
self._completeIfNeeded( self._acl )
|
||||
return self._acl
|
||||
|
||||
@property
|
||||
def bucket( self ):
|
||||
self.__completeIfNeeded( self.__bucket )
|
||||
return self.__bucket
|
||||
self._completeIfNeeded( self._bucket )
|
||||
return self._bucket
|
||||
|
||||
@property
|
||||
def content_type( self ):
|
||||
self.__completeIfNeeded( self.__content_type )
|
||||
return self.__content_type
|
||||
self._completeIfNeeded( self._content_type )
|
||||
return self._content_type
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def description( self ):
|
||||
self.__completeIfNeeded( self.__description )
|
||||
return self.__description
|
||||
self._completeIfNeeded( self._description )
|
||||
return self._description
|
||||
|
||||
@property
|
||||
def download_count( self ):
|
||||
self.__completeIfNeeded( self.__download_count )
|
||||
return self.__download_count
|
||||
self._completeIfNeeded( self._download_count )
|
||||
return self._download_count
|
||||
|
||||
@property
|
||||
def expirationdate( self ):
|
||||
self.__completeIfNeeded( self.__expirationdate )
|
||||
return self.__expirationdate
|
||||
self._completeIfNeeded( self._expirationdate )
|
||||
return self._expirationdate
|
||||
|
||||
@property
|
||||
def html_url( self ):
|
||||
self.__completeIfNeeded( self.__html_url )
|
||||
return self.__html_url
|
||||
self._completeIfNeeded( self._html_url )
|
||||
return self._html_url
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def mime_type( self ):
|
||||
self.__completeIfNeeded( self.__mime_type )
|
||||
return self.__mime_type
|
||||
self._completeIfNeeded( self._mime_type )
|
||||
return self._mime_type
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
self.__completeIfNeeded( self.__name )
|
||||
return self.__name
|
||||
self._completeIfNeeded( self._name )
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def path( self ):
|
||||
self.__completeIfNeeded( self.__path )
|
||||
return self.__path
|
||||
self._completeIfNeeded( self._path )
|
||||
return self._path
|
||||
|
||||
@property
|
||||
def policy( self ):
|
||||
self.__completeIfNeeded( self.__policy )
|
||||
return self.__policy
|
||||
self._completeIfNeeded( self._policy )
|
||||
return self._policy
|
||||
|
||||
@property
|
||||
def prefix( self ):
|
||||
self.__completeIfNeeded( self.__prefix )
|
||||
return self.__prefix
|
||||
self._completeIfNeeded( self._prefix )
|
||||
return self._prefix
|
||||
|
||||
@property
|
||||
def redirect( self ):
|
||||
self.__completeIfNeeded( self.__redirect )
|
||||
return self.__redirect
|
||||
self._completeIfNeeded( self._redirect )
|
||||
return self._redirect
|
||||
|
||||
@property
|
||||
def s3_url( self ):
|
||||
self.__completeIfNeeded( self.__s3_url )
|
||||
return self.__s3_url
|
||||
self._completeIfNeeded( self._s3_url )
|
||||
return self._s3_url
|
||||
|
||||
@property
|
||||
def signature( self ):
|
||||
self.__completeIfNeeded( self.__signature )
|
||||
return self.__signature
|
||||
self._completeIfNeeded( self._signature )
|
||||
return self._signature
|
||||
|
||||
@property
|
||||
def size( self ):
|
||||
self.__completeIfNeeded( self.__size )
|
||||
return self.__size
|
||||
self._completeIfNeeded( self._size )
|
||||
return self._size
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__accesskeyid = None
|
||||
self.__acl = None
|
||||
self.__bucket = None
|
||||
self.__content_type = None
|
||||
self.__created_at = None
|
||||
self.__description = None
|
||||
self.__download_count = None
|
||||
self.__expirationdate = None
|
||||
self.__html_url = None
|
||||
self.__id = None
|
||||
self.__mime_type = None
|
||||
self.__name = None
|
||||
self.__path = None
|
||||
self.__policy = None
|
||||
self.__prefix = None
|
||||
self.__redirect = None
|
||||
self.__s3_url = None
|
||||
self.__signature = None
|
||||
self.__size = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._accesskeyid = None
|
||||
self._acl = None
|
||||
self._bucket = None
|
||||
self._content_type = None
|
||||
self._created_at = None
|
||||
self._description = None
|
||||
self._download_count = None
|
||||
self._expirationdate = None
|
||||
self._html_url = None
|
||||
self._id = None
|
||||
self._mime_type = None
|
||||
self._name = None
|
||||
self._path = None
|
||||
self._policy = None
|
||||
self._prefix = None
|
||||
self._redirect = None
|
||||
self._s3_url = None
|
||||
self._signature = None
|
||||
self._size = None
|
||||
self._url = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "accesskeyid" in attributes and attributes[ "accesskeyid" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "accesskeyid" ], ( str, unicode ) ), attributes[ "accesskeyid" ]
|
||||
self.__accesskeyid = attributes[ "accesskeyid" ]
|
||||
self._accesskeyid = attributes[ "accesskeyid" ]
|
||||
if "acl" in attributes and attributes[ "acl" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "acl" ], ( str, unicode ) ), attributes[ "acl" ]
|
||||
self.__acl = attributes[ "acl" ]
|
||||
self._acl = attributes[ "acl" ]
|
||||
if "bucket" in attributes and attributes[ "bucket" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "bucket" ], ( str, unicode ) ), attributes[ "bucket" ]
|
||||
self.__bucket = attributes[ "bucket" ]
|
||||
self._bucket = attributes[ "bucket" ]
|
||||
if "content_type" in attributes and attributes[ "content_type" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "content_type" ], ( str, unicode ) ), attributes[ "content_type" ]
|
||||
self.__content_type = attributes[ "content_type" ]
|
||||
self._content_type = attributes[ "content_type" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "description" in attributes and attributes[ "description" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
|
||||
self.__description = attributes[ "description" ]
|
||||
self._description = attributes[ "description" ]
|
||||
if "download_count" in attributes and attributes[ "download_count" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "download_count" ], int ), attributes[ "download_count" ]
|
||||
self.__download_count = attributes[ "download_count" ]
|
||||
self._download_count = attributes[ "download_count" ]
|
||||
if "expirationdate" in attributes and attributes[ "expirationdate" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "expirationdate" ], ( str, unicode ) ), attributes[ "expirationdate" ]
|
||||
self.__expirationdate = attributes[ "expirationdate" ]
|
||||
self._expirationdate = attributes[ "expirationdate" ]
|
||||
if "html_url" in attributes and attributes[ "html_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
|
||||
self.__html_url = attributes[ "html_url" ]
|
||||
self._html_url = attributes[ "html_url" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "mime_type" in attributes and attributes[ "mime_type" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "mime_type" ], ( str, unicode ) ), attributes[ "mime_type" ]
|
||||
self.__mime_type = attributes[ "mime_type" ]
|
||||
self._mime_type = attributes[ "mime_type" ]
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "path" in attributes and attributes[ "path" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ]
|
||||
self.__path = attributes[ "path" ]
|
||||
self._path = attributes[ "path" ]
|
||||
if "policy" in attributes and attributes[ "policy" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "policy" ], ( str, unicode ) ), attributes[ "policy" ]
|
||||
self.__policy = attributes[ "policy" ]
|
||||
self._policy = attributes[ "policy" ]
|
||||
if "prefix" in attributes and attributes[ "prefix" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "prefix" ], ( str, unicode ) ), attributes[ "prefix" ]
|
||||
self.__prefix = attributes[ "prefix" ]
|
||||
self._prefix = attributes[ "prefix" ]
|
||||
if "redirect" in attributes and attributes[ "redirect" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "redirect" ], bool ), attributes[ "redirect" ]
|
||||
self.__redirect = attributes[ "redirect" ]
|
||||
self._redirect = attributes[ "redirect" ]
|
||||
if "s3_url" in attributes and attributes[ "s3_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "s3_url" ], ( str, unicode ) ), attributes[ "s3_url" ]
|
||||
self.__s3_url = attributes[ "s3_url" ]
|
||||
self._s3_url = attributes[ "s3_url" ]
|
||||
if "signature" in attributes and attributes[ "signature" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "signature" ], ( str, unicode ) ), attributes[ "signature" ]
|
||||
self.__signature = attributes[ "signature" ]
|
||||
self._signature = attributes[ "signature" ]
|
||||
if "size" in attributes and attributes[ "size" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "size" ], int ), attributes[ "size" ]
|
||||
self.__size = attributes[ "size" ]
|
||||
self._size = attributes[ "size" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+29
-35
@@ -1,82 +1,76 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import Organization
|
||||
import Repository
|
||||
import NamedUser
|
||||
|
||||
class Event( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class Event( GithubObject.GithubObject ):
|
||||
@property
|
||||
def actor( self ):
|
||||
return self.__actor
|
||||
return self._actor
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
return self.__created_at
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
return self.__id
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def org( self ):
|
||||
return self.__org
|
||||
return self._org
|
||||
|
||||
@property
|
||||
def payload( self ):
|
||||
return self.__payload
|
||||
return self._payload
|
||||
|
||||
@property
|
||||
def public( self ):
|
||||
return self.__public
|
||||
return self._public
|
||||
|
||||
@property
|
||||
def repo( self ):
|
||||
return self.__repo
|
||||
return self._repo
|
||||
|
||||
@property
|
||||
def type( self ):
|
||||
return self.__type
|
||||
return self._type
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__actor = None
|
||||
self.__created_at = None
|
||||
self.__id = None
|
||||
self.__org = None
|
||||
self.__payload = None
|
||||
self.__public = None
|
||||
self.__repo = None
|
||||
self.__type = None
|
||||
def _initAttributes( self ):
|
||||
self._actor = None
|
||||
self._created_at = None
|
||||
self._id = None
|
||||
self._org = None
|
||||
self._payload = None
|
||||
self._public = None
|
||||
self._repo = None
|
||||
self._type = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "actor" in attributes and attributes[ "actor" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "actor" ], dict ), attributes[ "actor" ]
|
||||
self.__actor = NamedUser.NamedUser( self.__requester, attributes[ "actor" ], completed = False )
|
||||
self._actor = NamedUser.NamedUser( self._requester, attributes[ "actor" ], completed = False )
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], ( str, unicode ) ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "org" in attributes and attributes[ "org" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "org" ], dict ), attributes[ "org" ]
|
||||
self.__org = Organization.Organization( self.__requester, attributes[ "org" ], completed = False )
|
||||
self._org = Organization.Organization( self._requester, attributes[ "org" ], completed = False )
|
||||
if "payload" in attributes and attributes[ "payload" ] is not None: # pragma no branch
|
||||
self.__payload = attributes[ "payload" ]
|
||||
self._payload = attributes[ "payload" ]
|
||||
if "public" in attributes and attributes[ "public" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "public" ], bool ), attributes[ "public" ]
|
||||
self.__public = attributes[ "public" ]
|
||||
self._public = attributes[ "public" ]
|
||||
if "repo" in attributes and attributes[ "repo" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "repo" ], dict ), attributes[ "repo" ]
|
||||
self.__repo = Repository.Repository( self.__requester, attributes[ "repo" ], completed = False )
|
||||
self._repo = Repository.Repository( self._requester, attributes[ "repo" ], completed = False )
|
||||
if "type" in attributes and attributes[ "type" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
|
||||
self.__type = attributes[ "type" ]
|
||||
self._type = attributes[ "type" ]
|
||||
|
||||
+89
-116
@@ -1,131 +1,123 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import GistHistoryState
|
||||
import NamedUser
|
||||
import Gist
|
||||
import GistComment
|
||||
|
||||
class Gist( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class Gist( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def comments( self ):
|
||||
self.__completeIfNeeded( self.__comments )
|
||||
return self.__comments
|
||||
self._completeIfNeeded( self._comments )
|
||||
return self._comments
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def description( self ):
|
||||
self.__completeIfNeeded( self.__description )
|
||||
return self.__description
|
||||
self._completeIfNeeded( self._description )
|
||||
return self._description
|
||||
|
||||
@property
|
||||
def files( self ):
|
||||
self.__completeIfNeeded( self.__files )
|
||||
return self.__files
|
||||
self._completeIfNeeded( self._files )
|
||||
return self._files
|
||||
|
||||
@property
|
||||
def fork_of( self ):
|
||||
self.__completeIfNeeded( self.__fork_of )
|
||||
return self.__fork_of
|
||||
self._completeIfNeeded( self._fork_of )
|
||||
return self._fork_of
|
||||
|
||||
@property
|
||||
def forks( self ):
|
||||
self.__completeIfNeeded( self.__forks )
|
||||
return self.__forks
|
||||
self._completeIfNeeded( self._forks )
|
||||
return self._forks
|
||||
|
||||
@property
|
||||
def git_pull_url( self ):
|
||||
self.__completeIfNeeded( self.__git_pull_url )
|
||||
return self.__git_pull_url
|
||||
self._completeIfNeeded( self._git_pull_url )
|
||||
return self._git_pull_url
|
||||
|
||||
@property
|
||||
def git_push_url( self ):
|
||||
self.__completeIfNeeded( self.__git_push_url )
|
||||
return self.__git_push_url
|
||||
self._completeIfNeeded( self._git_push_url )
|
||||
return self._git_push_url
|
||||
|
||||
@property
|
||||
def history( self ):
|
||||
self.__completeIfNeeded( self.__history )
|
||||
return self.__history
|
||||
self._completeIfNeeded( self._history )
|
||||
return self._history
|
||||
|
||||
@property
|
||||
def html_url( self ):
|
||||
self.__completeIfNeeded( self.__html_url )
|
||||
return self.__html_url
|
||||
self._completeIfNeeded( self._html_url )
|
||||
return self._html_url
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def public( self ):
|
||||
self.__completeIfNeeded( self.__public )
|
||||
return self.__public
|
||||
self._completeIfNeeded( self._public )
|
||||
return self._public
|
||||
|
||||
@property
|
||||
def updated_at( self ):
|
||||
self.__completeIfNeeded( self.__updated_at )
|
||||
return self.__updated_at
|
||||
self._completeIfNeeded( self._updated_at )
|
||||
return self._updated_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def user( self ):
|
||||
self.__completeIfNeeded( self.__user )
|
||||
return self.__user
|
||||
self._completeIfNeeded( self._user )
|
||||
return self._user
|
||||
|
||||
def create_comment( self, body ):
|
||||
assert isinstance( body, ( str, unicode ) ), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/comments",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return GistComment.GistComment( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return GistComment.GistComment( self._requester, data, completed = True )
|
||||
|
||||
def create_fork( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/fork",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Gist( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Gist( self._requester, data, completed = True )
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, description = DefaultValueForOptionalParameters, files = DefaultValueForOptionalParameters ):
|
||||
if description is not DefaultValueForOptionalParameters:
|
||||
@@ -135,46 +127,43 @@ class Gist( object ):
|
||||
post_parameters[ "description" ] = description
|
||||
if files is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "files" ] = files
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_comment( self, id ):
|
||||
assert isinstance( id, int ), id
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/gists/comments/" + str( id ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return GistComment.GistComment( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return GistComment.GistComment( self._requester, data, completed = True )
|
||||
|
||||
def get_comments( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
GistComment.GistComment,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def is_starred( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/star",
|
||||
None,
|
||||
@@ -183,104 +172,88 @@ class Gist( object ):
|
||||
return status == 204
|
||||
|
||||
def reset_starred( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ) + "/star",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def set_starred( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PUT",
|
||||
str( self.url ) + "/star",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__comments = None
|
||||
self.__created_at = None
|
||||
self.__description = None
|
||||
self.__files = None
|
||||
self.__fork_of = None
|
||||
self.__forks = None
|
||||
self.__git_pull_url = None
|
||||
self.__git_push_url = None
|
||||
self.__history = None
|
||||
self.__html_url = None
|
||||
self.__id = None
|
||||
self.__public = None
|
||||
self.__updated_at = None
|
||||
self.__url = None
|
||||
self.__user = None
|
||||
def _initAttributes( self ):
|
||||
self._comments = None
|
||||
self._created_at = None
|
||||
self._description = None
|
||||
self._files = None
|
||||
self._fork_of = None
|
||||
self._forks = None
|
||||
self._git_pull_url = None
|
||||
self._git_push_url = None
|
||||
self._history = None
|
||||
self._html_url = None
|
||||
self._id = None
|
||||
self._public = None
|
||||
self._updated_at = None
|
||||
self._url = None
|
||||
self._user = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "comments" in attributes and attributes[ "comments" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "comments" ], int ), attributes[ "comments" ]
|
||||
self.__comments = attributes[ "comments" ]
|
||||
self._comments = attributes[ "comments" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "description" in attributes and attributes[ "description" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
|
||||
self.__description = attributes[ "description" ]
|
||||
self._description = attributes[ "description" ]
|
||||
if "files" in attributes and attributes[ "files" ] is not None: # pragma no branch
|
||||
self.__files = attributes[ "files" ]
|
||||
self._files = attributes[ "files" ]
|
||||
if "fork_of" in attributes and attributes[ "fork_of" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "fork_of" ], dict ), attributes[ "fork_of" ]
|
||||
self.__fork_of = Gist( self.__requester, attributes[ "fork_of" ], completed = False )
|
||||
self._fork_of = Gist( self._requester, attributes[ "fork_of" ], completed = False )
|
||||
if "forks" in attributes and attributes[ "forks" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, dict ) for element in attributes[ "forks" ] ), attributes[ "forks" ]
|
||||
self.__forks = [
|
||||
Gist( self.__requester, element, completed = False )
|
||||
self._forks = [
|
||||
Gist( self._requester, element, completed = False )
|
||||
for element in attributes[ "forks" ]
|
||||
]
|
||||
if "git_pull_url" in attributes and attributes[ "git_pull_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "git_pull_url" ], ( str, unicode ) ), attributes[ "git_pull_url" ]
|
||||
self.__git_pull_url = attributes[ "git_pull_url" ]
|
||||
self._git_pull_url = attributes[ "git_pull_url" ]
|
||||
if "git_push_url" in attributes and attributes[ "git_push_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "git_push_url" ], ( str, unicode ) ), attributes[ "git_push_url" ]
|
||||
self.__git_push_url = attributes[ "git_push_url" ]
|
||||
self._git_push_url = attributes[ "git_push_url" ]
|
||||
if "history" in attributes and attributes[ "history" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, dict ) for element in attributes[ "history" ] ), attributes[ "history" ]
|
||||
self.__history = [
|
||||
GistHistoryState.GistHistoryState( self.__requester, element, completed = False )
|
||||
self._history = [
|
||||
GistHistoryState.GistHistoryState( self._requester, element, completed = False )
|
||||
for element in attributes[ "history" ]
|
||||
]
|
||||
if "html_url" in attributes and attributes[ "html_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
|
||||
self.__html_url = attributes[ "html_url" ]
|
||||
self._html_url = attributes[ "html_url" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], ( str, unicode ) ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "public" in attributes and attributes[ "public" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "public" ], bool ), attributes[ "public" ]
|
||||
self.__public = attributes[ "public" ]
|
||||
self._public = attributes[ "public" ]
|
||||
if "updated_at" in attributes and attributes[ "updated_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
|
||||
self.__updated_at = attributes[ "updated_at" ]
|
||||
self._updated_at = attributes[ "updated_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "user" in attributes and attributes[ "user" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "user" ], dict ), attributes[ "user" ]
|
||||
self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completed = False )
|
||||
self._user = NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False )
|
||||
|
||||
+28
-36
@@ -1,90 +1,82 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import NamedUser
|
||||
|
||||
class GistComment( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class GistComment( GithubObject.GithubObject ):
|
||||
@property
|
||||
def body( self ):
|
||||
return self.__body
|
||||
return self._body
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
return self.__created_at
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
return self.__id
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def updated_at( self ):
|
||||
return self.__updated_at
|
||||
return self._updated_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def user( self ):
|
||||
return self.__user
|
||||
return self._user
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, body ):
|
||||
assert isinstance( body, ( str, unicode ) ), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__body = None
|
||||
self.__created_at = None
|
||||
self.__id = None
|
||||
self.__updated_at = None
|
||||
self.__url = None
|
||||
self.__user = None
|
||||
def _initAttributes( self ):
|
||||
self._body = None
|
||||
self._created_at = None
|
||||
self._id = None
|
||||
self._updated_at = None
|
||||
self._url = None
|
||||
self._user = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
|
||||
self.__body = attributes[ "body" ]
|
||||
self._body = attributes[ "body" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "updated_at" in attributes and attributes[ "updated_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
|
||||
self.__updated_at = attributes[ "updated_at" ]
|
||||
self._updated_at = attributes[ "updated_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "user" in attributes and attributes[ "user" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "user" ], dict ), attributes[ "user" ]
|
||||
self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completed = False )
|
||||
self._user = NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False )
|
||||
|
||||
@@ -1,58 +1,52 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import NamedUser
|
||||
import CommitStats
|
||||
|
||||
class GistHistoryState( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class GistHistoryState( GithubObject.GithubObject ):
|
||||
@property
|
||||
def change_status( self ):
|
||||
return self.__change_status
|
||||
return self._change_status
|
||||
|
||||
@property
|
||||
def committed_at( self ):
|
||||
return self.__committed_at
|
||||
return self._committed_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def user( self ):
|
||||
return self.__user
|
||||
return self._user
|
||||
|
||||
@property
|
||||
def version( self ):
|
||||
return self.__version
|
||||
return self._version
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__change_status = None
|
||||
self.__committed_at = None
|
||||
self.__url = None
|
||||
self.__user = None
|
||||
self.__version = None
|
||||
def _initAttributes( self ):
|
||||
self._change_status = None
|
||||
self._committed_at = None
|
||||
self._url = None
|
||||
self._user = None
|
||||
self._version = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "change_status" in attributes and attributes[ "change_status" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "change_status" ], dict ), attributes[ "change_status" ]
|
||||
self.__change_status = CommitStats.CommitStats( self.__requester, attributes[ "change_status" ], completed = False )
|
||||
self._change_status = CommitStats.CommitStats( self._requester, attributes[ "change_status" ], completed = False )
|
||||
if "committed_at" in attributes and attributes[ "committed_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "committed_at" ], ( str, unicode ) ), attributes[ "committed_at" ]
|
||||
self.__committed_at = attributes[ "committed_at" ]
|
||||
self._committed_at = attributes[ "committed_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "user" in attributes and attributes[ "user" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "user" ], dict ), attributes[ "user" ]
|
||||
self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completed = False )
|
||||
self._user = NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False )
|
||||
if "version" in attributes and attributes[ "version" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "version" ], ( str, unicode ) ), attributes[ "version" ]
|
||||
self.__version = attributes[ "version" ]
|
||||
self._version = attributes[ "version" ]
|
||||
|
||||
+13
-20
@@ -1,40 +1,33 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class GitAuthor( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class GitAuthor( GithubObject.GithubObject ):
|
||||
@property
|
||||
def date( self ):
|
||||
return self.__date
|
||||
return self._date
|
||||
|
||||
@property
|
||||
def email( self ):
|
||||
return self.__email
|
||||
return self._email
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
return self.__name
|
||||
return self._name
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__date = None
|
||||
self.__email = None
|
||||
self.__name = None
|
||||
def _initAttributes( self ):
|
||||
self._date = None
|
||||
self._email = None
|
||||
self._name = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "date" in attributes and attributes[ "date" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "date" ], ( str, unicode ) ), attributes[ "date" ]
|
||||
self.__date = attributes[ "date" ]
|
||||
self._date = attributes[ "date" ]
|
||||
if "email" in attributes and attributes[ "email" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ]
|
||||
self.__email = attributes[ "email" ]
|
||||
self._email = attributes[ "email" ]
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
|
||||
+19
-26
@@ -1,56 +1,49 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class GitBlob( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class GitBlob( GithubObject.GithubObject ):
|
||||
@property
|
||||
def content( self ):
|
||||
return self.__content
|
||||
return self._content
|
||||
|
||||
@property
|
||||
def encoding( self ):
|
||||
return self.__encoding
|
||||
return self._encoding
|
||||
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
return self._sha
|
||||
|
||||
@property
|
||||
def size( self ):
|
||||
return self.__size
|
||||
return self._size
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__content = None
|
||||
self.__encoding = None
|
||||
self.__sha = None
|
||||
self.__size = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._content = None
|
||||
self._encoding = None
|
||||
self._sha = None
|
||||
self._size = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "content" in attributes and attributes[ "content" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "content" ], ( str, unicode ) ), attributes[ "content" ]
|
||||
self.__content = attributes[ "content" ]
|
||||
self._content = attributes[ "content" ]
|
||||
if "encoding" in attributes and attributes[ "encoding" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "encoding" ], ( str, unicode ) ), attributes[ "encoding" ]
|
||||
self.__encoding = attributes[ "encoding" ]
|
||||
self._encoding = attributes[ "encoding" ]
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
if "size" in attributes and attributes[ "size" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "size" ], int ), attributes[ "size" ]
|
||||
self.__size = attributes[ "size" ]
|
||||
self._size = attributes[ "size" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+27
-33
@@ -1,78 +1,72 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import GitAuthor
|
||||
import GitCommit
|
||||
import GitTree
|
||||
|
||||
class GitCommit( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class GitCommit( GithubObject.GithubObject ):
|
||||
@property
|
||||
def author( self ):
|
||||
return self.__author
|
||||
return self._author
|
||||
|
||||
@property
|
||||
def committer( self ):
|
||||
return self.__committer
|
||||
return self._committer
|
||||
|
||||
@property
|
||||
def message( self ):
|
||||
return self.__message
|
||||
return self._message
|
||||
|
||||
@property
|
||||
def parents( self ):
|
||||
return self.__parents
|
||||
return self._parents
|
||||
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
return self._sha
|
||||
|
||||
@property
|
||||
def tree( self ):
|
||||
return self.__tree
|
||||
return self._tree
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__author = None
|
||||
self.__committer = None
|
||||
self.__message = None
|
||||
self.__parents = None
|
||||
self.__sha = None
|
||||
self.__tree = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._author = None
|
||||
self._committer = None
|
||||
self._message = None
|
||||
self._parents = None
|
||||
self._sha = None
|
||||
self._tree = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "author" in attributes and attributes[ "author" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "author" ], dict ), attributes[ "author" ]
|
||||
self.__author = GitAuthor.GitAuthor( self.__requester, attributes[ "author" ], completed = False )
|
||||
self._author = GitAuthor.GitAuthor( self._requester, attributes[ "author" ], completed = False )
|
||||
if "committer" in attributes and attributes[ "committer" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "committer" ], dict ), attributes[ "committer" ]
|
||||
self.__committer = GitAuthor.GitAuthor( self.__requester, attributes[ "committer" ], completed = False )
|
||||
self._committer = GitAuthor.GitAuthor( self._requester, attributes[ "committer" ], completed = False )
|
||||
if "message" in attributes and attributes[ "message" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ]
|
||||
self.__message = attributes[ "message" ]
|
||||
self._message = attributes[ "message" ]
|
||||
if "parents" in attributes and attributes[ "parents" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, dict ) for element in attributes[ "parents" ] ), attributes[ "parents" ]
|
||||
self.__parents = [
|
||||
GitCommit( self.__requester, element, completed = False )
|
||||
self._parents = [
|
||||
GitCommit( self._requester, element, completed = False )
|
||||
for element in attributes[ "parents" ]
|
||||
]
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
if "tree" in attributes and attributes[ "tree" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "tree" ], dict ), attributes[ "tree" ]
|
||||
self.__tree = GitTree.GitTree( self.__requester, attributes[ "tree" ], completed = False )
|
||||
self._tree = GitTree.GitTree( self._requester, attributes[ "tree" ], completed = False )
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+13
-20
@@ -1,40 +1,33 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class GitObject( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class GitObject( GithubObject.GithubObject ):
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
return self._sha
|
||||
|
||||
@property
|
||||
def type( self ):
|
||||
return self.__type
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__sha = None
|
||||
self.__type = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._sha = None
|
||||
self._type = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
if "type" in attributes and attributes[ "type" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
|
||||
self.__type = attributes[ "type" ]
|
||||
self._type = attributes[ "type" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+19
-26
@@ -1,38 +1,32 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
import GithubObject
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import GitObject
|
||||
|
||||
class GitRef( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class GitRef( GithubObject.GithubObject ):
|
||||
@property
|
||||
def object( self ):
|
||||
return self.__object
|
||||
return self._object
|
||||
|
||||
@property
|
||||
def ref( self ):
|
||||
return self.__ref
|
||||
return self._ref
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, sha, force = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( sha, ( str, unicode ) ), sha
|
||||
@@ -43,28 +37,27 @@ class GitRef( object ):
|
||||
}
|
||||
if force is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "force" ] = force
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__object = None
|
||||
self.__ref = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._object = None
|
||||
self._ref = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "object" in attributes and attributes[ "object" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "object" ], dict ), attributes[ "object" ]
|
||||
self.__object = GitObject.GitObject( self.__requester, attributes[ "object" ], completed = False )
|
||||
self._object = GitObject.GitObject( self._requester, attributes[ "object" ], completed = False )
|
||||
if "ref" in attributes and attributes[ "ref" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "ref" ], ( str, unicode ) ), attributes[ "ref" ]
|
||||
self.__ref = attributes[ "ref" ]
|
||||
self._ref = attributes[ "ref" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+23
-29
@@ -1,66 +1,60 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import GitAuthor
|
||||
import GitObject
|
||||
|
||||
class GitTag( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class GitTag( GithubObject.GithubObject ):
|
||||
@property
|
||||
def message( self ):
|
||||
return self.__message
|
||||
return self._message
|
||||
|
||||
@property
|
||||
def object( self ):
|
||||
return self.__object
|
||||
return self._object
|
||||
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
return self._sha
|
||||
|
||||
@property
|
||||
def tag( self ):
|
||||
return self.__tag
|
||||
return self._tag
|
||||
|
||||
@property
|
||||
def tagger( self ):
|
||||
return self.__tagger
|
||||
return self._tagger
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__message = None
|
||||
self.__object = None
|
||||
self.__sha = None
|
||||
self.__tag = None
|
||||
self.__tagger = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._message = None
|
||||
self._object = None
|
||||
self._sha = None
|
||||
self._tag = None
|
||||
self._tagger = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "message" in attributes and attributes[ "message" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ]
|
||||
self.__message = attributes[ "message" ]
|
||||
self._message = attributes[ "message" ]
|
||||
if "object" in attributes and attributes[ "object" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "object" ], dict ), attributes[ "object" ]
|
||||
self.__object = GitObject.GitObject( self.__requester, attributes[ "object" ], completed = False )
|
||||
self._object = GitObject.GitObject( self._requester, attributes[ "object" ], completed = False )
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
if "tag" in attributes and attributes[ "tag" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "tag" ], ( str, unicode ) ), attributes[ "tag" ]
|
||||
self.__tag = attributes[ "tag" ]
|
||||
self._tag = attributes[ "tag" ]
|
||||
if "tagger" in attributes and attributes[ "tagger" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "tagger" ], dict ), attributes[ "tagger" ]
|
||||
self.__tagger = GitAuthor.GitAuthor( self.__requester, attributes[ "tagger" ], completed = False )
|
||||
self._tagger = GitAuthor.GitAuthor( self._requester, attributes[ "tagger" ], completed = False )
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+15
-21
@@ -1,44 +1,38 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import GitTreeElement
|
||||
|
||||
class GitTree( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class GitTree( GithubObject.GithubObject ):
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
return self._sha
|
||||
|
||||
@property
|
||||
def tree( self ):
|
||||
return self.__tree
|
||||
return self._tree
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__sha = None
|
||||
self.__tree = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._sha = None
|
||||
self._tree = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
if "tree" in attributes and attributes[ "tree" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, dict ) for element in attributes[ "tree" ] ), attributes[ "tree" ]
|
||||
self.__tree = [
|
||||
GitTreeElement.GitTreeElement( self.__requester, element, completed = False )
|
||||
self._tree = [
|
||||
GitTreeElement.GitTreeElement( self._requester, element, completed = False )
|
||||
for element in attributes[ "tree" ]
|
||||
]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
@@ -1,64 +1,57 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class GitTreeElement( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class GitTreeElement( GithubObject.GithubObject ):
|
||||
@property
|
||||
def mode( self ):
|
||||
return self.__mode
|
||||
return self._mode
|
||||
|
||||
@property
|
||||
def path( self ):
|
||||
return self.__path
|
||||
return self._path
|
||||
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
return self._sha
|
||||
|
||||
@property
|
||||
def size( self ):
|
||||
return self.__size
|
||||
return self._size
|
||||
|
||||
@property
|
||||
def type( self ):
|
||||
return self.__type
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__mode = None
|
||||
self.__path = None
|
||||
self.__sha = None
|
||||
self.__size = None
|
||||
self.__type = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._mode = None
|
||||
self._path = None
|
||||
self._sha = None
|
||||
self._size = None
|
||||
self._type = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "mode" in attributes and attributes[ "mode" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "mode" ], ( str, unicode ) ), attributes[ "mode" ]
|
||||
self.__mode = attributes[ "mode" ]
|
||||
self._mode = attributes[ "mode" ]
|
||||
if "path" in attributes and attributes[ "path" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ]
|
||||
self.__path = attributes[ "path" ]
|
||||
self._path = attributes[ "path" ]
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
if "size" in attributes and attributes[ "size" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "size" ], int ), attributes[ "size" ]
|
||||
self.__size = attributes[ "size" ]
|
||||
self._size = attributes[ "size" ]
|
||||
if "type" in attributes and attributes[ "type" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
|
||||
self.__type = attributes[ "type" ]
|
||||
self._type = attributes[ "type" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import GithubException
|
||||
|
||||
class GithubObject( object ):
|
||||
def __init__( self, requester, attributes, completed ): ### 'completed' may be removed if I find a way
|
||||
self._requester = requester
|
||||
self._initAttributes()
|
||||
self._useAttributes( attributes )
|
||||
|
||||
def _request( self, verb, url, parameters, input ):
|
||||
return self._requester.request( verb, url, parameters, input )
|
||||
|
||||
def _parentUrl( self, url ):
|
||||
return "/".join( url.split( "/" )[ : -1 ] )
|
||||
|
||||
def _checkStatus( self, status, data ):
|
||||
if status >= 400: # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
|
||||
class CompletableGithubObject( GithubObject ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
GithubObject.__init__( self, requester, attributes, completed )
|
||||
self.__completed = completed
|
||||
|
||||
def _completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
self._url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self._useAttributes( data )
|
||||
self._completed = True
|
||||
+39
-47
@@ -1,62 +1,56 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
import GithubObject
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import HookResponse
|
||||
|
||||
class Hook( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class Hook( GithubObject.GithubObject ):
|
||||
@property
|
||||
def active( self ):
|
||||
return self.__active
|
||||
return self._active
|
||||
|
||||
@property
|
||||
def config( self ):
|
||||
return self.__config
|
||||
return self._config
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
return self.__created_at
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def events( self ):
|
||||
return self.__events
|
||||
return self._events
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
return self.__id
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def last_response( self ):
|
||||
return self.__last_response
|
||||
return self._last_response
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
return self.__name
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def updated_at( self ):
|
||||
return self.__updated_at
|
||||
return self._updated_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, name, config, events = DefaultValueForOptionalParameters, add_events = DefaultValueForOptionalParameters, remove_events = DefaultValueForOptionalParameters, active = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( name, ( str, unicode ) ), name
|
||||
@@ -80,61 +74,59 @@ class Hook( object ):
|
||||
post_parameters[ "remove_events" ] = remove_events
|
||||
if active is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "active" ] = active
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def test( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/test",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__active = None
|
||||
self.__config = None
|
||||
self.__created_at = None
|
||||
self.__events = None
|
||||
self.__id = None
|
||||
self.__last_response = None
|
||||
self.__name = None
|
||||
self.__updated_at = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._active = None
|
||||
self._config = None
|
||||
self._created_at = None
|
||||
self._events = None
|
||||
self._id = None
|
||||
self._last_response = None
|
||||
self._name = None
|
||||
self._updated_at = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "active" in attributes and attributes[ "active" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "active" ], bool ), attributes[ "active" ]
|
||||
self.__active = attributes[ "active" ]
|
||||
self._active = attributes[ "active" ]
|
||||
if "config" in attributes and attributes[ "config" ] is not None: # pragma no branch
|
||||
self.__config = attributes[ "config" ]
|
||||
self._config = attributes[ "config" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "events" in attributes and attributes[ "events" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, ( str, unicode ) ) for element in attributes[ "events" ] ), attributes[ "events" ]
|
||||
self.__events = attributes[ "events" ]
|
||||
self._events = attributes[ "events" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "last_response" in attributes and attributes[ "last_response" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "last_response" ], dict ), attributes[ "last_response" ]
|
||||
self.__last_response = HookResponse.HookResponse( self.__requester, attributes[ "last_response" ], completed = False )
|
||||
self._last_response = HookResponse.HookResponse( self._requester, attributes[ "last_response" ], completed = False )
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "updated_at" in attributes and attributes[ "updated_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
|
||||
self.__updated_at = attributes[ "updated_at" ]
|
||||
self._updated_at = attributes[ "updated_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+13
-20
@@ -1,40 +1,33 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class HookResponse( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class HookResponse( GithubObject.GithubObject ):
|
||||
@property
|
||||
def code( self ):
|
||||
return self.__code
|
||||
return self._code
|
||||
|
||||
@property
|
||||
def message( self ):
|
||||
return self.__message
|
||||
return self._message
|
||||
|
||||
@property
|
||||
def status( self ):
|
||||
return self.__status
|
||||
return self._status
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__code = None
|
||||
self.__message = None
|
||||
self.__status = None
|
||||
def _initAttributes( self ):
|
||||
self._code = None
|
||||
self._message = None
|
||||
self._status = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "code" in attributes and attributes[ "code" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "code" ], int ), attributes[ "code" ]
|
||||
self.__code = attributes[ "code" ]
|
||||
self._code = attributes[ "code" ]
|
||||
if "message" in attributes and attributes[ "message" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ]
|
||||
self.__message = attributes[ "message" ]
|
||||
self._message = attributes[ "message" ]
|
||||
if "status" in attributes and attributes[ "status" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "status" ], ( str, unicode ) ), attributes[ "status" ]
|
||||
self.__status = attributes[ "status" ]
|
||||
self._status = attributes[ "status" ]
|
||||
|
||||
+105
-134
@@ -1,9 +1,10 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import Repository
|
||||
import IssueEvent
|
||||
import Label
|
||||
@@ -12,139 +13,130 @@ import Milestone
|
||||
import IssueComment
|
||||
import IssuePullRequest
|
||||
|
||||
class Issue( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class Issue( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def assignee( self ):
|
||||
self.__completeIfNeeded( self.__assignee )
|
||||
return self.__assignee
|
||||
self._completeIfNeeded( self._assignee )
|
||||
return self._assignee
|
||||
|
||||
@property
|
||||
def body( self ):
|
||||
self.__completeIfNeeded( self.__body )
|
||||
return self.__body
|
||||
self._completeIfNeeded( self._body )
|
||||
return self._body
|
||||
|
||||
@property
|
||||
def closed_at( self ):
|
||||
self.__completeIfNeeded( self.__closed_at )
|
||||
return self.__closed_at
|
||||
self._completeIfNeeded( self._closed_at )
|
||||
return self._closed_at
|
||||
|
||||
@property
|
||||
def closed_by( self ):
|
||||
self.__completeIfNeeded( self.__closed_by )
|
||||
return self.__closed_by
|
||||
self._completeIfNeeded( self._closed_by )
|
||||
return self._closed_by
|
||||
|
||||
@property
|
||||
def comments( self ):
|
||||
self.__completeIfNeeded( self.__comments )
|
||||
return self.__comments
|
||||
self._completeIfNeeded( self._comments )
|
||||
return self._comments
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def html_url( self ):
|
||||
self.__completeIfNeeded( self.__html_url )
|
||||
return self.__html_url
|
||||
self._completeIfNeeded( self._html_url )
|
||||
return self._html_url
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def labels( self ):
|
||||
self.__completeIfNeeded( self.__labels )
|
||||
return self.__labels
|
||||
self._completeIfNeeded( self._labels )
|
||||
return self._labels
|
||||
|
||||
@property
|
||||
def milestone( self ):
|
||||
self.__completeIfNeeded( self.__milestone )
|
||||
return self.__milestone
|
||||
self._completeIfNeeded( self._milestone )
|
||||
return self._milestone
|
||||
|
||||
@property
|
||||
def number( self ):
|
||||
self.__completeIfNeeded( self.__number )
|
||||
return self.__number
|
||||
self._completeIfNeeded( self._number )
|
||||
return self._number
|
||||
|
||||
@property
|
||||
def pull_request( self ):
|
||||
self.__completeIfNeeded( self.__pull_request )
|
||||
return self.__pull_request
|
||||
self._completeIfNeeded( self._pull_request )
|
||||
return self._pull_request
|
||||
|
||||
@property
|
||||
def repository( self ):
|
||||
self.__completeIfNeeded( self.__repository )
|
||||
return self.__repository
|
||||
self._completeIfNeeded( self._repository )
|
||||
return self._repository
|
||||
|
||||
@property
|
||||
def state( self ):
|
||||
self.__completeIfNeeded( self.__state )
|
||||
return self.__state
|
||||
self._completeIfNeeded( self._state )
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def title( self ):
|
||||
self.__completeIfNeeded( self.__title )
|
||||
return self.__title
|
||||
self._completeIfNeeded( self._title )
|
||||
return self._title
|
||||
|
||||
@property
|
||||
def updated_at( self ):
|
||||
self.__completeIfNeeded( self.__updated_at )
|
||||
return self.__updated_at
|
||||
self._completeIfNeeded( self._updated_at )
|
||||
return self._updated_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def user( self ):
|
||||
self.__completeIfNeeded( self.__user )
|
||||
return self.__user
|
||||
self._completeIfNeeded( self._user )
|
||||
return self._user
|
||||
|
||||
def add_to_labels( self, *labels ):
|
||||
assert all( isinstance( label, Label.Label ) for label in labels ), labels
|
||||
post_parameters = [ label._identity for label in labels ]
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/labels",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def create_comment( self, body ):
|
||||
assert isinstance( body, ( str, unicode ) ), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/comments",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return IssueComment.IssueComment( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return IssueComment.IssueComment( self._requester, data, completed = True )
|
||||
|
||||
def delete_labels( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ) + "/labels",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, title = DefaultValueForOptionalParameters, body = DefaultValueForOptionalParameters, assignee = DefaultValueForOptionalParameters, state = DefaultValueForOptionalParameters, milestone = DefaultValueForOptionalParameters, labels = DefaultValueForOptionalParameters ):
|
||||
if title is not DefaultValueForOptionalParameters:
|
||||
@@ -172,188 +164,167 @@ class Issue( object ):
|
||||
post_parameters[ "milestone" ] = milestone
|
||||
if labels is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "labels" ] = labels
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_comment( self, id ):
|
||||
assert isinstance( id, int ), id
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
self.__requester.parentUrl( str( self.url ) ) + "/comments/" + str( id ),
|
||||
self._parentUrl( str( self.url ) ) + "/comments/" + str( id ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return IssueComment.IssueComment( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return IssueComment.IssueComment( self._requester, data, completed = True )
|
||||
|
||||
def get_comments( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueComment.IssueComment,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_events( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
IssueEvent.IssueEvent,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_labels( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/labels",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Label.Label,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def remove_from_labels( self, label ):
|
||||
assert isinstance( label, Label.Label ), label
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ) + "/labels/" + str( label._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def set_labels( self, *labels ):
|
||||
assert all( isinstance( label, Label.Label ) for label in labels ), labels
|
||||
post_parameters = [ label._identity for label in labels ]
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PUT",
|
||||
str( self.url ) + "/labels",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__assignee = None
|
||||
self.__body = None
|
||||
self.__closed_at = None
|
||||
self.__closed_by = None
|
||||
self.__comments = None
|
||||
self.__created_at = None
|
||||
self.__html_url = None
|
||||
self.__id = None
|
||||
self.__labels = None
|
||||
self.__milestone = None
|
||||
self.__number = None
|
||||
self.__pull_request = None
|
||||
self.__repository = None
|
||||
self.__state = None
|
||||
self.__title = None
|
||||
self.__updated_at = None
|
||||
self.__url = None
|
||||
self.__user = None
|
||||
def _initAttributes( self ):
|
||||
self._assignee = None
|
||||
self._body = None
|
||||
self._closed_at = None
|
||||
self._closed_by = None
|
||||
self._comments = None
|
||||
self._created_at = None
|
||||
self._html_url = None
|
||||
self._id = None
|
||||
self._labels = None
|
||||
self._milestone = None
|
||||
self._number = None
|
||||
self._pull_request = None
|
||||
self._repository = None
|
||||
self._state = None
|
||||
self._title = None
|
||||
self._updated_at = None
|
||||
self._url = None
|
||||
self._user = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "assignee" in attributes and attributes[ "assignee" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "assignee" ], dict ), attributes[ "assignee" ]
|
||||
self.__assignee = NamedUser.NamedUser( self.__requester, attributes[ "assignee" ], completed = False )
|
||||
self._assignee = NamedUser.NamedUser( self._requester, attributes[ "assignee" ], completed = False )
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
|
||||
self.__body = attributes[ "body" ]
|
||||
self._body = attributes[ "body" ]
|
||||
if "closed_at" in attributes and attributes[ "closed_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ]
|
||||
self.__closed_at = attributes[ "closed_at" ]
|
||||
self._closed_at = attributes[ "closed_at" ]
|
||||
if "closed_by" in attributes and attributes[ "closed_by" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "closed_by" ], dict ), attributes[ "closed_by" ]
|
||||
self.__closed_by = NamedUser.NamedUser( self.__requester, attributes[ "closed_by" ], completed = False )
|
||||
self._closed_by = NamedUser.NamedUser( self._requester, attributes[ "closed_by" ], completed = False )
|
||||
if "comments" in attributes and attributes[ "comments" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "comments" ], int ), attributes[ "comments" ]
|
||||
self.__comments = attributes[ "comments" ]
|
||||
self._comments = attributes[ "comments" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "html_url" in attributes and attributes[ "html_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
|
||||
self.__html_url = attributes[ "html_url" ]
|
||||
self._html_url = attributes[ "html_url" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "labels" in attributes and attributes[ "labels" ] is not None: # pragma no branch
|
||||
assert all( isinstance( element, dict ) for element in attributes[ "labels" ] ), attributes[ "labels" ]
|
||||
self.__labels = [
|
||||
Label.Label( self.__requester, element, completed = False )
|
||||
self._labels = [
|
||||
Label.Label( self._requester, element, completed = False )
|
||||
for element in attributes[ "labels" ]
|
||||
]
|
||||
if "milestone" in attributes and attributes[ "milestone" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "milestone" ], dict ), attributes[ "milestone" ]
|
||||
self.__milestone = Milestone.Milestone( self.__requester, attributes[ "milestone" ], completed = False )
|
||||
self._milestone = Milestone.Milestone( self._requester, attributes[ "milestone" ], completed = False )
|
||||
if "number" in attributes and attributes[ "number" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "number" ], int ), attributes[ "number" ]
|
||||
self.__number = attributes[ "number" ]
|
||||
self._number = attributes[ "number" ]
|
||||
if "pull_request" in attributes and attributes[ "pull_request" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "pull_request" ], dict ), attributes[ "pull_request" ]
|
||||
self.__pull_request = IssuePullRequest.IssuePullRequest( self.__requester, attributes[ "pull_request" ], completed = False )
|
||||
self._pull_request = IssuePullRequest.IssuePullRequest( self._requester, attributes[ "pull_request" ], completed = False )
|
||||
if "repository" in attributes and attributes[ "repository" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "repository" ], dict ), attributes[ "repository" ]
|
||||
self.__repository = Repository.Repository( self.__requester, attributes[ "repository" ], completed = False )
|
||||
self._repository = Repository.Repository( self._requester, attributes[ "repository" ], completed = False )
|
||||
if "state" in attributes and attributes[ "state" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ]
|
||||
self.__state = attributes[ "state" ]
|
||||
self._state = attributes[ "state" ]
|
||||
if "title" in attributes and attributes[ "title" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
|
||||
self.__title = attributes[ "title" ]
|
||||
self._title = attributes[ "title" ]
|
||||
if "updated_at" in attributes and attributes[ "updated_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
|
||||
self.__updated_at = attributes[ "updated_at" ]
|
||||
self._updated_at = attributes[ "updated_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "user" in attributes and attributes[ "user" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "user" ], dict ), attributes[ "user" ]
|
||||
self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completed = False )
|
||||
self._user = NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False )
|
||||
|
||||
+28
-36
@@ -1,90 +1,82 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import NamedUser
|
||||
|
||||
class IssueComment( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class IssueComment( GithubObject.GithubObject ):
|
||||
@property
|
||||
def body( self ):
|
||||
return self.__body
|
||||
return self._body
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
return self.__created_at
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
return self.__id
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def updated_at( self ):
|
||||
return self.__updated_at
|
||||
return self._updated_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def user( self ):
|
||||
return self.__user
|
||||
return self._user
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, body ):
|
||||
assert isinstance( body, ( str, unicode ) ), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__body = None
|
||||
self.__created_at = None
|
||||
self.__id = None
|
||||
self.__updated_at = None
|
||||
self.__url = None
|
||||
self.__user = None
|
||||
def _initAttributes( self ):
|
||||
self._body = None
|
||||
self._created_at = None
|
||||
self._id = None
|
||||
self._updated_at = None
|
||||
self._url = None
|
||||
self._user = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
|
||||
self.__body = attributes[ "body" ]
|
||||
self._body = attributes[ "body" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "updated_at" in attributes and attributes[ "updated_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
|
||||
self.__updated_at = attributes[ "updated_at" ]
|
||||
self._updated_at = attributes[ "updated_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "user" in attributes and attributes[ "user" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "user" ], dict ), attributes[ "user" ]
|
||||
self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completed = False )
|
||||
self._user = NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False )
|
||||
|
||||
+33
-54
@@ -1,96 +1,75 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import Issue
|
||||
import NamedUser
|
||||
|
||||
class IssueEvent( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class IssueEvent( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def actor( self ):
|
||||
self.__completeIfNeeded( self.__actor )
|
||||
return self.__actor
|
||||
self._completeIfNeeded( self._actor )
|
||||
return self._actor
|
||||
|
||||
@property
|
||||
def commit_id( self ):
|
||||
self.__completeIfNeeded( self.__commit_id )
|
||||
return self.__commit_id
|
||||
self._completeIfNeeded( self._commit_id )
|
||||
return self._commit_id
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def event( self ):
|
||||
self.__completeIfNeeded( self.__event )
|
||||
return self.__event
|
||||
self._completeIfNeeded( self._event )
|
||||
return self._event
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def issue( self ):
|
||||
self.__completeIfNeeded( self.__issue )
|
||||
return self.__issue
|
||||
self._completeIfNeeded( self._issue )
|
||||
return self._issue
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__actor = None
|
||||
self.__commit_id = None
|
||||
self.__created_at = None
|
||||
self.__event = None
|
||||
self.__id = None
|
||||
self.__issue = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._actor = None
|
||||
self._commit_id = None
|
||||
self._created_at = None
|
||||
self._event = None
|
||||
self._id = None
|
||||
self._issue = None
|
||||
self._url = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "actor" in attributes and attributes[ "actor" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "actor" ], dict ), attributes[ "actor" ]
|
||||
self.__actor = NamedUser.NamedUser( self.__requester, attributes[ "actor" ], completed = False )
|
||||
self._actor = NamedUser.NamedUser( self._requester, attributes[ "actor" ], completed = False )
|
||||
if "commit_id" in attributes and attributes[ "commit_id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commit_id" ], ( str, unicode ) ), attributes[ "commit_id" ]
|
||||
self.__commit_id = attributes[ "commit_id" ]
|
||||
self._commit_id = attributes[ "commit_id" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "event" in attributes and attributes[ "event" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "event" ], ( str, unicode ) ), attributes[ "event" ]
|
||||
self.__event = attributes[ "event" ]
|
||||
self._event = attributes[ "event" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "issue" in attributes and attributes[ "issue" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "issue" ], dict ), attributes[ "issue" ]
|
||||
self.__issue = Issue.Issue( self.__requester, attributes[ "issue" ], completed = False )
|
||||
self._issue = Issue.Issue( self._requester, attributes[ "issue" ], completed = False )
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
@@ -1,40 +1,33 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class IssuePullRequest( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class IssuePullRequest( GithubObject.GithubObject ):
|
||||
@property
|
||||
def diff_url( self ):
|
||||
return self.__diff_url
|
||||
return self._diff_url
|
||||
|
||||
@property
|
||||
def html_url( self ):
|
||||
return self.__html_url
|
||||
return self._html_url
|
||||
|
||||
@property
|
||||
def patch_url( self ):
|
||||
return self.__patch_url
|
||||
return self._patch_url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__diff_url = None
|
||||
self.__html_url = None
|
||||
self.__patch_url = None
|
||||
def _initAttributes( self ):
|
||||
self._diff_url = None
|
||||
self._html_url = None
|
||||
self._patch_url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "diff_url" in attributes and attributes[ "diff_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "diff_url" ], ( str, unicode ) ), attributes[ "diff_url" ]
|
||||
self.__diff_url = attributes[ "diff_url" ]
|
||||
self._diff_url = attributes[ "diff_url" ]
|
||||
if "html_url" in attributes and attributes[ "html_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
|
||||
self.__html_url = attributes[ "html_url" ]
|
||||
self._html_url = attributes[ "html_url" ]
|
||||
if "patch_url" in attributes and attributes[ "patch_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "patch_url" ], ( str, unicode ) ), attributes[ "patch_url" ]
|
||||
self.__patch_url = attributes[ "patch_url" ]
|
||||
self._patch_url = attributes[ "patch_url" ]
|
||||
|
||||
+19
-27
@@ -2,37 +2,30 @@
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import urllib
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class Label( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
##########
|
||||
import GithubObject
|
||||
|
||||
class Label( GithubObject.GithubObject ):
|
||||
@property
|
||||
def color( self ):
|
||||
return self.__color
|
||||
return self._color
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
return self.__name
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, name, color ):
|
||||
assert isinstance( name, ( str, unicode ) ), name
|
||||
@@ -41,32 +34,31 @@ class Label( object ):
|
||||
"name": name,
|
||||
"color": color,
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
@property
|
||||
def _identity( self ):
|
||||
return urllib.quote( str( self.name ) )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__color = None
|
||||
self.__name = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._color = None
|
||||
self._name = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "color" in attributes and attributes[ "color" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "color" ], ( str, unicode ) ), attributes[ "color" ]
|
||||
self.__color = attributes[ "color" ]
|
||||
self._color = attributes[ "color" ]
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+46
-53
@@ -1,71 +1,66 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import NamedUser
|
||||
import Label
|
||||
|
||||
class Milestone( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class Milestone( GithubObject.GithubObject ):
|
||||
@property
|
||||
def closed_issues( self ):
|
||||
return self.__closed_issues
|
||||
return self._closed_issues
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
return self.__created_at
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def creator( self ):
|
||||
return self.__creator
|
||||
return self._creator
|
||||
|
||||
@property
|
||||
def description( self ):
|
||||
return self.__description
|
||||
return self._description
|
||||
|
||||
@property
|
||||
def due_on( self ):
|
||||
return self.__due_on
|
||||
return self._due_on
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
return self.__id
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def number( self ):
|
||||
return self.__number
|
||||
return self._number
|
||||
|
||||
@property
|
||||
def open_issues( self ):
|
||||
return self.__open_issues
|
||||
return self._open_issues
|
||||
|
||||
@property
|
||||
def state( self ):
|
||||
return self.__state
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def title( self ):
|
||||
return self.__title
|
||||
return self._title
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, title, state = DefaultValueForOptionalParameters, description = DefaultValueForOptionalParameters, due_on = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( title, ( str, unicode ) ), title
|
||||
@@ -84,76 +79,74 @@ class Milestone( object ):
|
||||
post_parameters[ "description" ] = description
|
||||
if due_on is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "due_on" ] = due_on
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_labels( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/labels",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Label.Label,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__closed_issues = None
|
||||
self.__created_at = None
|
||||
self.__creator = None
|
||||
self.__description = None
|
||||
self.__due_on = None
|
||||
self.__id = None
|
||||
self.__number = None
|
||||
self.__open_issues = None
|
||||
self.__state = None
|
||||
self.__title = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._closed_issues = None
|
||||
self._created_at = None
|
||||
self._creator = None
|
||||
self._description = None
|
||||
self._due_on = None
|
||||
self._id = None
|
||||
self._number = None
|
||||
self._open_issues = None
|
||||
self._state = None
|
||||
self._title = None
|
||||
self._url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "closed_issues" in attributes and attributes[ "closed_issues" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "closed_issues" ], int ), attributes[ "closed_issues" ]
|
||||
self.__closed_issues = attributes[ "closed_issues" ]
|
||||
self._closed_issues = attributes[ "closed_issues" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "creator" in attributes and attributes[ "creator" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "creator" ], dict ), attributes[ "creator" ]
|
||||
self.__creator = NamedUser.NamedUser( self.__requester, attributes[ "creator" ], completed = False )
|
||||
self._creator = NamedUser.NamedUser( self._requester, attributes[ "creator" ], completed = False )
|
||||
if "description" in attributes and attributes[ "description" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
|
||||
self.__description = attributes[ "description" ]
|
||||
self._description = attributes[ "description" ]
|
||||
if "due_on" in attributes and attributes[ "due_on" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "due_on" ], ( str, unicode ) ), attributes[ "due_on" ]
|
||||
self.__due_on = attributes[ "due_on" ]
|
||||
self._due_on = attributes[ "due_on" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "number" in attributes and attributes[ "number" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "number" ], int ), attributes[ "number" ]
|
||||
self.__number = attributes[ "number" ]
|
||||
self._number = attributes[ "number" ]
|
||||
if "open_issues" in attributes and attributes[ "open_issues" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "open_issues" ], int ), attributes[ "open_issues" ]
|
||||
self.__open_issues = attributes[ "open_issues" ]
|
||||
self._open_issues = attributes[ "open_issues" ]
|
||||
if "state" in attributes and attributes[ "state" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ]
|
||||
self.__state = attributes[ "state" ]
|
||||
self._state = attributes[ "state" ]
|
||||
if "title" in attributes and attributes[ "title" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
|
||||
self.__title = attributes[ "title" ]
|
||||
self._title = attributes[ "title" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+145
-176
@@ -1,9 +1,10 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import Gist
|
||||
import Repository
|
||||
import NamedUser
|
||||
@@ -11,142 +12,136 @@ import Plan
|
||||
import Organization
|
||||
import Event
|
||||
|
||||
class NamedUser( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class NamedUser( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def avatar_url( self ):
|
||||
self.__completeIfNeeded( self.__avatar_url )
|
||||
return self.__avatar_url
|
||||
self._completeIfNeeded( self._avatar_url )
|
||||
return self._avatar_url
|
||||
|
||||
@property
|
||||
def bio( self ):
|
||||
self.__completeIfNeeded( self.__bio )
|
||||
return self.__bio
|
||||
self._completeIfNeeded( self._bio )
|
||||
return self._bio
|
||||
|
||||
@property
|
||||
def blog( self ):
|
||||
self.__completeIfNeeded( self.__blog )
|
||||
return self.__blog
|
||||
self._completeIfNeeded( self._blog )
|
||||
return self._blog
|
||||
|
||||
@property
|
||||
def collaborators( self ):
|
||||
self.__completeIfNeeded( self.__collaborators )
|
||||
return self.__collaborators
|
||||
self._completeIfNeeded( self._collaborators )
|
||||
return self._collaborators
|
||||
|
||||
@property
|
||||
def company( self ):
|
||||
self.__completeIfNeeded( self.__company )
|
||||
return self.__company
|
||||
self._completeIfNeeded( self._company )
|
||||
return self._company
|
||||
|
||||
@property
|
||||
def contributions( self ):
|
||||
self.__completeIfNeeded( self.__contributions )
|
||||
return self.__contributions
|
||||
self._completeIfNeeded( self._contributions )
|
||||
return self._contributions
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def disk_usage( self ):
|
||||
self.__completeIfNeeded( self.__disk_usage )
|
||||
return self.__disk_usage
|
||||
self._completeIfNeeded( self._disk_usage )
|
||||
return self._disk_usage
|
||||
|
||||
@property
|
||||
def email( self ):
|
||||
self.__completeIfNeeded( self.__email )
|
||||
return self.__email
|
||||
self._completeIfNeeded( self._email )
|
||||
return self._email
|
||||
|
||||
@property
|
||||
def followers( self ):
|
||||
self.__completeIfNeeded( self.__followers )
|
||||
return self.__followers
|
||||
self._completeIfNeeded( self._followers )
|
||||
return self._followers
|
||||
|
||||
@property
|
||||
def following( self ):
|
||||
self.__completeIfNeeded( self.__following )
|
||||
return self.__following
|
||||
self._completeIfNeeded( self._following )
|
||||
return self._following
|
||||
|
||||
@property
|
||||
def gravatar_id( self ):
|
||||
self.__completeIfNeeded( self.__gravatar_id )
|
||||
return self.__gravatar_id
|
||||
self._completeIfNeeded( self._gravatar_id )
|
||||
return self._gravatar_id
|
||||
|
||||
@property
|
||||
def hireable( self ):
|
||||
self.__completeIfNeeded( self.__hireable )
|
||||
return self.__hireable
|
||||
self._completeIfNeeded( self._hireable )
|
||||
return self._hireable
|
||||
|
||||
@property
|
||||
def html_url( self ):
|
||||
self.__completeIfNeeded( self.__html_url )
|
||||
return self.__html_url
|
||||
self._completeIfNeeded( self._html_url )
|
||||
return self._html_url
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def location( self ):
|
||||
self.__completeIfNeeded( self.__location )
|
||||
return self.__location
|
||||
self._completeIfNeeded( self._location )
|
||||
return self._location
|
||||
|
||||
@property
|
||||
def login( self ):
|
||||
self.__completeIfNeeded( self.__login )
|
||||
return self.__login
|
||||
self._completeIfNeeded( self._login )
|
||||
return self._login
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
self.__completeIfNeeded( self.__name )
|
||||
return self.__name
|
||||
self._completeIfNeeded( self._name )
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def owned_private_repos( self ):
|
||||
self.__completeIfNeeded( self.__owned_private_repos )
|
||||
return self.__owned_private_repos
|
||||
self._completeIfNeeded( self._owned_private_repos )
|
||||
return self._owned_private_repos
|
||||
|
||||
@property
|
||||
def plan( self ):
|
||||
self.__completeIfNeeded( self.__plan )
|
||||
return self.__plan
|
||||
self._completeIfNeeded( self._plan )
|
||||
return self._plan
|
||||
|
||||
@property
|
||||
def private_gists( self ):
|
||||
self.__completeIfNeeded( self.__private_gists )
|
||||
return self.__private_gists
|
||||
self._completeIfNeeded( self._private_gists )
|
||||
return self._private_gists
|
||||
|
||||
@property
|
||||
def public_gists( self ):
|
||||
self.__completeIfNeeded( self.__public_gists )
|
||||
return self.__public_gists
|
||||
self._completeIfNeeded( self._public_gists )
|
||||
return self._public_gists
|
||||
|
||||
@property
|
||||
def public_repos( self ):
|
||||
self.__completeIfNeeded( self.__public_repos )
|
||||
return self.__public_repos
|
||||
self._completeIfNeeded( self._public_repos )
|
||||
return self._public_repos
|
||||
|
||||
@property
|
||||
def total_private_repos( self ):
|
||||
self.__completeIfNeeded( self.__total_private_repos )
|
||||
return self.__total_private_repos
|
||||
self._completeIfNeeded( self._total_private_repos )
|
||||
return self._total_private_repos
|
||||
|
||||
@property
|
||||
def type( self ):
|
||||
self.__completeIfNeeded( self.__type )
|
||||
return self.__type
|
||||
self._completeIfNeeded( self._type )
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
def create_gist( self, public, files, description = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( public, bool ), public
|
||||
@@ -158,155 +153,145 @@ class NamedUser( object ):
|
||||
}
|
||||
if description is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "description" ] = description
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/gists",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Gist.Gist( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Gist.Gist( self._requester, data, completed = True )
|
||||
|
||||
def get_events( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_followers( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/followers",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_following( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/following",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_gists( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/gists",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Gist.Gist,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_orgs( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/orgs",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Organization.Organization,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_public_events( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/events/public",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_public_received_events( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/received_events/public",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_received_events( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/received_events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_repo( self, name ):
|
||||
assert isinstance( name, ( str, unicode ) ), name
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/repos/" + str( self.login ) + "/" + str( name ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Repository.Repository( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Repository.Repository( self._requester, data, completed = True )
|
||||
|
||||
def get_repos( self, type = DefaultValueForOptionalParameters ):
|
||||
if type is not DefaultValueForOptionalParameters:
|
||||
@@ -314,33 +299,31 @@ class NamedUser( object ):
|
||||
url_parameters = dict()
|
||||
if type is not DefaultValueForOptionalParameters:
|
||||
url_parameters[ "type" ] = type
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/repos",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_watched( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/watched",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
@@ -349,124 +332,110 @@ class NamedUser( object ):
|
||||
def _identity( self ):
|
||||
return str( self.login )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__avatar_url = None
|
||||
self.__bio = None
|
||||
self.__blog = None
|
||||
self.__collaborators = None
|
||||
self.__company = None
|
||||
self.__contributions = None
|
||||
self.__created_at = None
|
||||
self.__disk_usage = None
|
||||
self.__email = None
|
||||
self.__followers = None
|
||||
self.__following = None
|
||||
self.__gravatar_id = None
|
||||
self.__hireable = None
|
||||
self.__html_url = None
|
||||
self.__id = None
|
||||
self.__location = None
|
||||
self.__login = None
|
||||
self.__name = None
|
||||
self.__owned_private_repos = None
|
||||
self.__plan = None
|
||||
self.__private_gists = None
|
||||
self.__public_gists = None
|
||||
self.__public_repos = None
|
||||
self.__total_private_repos = None
|
||||
self.__type = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._avatar_url = None
|
||||
self._bio = None
|
||||
self._blog = None
|
||||
self._collaborators = None
|
||||
self._company = None
|
||||
self._contributions = None
|
||||
self._created_at = None
|
||||
self._disk_usage = None
|
||||
self._email = None
|
||||
self._followers = None
|
||||
self._following = None
|
||||
self._gravatar_id = None
|
||||
self._hireable = None
|
||||
self._html_url = None
|
||||
self._id = None
|
||||
self._location = None
|
||||
self._login = None
|
||||
self._name = None
|
||||
self._owned_private_repos = None
|
||||
self._plan = None
|
||||
self._private_gists = None
|
||||
self._public_gists = None
|
||||
self._public_repos = None
|
||||
self._total_private_repos = None
|
||||
self._type = None
|
||||
self._url = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "avatar_url" in attributes and attributes[ "avatar_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ]
|
||||
self.__avatar_url = attributes[ "avatar_url" ]
|
||||
self._avatar_url = attributes[ "avatar_url" ]
|
||||
if "bio" in attributes and attributes[ "bio" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "bio" ], ( str, unicode ) ), attributes[ "bio" ]
|
||||
self.__bio = attributes[ "bio" ]
|
||||
self._bio = attributes[ "bio" ]
|
||||
if "blog" in attributes and attributes[ "blog" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ]
|
||||
self.__blog = attributes[ "blog" ]
|
||||
self._blog = attributes[ "blog" ]
|
||||
if "collaborators" in attributes and attributes[ "collaborators" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ]
|
||||
self.__collaborators = attributes[ "collaborators" ]
|
||||
self._collaborators = attributes[ "collaborators" ]
|
||||
if "company" in attributes and attributes[ "company" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ]
|
||||
self.__company = attributes[ "company" ]
|
||||
self._company = attributes[ "company" ]
|
||||
if "contributions" in attributes and attributes[ "contributions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "contributions" ], int ), attributes[ "contributions" ]
|
||||
self.__contributions = attributes[ "contributions" ]
|
||||
self._contributions = attributes[ "contributions" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "disk_usage" in attributes and attributes[ "disk_usage" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ]
|
||||
self.__disk_usage = attributes[ "disk_usage" ]
|
||||
self._disk_usage = attributes[ "disk_usage" ]
|
||||
if "email" in attributes and attributes[ "email" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ]
|
||||
self.__email = attributes[ "email" ]
|
||||
self._email = attributes[ "email" ]
|
||||
if "followers" in attributes and attributes[ "followers" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "followers" ], int ), attributes[ "followers" ]
|
||||
self.__followers = attributes[ "followers" ]
|
||||
self._followers = attributes[ "followers" ]
|
||||
if "following" in attributes and attributes[ "following" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "following" ], int ), attributes[ "following" ]
|
||||
self.__following = attributes[ "following" ]
|
||||
self._following = attributes[ "following" ]
|
||||
if "gravatar_id" in attributes and attributes[ "gravatar_id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ]
|
||||
self.__gravatar_id = attributes[ "gravatar_id" ]
|
||||
self._gravatar_id = attributes[ "gravatar_id" ]
|
||||
if "hireable" in attributes and attributes[ "hireable" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "hireable" ], bool ), attributes[ "hireable" ]
|
||||
self.__hireable = attributes[ "hireable" ]
|
||||
self._hireable = attributes[ "hireable" ]
|
||||
if "html_url" in attributes and attributes[ "html_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
|
||||
self.__html_url = attributes[ "html_url" ]
|
||||
self._html_url = attributes[ "html_url" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "location" in attributes and attributes[ "location" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ]
|
||||
self.__location = attributes[ "location" ]
|
||||
self._location = attributes[ "location" ]
|
||||
if "login" in attributes and attributes[ "login" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ]
|
||||
self.__login = attributes[ "login" ]
|
||||
self._login = attributes[ "login" ]
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "owned_private_repos" in attributes and attributes[ "owned_private_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ]
|
||||
self.__owned_private_repos = attributes[ "owned_private_repos" ]
|
||||
self._owned_private_repos = attributes[ "owned_private_repos" ]
|
||||
if "plan" in attributes and attributes[ "plan" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "plan" ], dict ), attributes[ "plan" ]
|
||||
self.__plan = Plan.Plan( self.__requester, attributes[ "plan" ], completed = False )
|
||||
self._plan = Plan.Plan( self._requester, attributes[ "plan" ], completed = False )
|
||||
if "private_gists" in attributes and attributes[ "private_gists" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ]
|
||||
self.__private_gists = attributes[ "private_gists" ]
|
||||
self._private_gists = attributes[ "private_gists" ]
|
||||
if "public_gists" in attributes and attributes[ "public_gists" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ]
|
||||
self.__public_gists = attributes[ "public_gists" ]
|
||||
self._public_gists = attributes[ "public_gists" ]
|
||||
if "public_repos" in attributes and attributes[ "public_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ]
|
||||
self.__public_repos = attributes[ "public_repos" ]
|
||||
self._public_repos = attributes[ "public_repos" ]
|
||||
if "total_private_repos" in attributes and attributes[ "total_private_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ]
|
||||
self.__total_private_repos = attributes[ "total_private_repos" ]
|
||||
self._total_private_repos = attributes[ "total_private_repos" ]
|
||||
if "type" in attributes and attributes[ "type" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
|
||||
self.__type = attributes[ "type" ]
|
||||
self._type = attributes[ "type" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+142
-175
@@ -1,167 +1,160 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import Team
|
||||
import Plan
|
||||
import Event
|
||||
import Repository
|
||||
import NamedUser
|
||||
|
||||
class Organization( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class Organization( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def avatar_url( self ):
|
||||
self.__completeIfNeeded( self.__avatar_url )
|
||||
return self.__avatar_url
|
||||
self._completeIfNeeded( self._avatar_url )
|
||||
return self._avatar_url
|
||||
|
||||
@property
|
||||
def billing_email( self ):
|
||||
self.__completeIfNeeded( self.__billing_email )
|
||||
return self.__billing_email
|
||||
self._completeIfNeeded( self._billing_email )
|
||||
return self._billing_email
|
||||
|
||||
@property
|
||||
def blog( self ):
|
||||
self.__completeIfNeeded( self.__blog )
|
||||
return self.__blog
|
||||
self._completeIfNeeded( self._blog )
|
||||
return self._blog
|
||||
|
||||
@property
|
||||
def collaborators( self ):
|
||||
self.__completeIfNeeded( self.__collaborators )
|
||||
return self.__collaborators
|
||||
self._completeIfNeeded( self._collaborators )
|
||||
return self._collaborators
|
||||
|
||||
@property
|
||||
def company( self ):
|
||||
self.__completeIfNeeded( self.__company )
|
||||
return self.__company
|
||||
self._completeIfNeeded( self._company )
|
||||
return self._company
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def disk_usage( self ):
|
||||
self.__completeIfNeeded( self.__disk_usage )
|
||||
return self.__disk_usage
|
||||
self._completeIfNeeded( self._disk_usage )
|
||||
return self._disk_usage
|
||||
|
||||
@property
|
||||
def email( self ):
|
||||
self.__completeIfNeeded( self.__email )
|
||||
return self.__email
|
||||
self._completeIfNeeded( self._email )
|
||||
return self._email
|
||||
|
||||
@property
|
||||
def followers( self ):
|
||||
self.__completeIfNeeded( self.__followers )
|
||||
return self.__followers
|
||||
self._completeIfNeeded( self._followers )
|
||||
return self._followers
|
||||
|
||||
@property
|
||||
def following( self ):
|
||||
self.__completeIfNeeded( self.__following )
|
||||
return self.__following
|
||||
self._completeIfNeeded( self._following )
|
||||
return self._following
|
||||
|
||||
@property
|
||||
def gravatar_id( self ):
|
||||
self.__completeIfNeeded( self.__gravatar_id )
|
||||
return self.__gravatar_id
|
||||
self._completeIfNeeded( self._gravatar_id )
|
||||
return self._gravatar_id
|
||||
|
||||
@property
|
||||
def html_url( self ):
|
||||
self.__completeIfNeeded( self.__html_url )
|
||||
return self.__html_url
|
||||
self._completeIfNeeded( self._html_url )
|
||||
return self._html_url
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def location( self ):
|
||||
self.__completeIfNeeded( self.__location )
|
||||
return self.__location
|
||||
self._completeIfNeeded( self._location )
|
||||
return self._location
|
||||
|
||||
@property
|
||||
def login( self ):
|
||||
self.__completeIfNeeded( self.__login )
|
||||
return self.__login
|
||||
self._completeIfNeeded( self._login )
|
||||
return self._login
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
self.__completeIfNeeded( self.__name )
|
||||
return self.__name
|
||||
self._completeIfNeeded( self._name )
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def owned_private_repos( self ):
|
||||
self.__completeIfNeeded( self.__owned_private_repos )
|
||||
return self.__owned_private_repos
|
||||
self._completeIfNeeded( self._owned_private_repos )
|
||||
return self._owned_private_repos
|
||||
|
||||
@property
|
||||
def plan( self ):
|
||||
self.__completeIfNeeded( self.__plan )
|
||||
return self.__plan
|
||||
self._completeIfNeeded( self._plan )
|
||||
return self._plan
|
||||
|
||||
@property
|
||||
def private_gists( self ):
|
||||
self.__completeIfNeeded( self.__private_gists )
|
||||
return self.__private_gists
|
||||
self._completeIfNeeded( self._private_gists )
|
||||
return self._private_gists
|
||||
|
||||
@property
|
||||
def public_gists( self ):
|
||||
self.__completeIfNeeded( self.__public_gists )
|
||||
return self.__public_gists
|
||||
self._completeIfNeeded( self._public_gists )
|
||||
return self._public_gists
|
||||
|
||||
@property
|
||||
def public_repos( self ):
|
||||
self.__completeIfNeeded( self.__public_repos )
|
||||
return self.__public_repos
|
||||
self._completeIfNeeded( self._public_repos )
|
||||
return self._public_repos
|
||||
|
||||
@property
|
||||
def total_private_repos( self ):
|
||||
self.__completeIfNeeded( self.__total_private_repos )
|
||||
return self.__total_private_repos
|
||||
self._completeIfNeeded( self._total_private_repos )
|
||||
return self._total_private_repos
|
||||
|
||||
@property
|
||||
def type( self ):
|
||||
self.__completeIfNeeded( self.__type )
|
||||
return self.__type
|
||||
self._completeIfNeeded( self._type )
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
def add_to_public_members( self, public_member ):
|
||||
assert isinstance( public_member, NamedUser.NamedUser ), public_member
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PUT",
|
||||
str( self.url ) + "/public_members/" + str( public_member._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def create_fork( self, repo ):
|
||||
assert isinstance( repo, Repository.Repository ), repo
|
||||
url_parameters = {
|
||||
"org": str( self.login ),
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
"https://api.github.com/repos/" + str( repo.owner.login ) + "/" + str( repo.name ) + "/forks",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Repository.Repository( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Repository.Repository( self._requester, data, completed = True )
|
||||
|
||||
def create_repo( self, name, description = DefaultValueForOptionalParameters, homepage = DefaultValueForOptionalParameters, private = DefaultValueForOptionalParameters, has_issues = DefaultValueForOptionalParameters, has_wiki = DefaultValueForOptionalParameters, has_downloads = DefaultValueForOptionalParameters, team_id = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( name, ( str, unicode ) ), name
|
||||
@@ -196,15 +189,14 @@ class Organization( object ):
|
||||
post_parameters[ "has_downloads" ] = has_downloads
|
||||
if team_id is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "team_id" ] = team_id
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/repos",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Repository.Repository( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Repository.Repository( self._requester, data, completed = True )
|
||||
|
||||
def create_team( self, name, repo_names = DefaultValueForOptionalParameters, permission = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( name, ( str, unicode ) ), name
|
||||
@@ -219,15 +211,14 @@ class Organization( object ):
|
||||
post_parameters[ "repo_names" ] = repo_names
|
||||
if permission is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "permission" ] = permission
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/teams",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Team.Team( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Team.Team( self._requester, data, completed = True )
|
||||
|
||||
def edit( self, billing_email = DefaultValueForOptionalParameters, blog = DefaultValueForOptionalParameters, company = DefaultValueForOptionalParameters, email = DefaultValueForOptionalParameters, location = DefaultValueForOptionalParameters, name = DefaultValueForOptionalParameters ):
|
||||
if billing_email is not DefaultValueForOptionalParameters:
|
||||
@@ -255,75 +246,70 @@ class Organization( object ):
|
||||
post_parameters[ "location" ] = location
|
||||
if name is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "name" ] = name
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_events( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/events",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Event.Event,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_members( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/members",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_public_members( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/public_members",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_repo( self, name ):
|
||||
assert isinstance( name, ( str, unicode ) ), name
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/repos/" + str( self.login ) + "/" + str( name ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Repository.Repository( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Repository.Repository( self._requester, data, completed = True )
|
||||
|
||||
def get_repos( self, type = DefaultValueForOptionalParameters ):
|
||||
if type is not DefaultValueForOptionalParameters:
|
||||
@@ -331,52 +317,49 @@ class Organization( object ):
|
||||
url_parameters = dict()
|
||||
if type is not DefaultValueForOptionalParameters:
|
||||
url_parameters[ "type" ] = type
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/repos",
|
||||
url_parameters,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_team( self, id ):
|
||||
assert isinstance( id, int ), id
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
"https://api.github.com/teams/" + str( id ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return Team.Team( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return Team.Team( self._requester, data, completed = True )
|
||||
|
||||
def get_teams( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/teams",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Team.Team,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def has_in_members( self, member ):
|
||||
assert isinstance( member, NamedUser.NamedUser ), member
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/members/" + str( member._identity ),
|
||||
None,
|
||||
@@ -386,7 +369,7 @@ class Organization( object ):
|
||||
|
||||
def has_in_public_members( self, public_member ):
|
||||
assert isinstance( public_member, NamedUser.NamedUser ), public_member
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/public_members/" + str( public_member._identity ),
|
||||
None,
|
||||
@@ -396,136 +379,120 @@ class Organization( object ):
|
||||
|
||||
def remove_from_members( self, member ):
|
||||
assert isinstance( member, NamedUser.NamedUser ), member
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ) + "/members/" + str( member._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def remove_from_public_members( self, public_member ):
|
||||
assert isinstance( public_member, NamedUser.NamedUser ), public_member
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ) + "/public_members/" + str( public_member._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__avatar_url = None
|
||||
self.__billing_email = None
|
||||
self.__blog = None
|
||||
self.__collaborators = None
|
||||
self.__company = None
|
||||
self.__created_at = None
|
||||
self.__disk_usage = None
|
||||
self.__email = None
|
||||
self.__followers = None
|
||||
self.__following = None
|
||||
self.__gravatar_id = None
|
||||
self.__html_url = None
|
||||
self.__id = None
|
||||
self.__location = None
|
||||
self.__login = None
|
||||
self.__name = None
|
||||
self.__owned_private_repos = None
|
||||
self.__plan = None
|
||||
self.__private_gists = None
|
||||
self.__public_gists = None
|
||||
self.__public_repos = None
|
||||
self.__total_private_repos = None
|
||||
self.__type = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._avatar_url = None
|
||||
self._billing_email = None
|
||||
self._blog = None
|
||||
self._collaborators = None
|
||||
self._company = None
|
||||
self._created_at = None
|
||||
self._disk_usage = None
|
||||
self._email = None
|
||||
self._followers = None
|
||||
self._following = None
|
||||
self._gravatar_id = None
|
||||
self._html_url = None
|
||||
self._id = None
|
||||
self._location = None
|
||||
self._login = None
|
||||
self._name = None
|
||||
self._owned_private_repos = None
|
||||
self._plan = None
|
||||
self._private_gists = None
|
||||
self._public_gists = None
|
||||
self._public_repos = None
|
||||
self._total_private_repos = None
|
||||
self._type = None
|
||||
self._url = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "avatar_url" in attributes and attributes[ "avatar_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ]
|
||||
self.__avatar_url = attributes[ "avatar_url" ]
|
||||
self._avatar_url = attributes[ "avatar_url" ]
|
||||
if "billing_email" in attributes and attributes[ "billing_email" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "billing_email" ], ( str, unicode ) ), attributes[ "billing_email" ]
|
||||
self.__billing_email = attributes[ "billing_email" ]
|
||||
self._billing_email = attributes[ "billing_email" ]
|
||||
if "blog" in attributes and attributes[ "blog" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ]
|
||||
self.__blog = attributes[ "blog" ]
|
||||
self._blog = attributes[ "blog" ]
|
||||
if "collaborators" in attributes and attributes[ "collaborators" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ]
|
||||
self.__collaborators = attributes[ "collaborators" ]
|
||||
self._collaborators = attributes[ "collaborators" ]
|
||||
if "company" in attributes and attributes[ "company" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ]
|
||||
self.__company = attributes[ "company" ]
|
||||
self._company = attributes[ "company" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "disk_usage" in attributes and attributes[ "disk_usage" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ]
|
||||
self.__disk_usage = attributes[ "disk_usage" ]
|
||||
self._disk_usage = attributes[ "disk_usage" ]
|
||||
if "email" in attributes and attributes[ "email" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ]
|
||||
self.__email = attributes[ "email" ]
|
||||
self._email = attributes[ "email" ]
|
||||
if "followers" in attributes and attributes[ "followers" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "followers" ], int ), attributes[ "followers" ]
|
||||
self.__followers = attributes[ "followers" ]
|
||||
self._followers = attributes[ "followers" ]
|
||||
if "following" in attributes and attributes[ "following" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "following" ], int ), attributes[ "following" ]
|
||||
self.__following = attributes[ "following" ]
|
||||
self._following = attributes[ "following" ]
|
||||
if "gravatar_id" in attributes and attributes[ "gravatar_id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ]
|
||||
self.__gravatar_id = attributes[ "gravatar_id" ]
|
||||
self._gravatar_id = attributes[ "gravatar_id" ]
|
||||
if "html_url" in attributes and attributes[ "html_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
|
||||
self.__html_url = attributes[ "html_url" ]
|
||||
self._html_url = attributes[ "html_url" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "location" in attributes and attributes[ "location" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ]
|
||||
self.__location = attributes[ "location" ]
|
||||
self._location = attributes[ "location" ]
|
||||
if "login" in attributes and attributes[ "login" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ]
|
||||
self.__login = attributes[ "login" ]
|
||||
self._login = attributes[ "login" ]
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "owned_private_repos" in attributes and attributes[ "owned_private_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ]
|
||||
self.__owned_private_repos = attributes[ "owned_private_repos" ]
|
||||
self._owned_private_repos = attributes[ "owned_private_repos" ]
|
||||
if "plan" in attributes and attributes[ "plan" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "plan" ], dict ), attributes[ "plan" ]
|
||||
self.__plan = Plan.Plan( self.__requester, attributes[ "plan" ], completed = False )
|
||||
self._plan = Plan.Plan( self._requester, attributes[ "plan" ], completed = False )
|
||||
if "private_gists" in attributes and attributes[ "private_gists" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ]
|
||||
self.__private_gists = attributes[ "private_gists" ]
|
||||
self._private_gists = attributes[ "private_gists" ]
|
||||
if "public_gists" in attributes and attributes[ "public_gists" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ]
|
||||
self.__public_gists = attributes[ "public_gists" ]
|
||||
self._public_gists = attributes[ "public_gists" ]
|
||||
if "public_repos" in attributes and attributes[ "public_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ]
|
||||
self.__public_repos = attributes[ "public_repos" ]
|
||||
self._public_repos = attributes[ "public_repos" ]
|
||||
if "total_private_repos" in attributes and attributes[ "total_private_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ]
|
||||
self.__total_private_repos = attributes[ "total_private_repos" ]
|
||||
self._total_private_repos = attributes[ "total_private_repos" ]
|
||||
if "type" in attributes and attributes[ "type" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ]
|
||||
self.__type = attributes[ "type" ]
|
||||
self._type = attributes[ "type" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+13
-20
@@ -1,40 +1,33 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class Permissions( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class Permissions( GithubObject.GithubObject ):
|
||||
@property
|
||||
def admin( self ):
|
||||
return self.__admin
|
||||
return self._admin
|
||||
|
||||
@property
|
||||
def pull( self ):
|
||||
return self.__pull
|
||||
return self._pull
|
||||
|
||||
@property
|
||||
def push( self ):
|
||||
return self.__push
|
||||
return self._push
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__admin = None
|
||||
self.__pull = None
|
||||
self.__push = None
|
||||
def _initAttributes( self ):
|
||||
self._admin = None
|
||||
self._pull = None
|
||||
self._push = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "admin" in attributes and attributes[ "admin" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "admin" ], bool ), attributes[ "admin" ]
|
||||
self.__admin = attributes[ "admin" ]
|
||||
self._admin = attributes[ "admin" ]
|
||||
if "pull" in attributes and attributes[ "pull" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "pull" ], bool ), attributes[ "pull" ]
|
||||
self.__pull = attributes[ "pull" ]
|
||||
self._pull = attributes[ "pull" ]
|
||||
if "push" in attributes and attributes[ "push" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "push" ], bool ), attributes[ "push" ]
|
||||
self.__push = attributes[ "push" ]
|
||||
self._push = attributes[ "push" ]
|
||||
|
||||
+16
-23
@@ -1,48 +1,41 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class Plan( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class Plan( GithubObject.GithubObject ):
|
||||
@property
|
||||
def collaborators( self ):
|
||||
return self.__collaborators
|
||||
return self._collaborators
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
return self.__name
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def private_repos( self ):
|
||||
return self.__private_repos
|
||||
return self._private_repos
|
||||
|
||||
@property
|
||||
def space( self ):
|
||||
return self.__space
|
||||
return self._space
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__collaborators = None
|
||||
self.__name = None
|
||||
self.__private_repos = None
|
||||
self.__space = None
|
||||
def _initAttributes( self ):
|
||||
self._collaborators = None
|
||||
self._name = None
|
||||
self._private_repos = None
|
||||
self._space = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "collaborators" in attributes and attributes[ "collaborators" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ]
|
||||
self.__collaborators = attributes[ "collaborators" ]
|
||||
self._collaborators = attributes[ "collaborators" ]
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "private_repos" in attributes and attributes[ "private_repos" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "private_repos" ], int ), attributes[ "private_repos" ]
|
||||
self.__private_repos = attributes[ "private_repos" ]
|
||||
self._private_repos = attributes[ "private_repos" ]
|
||||
if "space" in attributes and attributes[ "space" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "space" ], int ), attributes[ "space" ]
|
||||
self.__space = attributes[ "space" ]
|
||||
self._space = attributes[ "space" ]
|
||||
|
||||
+132
-158
@@ -1,151 +1,146 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import Commit
|
||||
import NamedUser
|
||||
import PullRequestMergeStatus
|
||||
import PullRequestComment
|
||||
import PullRequestFile
|
||||
|
||||
class PullRequest( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class PullRequest( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def additions( self ):
|
||||
self.__completeIfNeeded( self.__additions )
|
||||
return self.__additions
|
||||
self._completeIfNeeded( self._additions )
|
||||
return self._additions
|
||||
|
||||
@property
|
||||
def base( self ):
|
||||
self.__completeIfNeeded( self.__base )
|
||||
return self.__base
|
||||
self._completeIfNeeded( self._base )
|
||||
return self._base
|
||||
|
||||
@property
|
||||
def body( self ):
|
||||
self.__completeIfNeeded( self.__body )
|
||||
return self.__body
|
||||
self._completeIfNeeded( self._body )
|
||||
return self._body
|
||||
|
||||
@property
|
||||
def changed_files( self ):
|
||||
self.__completeIfNeeded( self.__changed_files )
|
||||
return self.__changed_files
|
||||
self._completeIfNeeded( self._changed_files )
|
||||
return self._changed_files
|
||||
|
||||
@property
|
||||
def closed_at( self ):
|
||||
self.__completeIfNeeded( self.__closed_at )
|
||||
return self.__closed_at
|
||||
self._completeIfNeeded( self._closed_at )
|
||||
return self._closed_at
|
||||
|
||||
@property
|
||||
def comments( self ):
|
||||
self.__completeIfNeeded( self.__comments )
|
||||
return self.__comments
|
||||
self._completeIfNeeded( self._comments )
|
||||
return self._comments
|
||||
|
||||
@property
|
||||
def commits( self ):
|
||||
self.__completeIfNeeded( self.__commits )
|
||||
return self.__commits
|
||||
self._completeIfNeeded( self._commits )
|
||||
return self._commits
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def deletions( self ):
|
||||
self.__completeIfNeeded( self.__deletions )
|
||||
return self.__deletions
|
||||
self._completeIfNeeded( self._deletions )
|
||||
return self._deletions
|
||||
|
||||
@property
|
||||
def diff_url( self ):
|
||||
self.__completeIfNeeded( self.__diff_url )
|
||||
return self.__diff_url
|
||||
self._completeIfNeeded( self._diff_url )
|
||||
return self._diff_url
|
||||
|
||||
@property
|
||||
def head( self ):
|
||||
self.__completeIfNeeded( self.__head )
|
||||
return self.__head
|
||||
self._completeIfNeeded( self._head )
|
||||
return self._head
|
||||
|
||||
@property
|
||||
def html_url( self ):
|
||||
self.__completeIfNeeded( self.__html_url )
|
||||
return self.__html_url
|
||||
self._completeIfNeeded( self._html_url )
|
||||
return self._html_url
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def issue_url( self ):
|
||||
self.__completeIfNeeded( self.__issue_url )
|
||||
return self.__issue_url
|
||||
self._completeIfNeeded( self._issue_url )
|
||||
return self._issue_url
|
||||
|
||||
@property
|
||||
def mergeable( self ):
|
||||
self.__completeIfNeeded( self.__mergeable )
|
||||
return self.__mergeable
|
||||
self._completeIfNeeded( self._mergeable )
|
||||
return self._mergeable
|
||||
|
||||
@property
|
||||
def merged( self ):
|
||||
self.__completeIfNeeded( self.__merged )
|
||||
return self.__merged
|
||||
self._completeIfNeeded( self._merged )
|
||||
return self._merged
|
||||
|
||||
@property
|
||||
def merged_at( self ):
|
||||
self.__completeIfNeeded( self.__merged_at )
|
||||
return self.__merged_at
|
||||
self._completeIfNeeded( self._merged_at )
|
||||
return self._merged_at
|
||||
|
||||
@property
|
||||
def merged_by( self ):
|
||||
self.__completeIfNeeded( self.__merged_by )
|
||||
return self.__merged_by
|
||||
self._completeIfNeeded( self._merged_by )
|
||||
return self._merged_by
|
||||
|
||||
@property
|
||||
def number( self ):
|
||||
self.__completeIfNeeded( self.__number )
|
||||
return self.__number
|
||||
self._completeIfNeeded( self._number )
|
||||
return self._number
|
||||
|
||||
@property
|
||||
def patch_url( self ):
|
||||
self.__completeIfNeeded( self.__patch_url )
|
||||
return self.__patch_url
|
||||
self._completeIfNeeded( self._patch_url )
|
||||
return self._patch_url
|
||||
|
||||
@property
|
||||
def review_comments( self ):
|
||||
self.__completeIfNeeded( self.__review_comments )
|
||||
return self.__review_comments
|
||||
self._completeIfNeeded( self._review_comments )
|
||||
return self._review_comments
|
||||
|
||||
@property
|
||||
def state( self ):
|
||||
self.__completeIfNeeded( self.__state )
|
||||
return self.__state
|
||||
self._completeIfNeeded( self._state )
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def title( self ):
|
||||
self.__completeIfNeeded( self.__title )
|
||||
return self.__title
|
||||
self._completeIfNeeded( self._title )
|
||||
return self._title
|
||||
|
||||
@property
|
||||
def updated_at( self ):
|
||||
self.__completeIfNeeded( self.__updated_at )
|
||||
return self.__updated_at
|
||||
self._completeIfNeeded( self._updated_at )
|
||||
return self._updated_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def user( self ):
|
||||
self.__completeIfNeeded( self.__user )
|
||||
return self.__user
|
||||
self._completeIfNeeded( self._user )
|
||||
return self._user
|
||||
|
||||
def create_comment( self, body, commit_id, path, position ):
|
||||
assert isinstance( body, ( str, unicode ) ), body
|
||||
@@ -158,15 +153,14 @@ class PullRequest( object ):
|
||||
"path": path,
|
||||
"position": position,
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"POST",
|
||||
str( self.url ) + "/comments",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return PullRequestComment.PullRequestComment( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return PullRequestComment.PullRequestComment( self._requester, data, completed = True )
|
||||
|
||||
def edit( self, title = DefaultValueForOptionalParameters, body = DefaultValueForOptionalParameters, state = DefaultValueForOptionalParameters ):
|
||||
if title is not DefaultValueForOptionalParameters:
|
||||
@@ -182,78 +176,73 @@ class PullRequest( object ):
|
||||
post_parameters[ "body" ] = body
|
||||
if state is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "state" ] = state
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_comment( self, id ):
|
||||
assert isinstance( id, int ), id
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
self.__requester.parentUrl( str( self.url ) ) + "/comments/" + str( id ),
|
||||
self._parentUrl( str( self.url ) ) + "/comments/" + str( id ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return PullRequestComment.PullRequestComment( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return PullRequestComment.PullRequestComment( self._requester, data, completed = True )
|
||||
|
||||
def get_comments( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/comments",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
PullRequestComment.PullRequestComment,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_commits( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/commits",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Commit.Commit,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_files( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/files",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
PullRequestFile.PullRequestFile,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def is_merged( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/merge",
|
||||
None,
|
||||
@@ -267,132 +256,117 @@ class PullRequest( object ):
|
||||
post_parameters = dict()
|
||||
if commit_message is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "commit_message" ] = commit_message
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PUT",
|
||||
str( self.url ) + "/merge",
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
return PullRequestMergeStatus.PullRequestMergeStatus( self.__requester, data, completed = True )
|
||||
self._checkStatus( status, data )
|
||||
return PullRequestMergeStatus.PullRequestMergeStatus( self._requester, data, completed = True )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__additions = None
|
||||
self.__base = None
|
||||
self.__body = None
|
||||
self.__changed_files = None
|
||||
self.__closed_at = None
|
||||
self.__comments = None
|
||||
self.__commits = None
|
||||
self.__created_at = None
|
||||
self.__deletions = None
|
||||
self.__diff_url = None
|
||||
self.__head = None
|
||||
self.__html_url = None
|
||||
self.__id = None
|
||||
self.__issue_url = None
|
||||
self.__mergeable = None
|
||||
self.__merged = None
|
||||
self.__merged_at = None
|
||||
self.__merged_by = None
|
||||
self.__number = None
|
||||
self.__patch_url = None
|
||||
self.__review_comments = None
|
||||
self.__state = None
|
||||
self.__title = None
|
||||
self.__updated_at = None
|
||||
self.__url = None
|
||||
self.__user = None
|
||||
def _initAttributes( self ):
|
||||
self._additions = None
|
||||
self._base = None
|
||||
self._body = None
|
||||
self._changed_files = None
|
||||
self._closed_at = None
|
||||
self._comments = None
|
||||
self._commits = None
|
||||
self._created_at = None
|
||||
self._deletions = None
|
||||
self._diff_url = None
|
||||
self._head = None
|
||||
self._html_url = None
|
||||
self._id = None
|
||||
self._issue_url = None
|
||||
self._mergeable = None
|
||||
self._merged = None
|
||||
self._merged_at = None
|
||||
self._merged_by = None
|
||||
self._number = None
|
||||
self._patch_url = None
|
||||
self._review_comments = None
|
||||
self._state = None
|
||||
self._title = None
|
||||
self._updated_at = None
|
||||
self._url = None
|
||||
self._user = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "additions" in attributes and attributes[ "additions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "additions" ], int ), attributes[ "additions" ]
|
||||
self.__additions = attributes[ "additions" ]
|
||||
self._additions = attributes[ "additions" ]
|
||||
if "base" in attributes and attributes[ "base" ] is not None: # pragma no branch
|
||||
self.__base = attributes[ "base" ]
|
||||
self._base = attributes[ "base" ]
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
|
||||
self.__body = attributes[ "body" ]
|
||||
self._body = attributes[ "body" ]
|
||||
if "changed_files" in attributes and attributes[ "changed_files" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "changed_files" ], int ), attributes[ "changed_files" ]
|
||||
self.__changed_files = attributes[ "changed_files" ]
|
||||
self._changed_files = attributes[ "changed_files" ]
|
||||
if "closed_at" in attributes and attributes[ "closed_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ]
|
||||
self.__closed_at = attributes[ "closed_at" ]
|
||||
self._closed_at = attributes[ "closed_at" ]
|
||||
if "comments" in attributes and attributes[ "comments" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "comments" ], int ), attributes[ "comments" ]
|
||||
self.__comments = attributes[ "comments" ]
|
||||
self._comments = attributes[ "comments" ]
|
||||
if "commits" in attributes and attributes[ "commits" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commits" ], int ), attributes[ "commits" ]
|
||||
self.__commits = attributes[ "commits" ]
|
||||
self._commits = attributes[ "commits" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "deletions" in attributes and attributes[ "deletions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ]
|
||||
self.__deletions = attributes[ "deletions" ]
|
||||
self._deletions = attributes[ "deletions" ]
|
||||
if "diff_url" in attributes and attributes[ "diff_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "diff_url" ], ( str, unicode ) ), attributes[ "diff_url" ]
|
||||
self.__diff_url = attributes[ "diff_url" ]
|
||||
self._diff_url = attributes[ "diff_url" ]
|
||||
if "head" in attributes and attributes[ "head" ] is not None: # pragma no branch
|
||||
self.__head = attributes[ "head" ]
|
||||
self._head = attributes[ "head" ]
|
||||
if "html_url" in attributes and attributes[ "html_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
|
||||
self.__html_url = attributes[ "html_url" ]
|
||||
self._html_url = attributes[ "html_url" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "issue_url" in attributes and attributes[ "issue_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "issue_url" ], ( str, unicode ) ), attributes[ "issue_url" ]
|
||||
self.__issue_url = attributes[ "issue_url" ]
|
||||
self._issue_url = attributes[ "issue_url" ]
|
||||
if "mergeable" in attributes and attributes[ "mergeable" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "mergeable" ], bool ), attributes[ "mergeable" ]
|
||||
self.__mergeable = attributes[ "mergeable" ]
|
||||
self._mergeable = attributes[ "mergeable" ]
|
||||
if "merged" in attributes and attributes[ "merged" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "merged" ], bool ), attributes[ "merged" ]
|
||||
self.__merged = attributes[ "merged" ]
|
||||
self._merged = attributes[ "merged" ]
|
||||
if "merged_at" in attributes and attributes[ "merged_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "merged_at" ], ( str, unicode ) ), attributes[ "merged_at" ]
|
||||
self.__merged_at = attributes[ "merged_at" ]
|
||||
self._merged_at = attributes[ "merged_at" ]
|
||||
if "merged_by" in attributes and attributes[ "merged_by" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "merged_by" ], dict ), attributes[ "merged_by" ]
|
||||
self.__merged_by = NamedUser.NamedUser( self.__requester, attributes[ "merged_by" ], completed = False )
|
||||
self._merged_by = NamedUser.NamedUser( self._requester, attributes[ "merged_by" ], completed = False )
|
||||
if "number" in attributes and attributes[ "number" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "number" ], int ), attributes[ "number" ]
|
||||
self.__number = attributes[ "number" ]
|
||||
self._number = attributes[ "number" ]
|
||||
if "patch_url" in attributes and attributes[ "patch_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "patch_url" ], ( str, unicode ) ), attributes[ "patch_url" ]
|
||||
self.__patch_url = attributes[ "patch_url" ]
|
||||
self._patch_url = attributes[ "patch_url" ]
|
||||
if "review_comments" in attributes and attributes[ "review_comments" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "review_comments" ], int ), attributes[ "review_comments" ]
|
||||
self.__review_comments = attributes[ "review_comments" ]
|
||||
self._review_comments = attributes[ "review_comments" ]
|
||||
if "state" in attributes and attributes[ "state" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ]
|
||||
self.__state = attributes[ "state" ]
|
||||
self._state = attributes[ "state" ]
|
||||
if "title" in attributes and attributes[ "title" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
|
||||
self.__title = attributes[ "title" ]
|
||||
self._title = attributes[ "title" ]
|
||||
if "updated_at" in attributes and attributes[ "updated_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
|
||||
self.__updated_at = attributes[ "updated_at" ]
|
||||
self._updated_at = attributes[ "updated_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "user" in attributes and attributes[ "user" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "user" ], dict ), attributes[ "user" ]
|
||||
self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completed = False )
|
||||
self._user = NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False )
|
||||
|
||||
@@ -1,156 +1,133 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import NamedUser
|
||||
|
||||
class PullRequestComment( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class PullRequestComment( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def body( self ):
|
||||
self.__completeIfNeeded( self.__body )
|
||||
return self.__body
|
||||
self._completeIfNeeded( self._body )
|
||||
return self._body
|
||||
|
||||
@property
|
||||
def commit_id( self ):
|
||||
self.__completeIfNeeded( self.__commit_id )
|
||||
return self.__commit_id
|
||||
self._completeIfNeeded( self._commit_id )
|
||||
return self._commit_id
|
||||
|
||||
@property
|
||||
def created_at( self ):
|
||||
self.__completeIfNeeded( self.__created_at )
|
||||
return self.__created_at
|
||||
self._completeIfNeeded( self._created_at )
|
||||
return self._created_at
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def original_commit_id( self ):
|
||||
self.__completeIfNeeded( self.__original_commit_id )
|
||||
return self.__original_commit_id
|
||||
self._completeIfNeeded( self._original_commit_id )
|
||||
return self._original_commit_id
|
||||
|
||||
@property
|
||||
def original_position( self ):
|
||||
self.__completeIfNeeded( self.__original_position )
|
||||
return self.__original_position
|
||||
self._completeIfNeeded( self._original_position )
|
||||
return self._original_position
|
||||
|
||||
@property
|
||||
def path( self ):
|
||||
self.__completeIfNeeded( self.__path )
|
||||
return self.__path
|
||||
self._completeIfNeeded( self._path )
|
||||
return self._path
|
||||
|
||||
@property
|
||||
def position( self ):
|
||||
self.__completeIfNeeded( self.__position )
|
||||
return self.__position
|
||||
self._completeIfNeeded( self._position )
|
||||
return self._position
|
||||
|
||||
@property
|
||||
def updated_at( self ):
|
||||
self.__completeIfNeeded( self.__updated_at )
|
||||
return self.__updated_at
|
||||
self._completeIfNeeded( self._updated_at )
|
||||
return self._updated_at
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def user( self ):
|
||||
self.__completeIfNeeded( self.__user )
|
||||
return self.__user
|
||||
self._completeIfNeeded( self._user )
|
||||
return self._user
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, body ):
|
||||
assert isinstance( body, ( str, unicode ) ), body
|
||||
post_parameters = {
|
||||
"body": body,
|
||||
}
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__body = None
|
||||
self.__commit_id = None
|
||||
self.__created_at = None
|
||||
self.__id = None
|
||||
self.__original_commit_id = None
|
||||
self.__original_position = None
|
||||
self.__path = None
|
||||
self.__position = None
|
||||
self.__updated_at = None
|
||||
self.__url = None
|
||||
self.__user = None
|
||||
def _initAttributes( self ):
|
||||
self._body = None
|
||||
self._commit_id = None
|
||||
self._created_at = None
|
||||
self._id = None
|
||||
self._original_commit_id = None
|
||||
self._original_position = None
|
||||
self._path = None
|
||||
self._position = None
|
||||
self._updated_at = None
|
||||
self._url = None
|
||||
self._user = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "body" in attributes and attributes[ "body" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ]
|
||||
self.__body = attributes[ "body" ]
|
||||
self._body = attributes[ "body" ]
|
||||
if "commit_id" in attributes and attributes[ "commit_id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commit_id" ], ( str, unicode ) ), attributes[ "commit_id" ]
|
||||
self.__commit_id = attributes[ "commit_id" ]
|
||||
self._commit_id = attributes[ "commit_id" ]
|
||||
if "created_at" in attributes and attributes[ "created_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
|
||||
self.__created_at = attributes[ "created_at" ]
|
||||
self._created_at = attributes[ "created_at" ]
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "original_commit_id" in attributes and attributes[ "original_commit_id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "original_commit_id" ], ( str, unicode ) ), attributes[ "original_commit_id" ]
|
||||
self.__original_commit_id = attributes[ "original_commit_id" ]
|
||||
self._original_commit_id = attributes[ "original_commit_id" ]
|
||||
if "original_position" in attributes and attributes[ "original_position" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "original_position" ], int ), attributes[ "original_position" ]
|
||||
self.__original_position = attributes[ "original_position" ]
|
||||
self._original_position = attributes[ "original_position" ]
|
||||
if "path" in attributes and attributes[ "path" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ]
|
||||
self.__path = attributes[ "path" ]
|
||||
self._path = attributes[ "path" ]
|
||||
if "position" in attributes and attributes[ "position" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "position" ], int ), attributes[ "position" ]
|
||||
self.__position = attributes[ "position" ]
|
||||
self._position = attributes[ "position" ]
|
||||
if "updated_at" in attributes and attributes[ "updated_at" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
|
||||
self.__updated_at = attributes[ "updated_at" ]
|
||||
self._updated_at = attributes[ "updated_at" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "user" in attributes and attributes[ "user" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "user" ], dict ), attributes[ "user" ]
|
||||
self.__user = NamedUser.NamedUser( self.__requester, attributes[ "user" ], completed = False )
|
||||
self._user = NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False )
|
||||
|
||||
@@ -1,88 +1,81 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class PullRequestFile( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class PullRequestFile( GithubObject.GithubObject ):
|
||||
@property
|
||||
def additions( self ):
|
||||
return self.__additions
|
||||
return self._additions
|
||||
|
||||
@property
|
||||
def blob_url( self ):
|
||||
return self.__blob_url
|
||||
return self._blob_url
|
||||
|
||||
@property
|
||||
def changes( self ):
|
||||
return self.__changes
|
||||
return self._changes
|
||||
|
||||
@property
|
||||
def deletions( self ):
|
||||
return self.__deletions
|
||||
return self._deletions
|
||||
|
||||
@property
|
||||
def filename( self ):
|
||||
return self.__filename
|
||||
return self._filename
|
||||
|
||||
@property
|
||||
def patch( self ):
|
||||
return self.__patch
|
||||
return self._patch
|
||||
|
||||
@property
|
||||
def raw_url( self ):
|
||||
return self.__raw_url
|
||||
return self._raw_url
|
||||
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
return self._sha
|
||||
|
||||
@property
|
||||
def status( self ):
|
||||
return self.__status
|
||||
return self._status
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__additions = None
|
||||
self.__blob_url = None
|
||||
self.__changes = None
|
||||
self.__deletions = None
|
||||
self.__filename = None
|
||||
self.__patch = None
|
||||
self.__raw_url = None
|
||||
self.__sha = None
|
||||
self.__status = None
|
||||
def _initAttributes( self ):
|
||||
self._additions = None
|
||||
self._blob_url = None
|
||||
self._changes = None
|
||||
self._deletions = None
|
||||
self._filename = None
|
||||
self._patch = None
|
||||
self._raw_url = None
|
||||
self._sha = None
|
||||
self._status = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "additions" in attributes and attributes[ "additions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "additions" ], int ), attributes[ "additions" ]
|
||||
self.__additions = attributes[ "additions" ]
|
||||
self._additions = attributes[ "additions" ]
|
||||
if "blob_url" in attributes and attributes[ "blob_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "blob_url" ], ( str, unicode ) ), attributes[ "blob_url" ]
|
||||
self.__blob_url = attributes[ "blob_url" ]
|
||||
self._blob_url = attributes[ "blob_url" ]
|
||||
if "changes" in attributes and attributes[ "changes" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "changes" ], int ), attributes[ "changes" ]
|
||||
self.__changes = attributes[ "changes" ]
|
||||
self._changes = attributes[ "changes" ]
|
||||
if "deletions" in attributes and attributes[ "deletions" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ]
|
||||
self.__deletions = attributes[ "deletions" ]
|
||||
self._deletions = attributes[ "deletions" ]
|
||||
if "filename" in attributes and attributes[ "filename" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "filename" ], ( str, unicode ) ), attributes[ "filename" ]
|
||||
self.__filename = attributes[ "filename" ]
|
||||
self._filename = attributes[ "filename" ]
|
||||
if "patch" in attributes and attributes[ "patch" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "patch" ], ( str, unicode ) ), attributes[ "patch" ]
|
||||
self.__patch = attributes[ "patch" ]
|
||||
self._patch = attributes[ "patch" ]
|
||||
if "raw_url" in attributes and attributes[ "raw_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "raw_url" ], ( str, unicode ) ), attributes[ "raw_url" ]
|
||||
self.__raw_url = attributes[ "raw_url" ]
|
||||
self._raw_url = attributes[ "raw_url" ]
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
if "status" in attributes and attributes[ "status" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "status" ], ( str, unicode ) ), attributes[ "status" ]
|
||||
self.__status = attributes[ "status" ]
|
||||
self._status = attributes[ "status" ]
|
||||
|
||||
@@ -1,40 +1,33 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class PullRequestMergeStatus( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
import GithubObject
|
||||
|
||||
class PullRequestMergeStatus( GithubObject.GithubObject ):
|
||||
@property
|
||||
def merged( self ):
|
||||
return self.__merged
|
||||
return self._merged
|
||||
|
||||
@property
|
||||
def message( self ):
|
||||
return self.__message
|
||||
return self._message
|
||||
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
return self._sha
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__merged = None
|
||||
self.__message = None
|
||||
self.__sha = None
|
||||
def _initAttributes( self ):
|
||||
self._merged = None
|
||||
self._message = None
|
||||
self._sha = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "merged" in attributes and attributes[ "merged" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "merged" ], bool ), attributes[ "merged" ]
|
||||
self.__merged = attributes[ "merged" ]
|
||||
self._merged = attributes[ "merged" ]
|
||||
if "message" in attributes and attributes[ "message" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ]
|
||||
self.__message = attributes[ "message" ]
|
||||
self._message = attributes[ "message" ]
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
self._sha = attributes[ "sha" ]
|
||||
|
||||
+280
-350
File diff suppressed because it is too large
Load Diff
+25
-50
@@ -1,16 +1,12 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
import GithubObject
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class RepositoryKey( object ):
|
||||
class RepositoryKey( GithubObject.GithubObject ):
|
||||
def __init__( self, requester, attributes, completed, repoUrl ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
GithubObject.GithubObject.__init__( self, requester, attributes, completed )
|
||||
self.__repoUrl = repoUrl
|
||||
|
||||
@property
|
||||
@@ -19,38 +15,32 @@ class RepositoryKey( object ):
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def key( self ):
|
||||
self.__completeIfNeeded( self.__key )
|
||||
return self.__key
|
||||
return self._key
|
||||
|
||||
@property
|
||||
def title( self ):
|
||||
self.__completeIfNeeded( self.__title )
|
||||
return self.__title
|
||||
return self._title
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def verified( self ):
|
||||
self.__completeIfNeeded( self.__verified )
|
||||
return self.__verified
|
||||
return self._verified
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
self.__customUrl,
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, title = DefaultValueForOptionalParameters, key = DefaultValueForOptionalParameters ):
|
||||
if title is not DefaultValueForOptionalParameters:
|
||||
@@ -62,50 +52,35 @@ class RepositoryKey( object ):
|
||||
post_parameters[ "title" ] = title
|
||||
if key is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "key" ] = key
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
self.__customUrl,
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__id = None
|
||||
self.__key = None
|
||||
self.__title = None
|
||||
self.__url = None
|
||||
self.__verified = None
|
||||
def _initAttributes( self ):
|
||||
self._id = None
|
||||
self._key = None
|
||||
self._title = None
|
||||
self._url = None
|
||||
self._verified = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "key" in attributes and attributes[ "key" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "key" ], ( str, unicode ) ), attributes[ "key" ]
|
||||
self.__key = attributes[ "key" ]
|
||||
self._key = attributes[ "key" ]
|
||||
if "title" in attributes and attributes[ "title" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
|
||||
self.__title = attributes[ "title" ]
|
||||
self._title = attributes[ "title" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "verified" in attributes and attributes[ "verified" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "verified" ], bool ), attributes[ "verified" ]
|
||||
self.__verified = attributes[ "verified" ]
|
||||
self._verified = attributes[ "verified" ]
|
||||
|
||||
@@ -55,9 +55,3 @@ class Requester:
|
||||
return None
|
||||
else:
|
||||
return json.loads( data )
|
||||
|
||||
def parentUrl( self, url ):
|
||||
return "/".join( url.split( "/" )[ : -1 ] )
|
||||
|
||||
def isFailureStatus( self, status ):
|
||||
return status >= 400
|
||||
|
||||
+17
-23
@@ -1,49 +1,43 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
import GithubObject
|
||||
##########
|
||||
import Commit
|
||||
|
||||
class Tag( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
class Tag( GithubObject.GithubObject ):
|
||||
@property
|
||||
def commit( self ):
|
||||
return self.__commit
|
||||
return self._commit
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
return self.__name
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def tarball_url( self ):
|
||||
return self.__tarball_url
|
||||
return self._tarball_url
|
||||
|
||||
@property
|
||||
def zipball_url( self ):
|
||||
return self.__zipball_url
|
||||
return self._zipball_url
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__commit = None
|
||||
self.__name = None
|
||||
self.__tarball_url = None
|
||||
self.__zipball_url = None
|
||||
def _initAttributes( self ):
|
||||
self._commit = None
|
||||
self._name = None
|
||||
self._tarball_url = None
|
||||
self._zipball_url = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "commit" in attributes and attributes[ "commit" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "commit" ], dict ), attributes[ "commit" ]
|
||||
self.__commit = Commit.Commit( self.__requester, attributes[ "commit" ], completed = False )
|
||||
self._commit = Commit.Commit( self._requester, attributes[ "commit" ], completed = False )
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "tarball_url" in attributes and attributes[ "tarball_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "tarball_url" ], ( str, unicode ) ), attributes[ "tarball_url" ]
|
||||
self.__tarball_url = attributes[ "tarball_url" ]
|
||||
self._tarball_url = attributes[ "tarball_url" ]
|
||||
if "zipball_url" in attributes and attributes[ "zipball_url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "zipball_url" ], ( str, unicode ) ), attributes[ "zipball_url" ]
|
||||
self.__zipball_url = attributes[ "zipball_url" ]
|
||||
self._zipball_url = attributes[ "zipball_url" ]
|
||||
|
||||
+50
-77
@@ -1,80 +1,72 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
##########
|
||||
import Repository
|
||||
import NamedUser
|
||||
|
||||
class Team( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class Team( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def members_count( self ):
|
||||
self.__completeIfNeeded( self.__members_count )
|
||||
return self.__members_count
|
||||
self._completeIfNeeded( self._members_count )
|
||||
return self._members_count
|
||||
|
||||
@property
|
||||
def name( self ):
|
||||
self.__completeIfNeeded( self.__name )
|
||||
return self.__name
|
||||
self._completeIfNeeded( self._name )
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def permission( self ):
|
||||
self.__completeIfNeeded( self.__permission )
|
||||
return self.__permission
|
||||
self._completeIfNeeded( self._permission )
|
||||
return self._permission
|
||||
|
||||
@property
|
||||
def repos_count( self ):
|
||||
self.__completeIfNeeded( self.__repos_count )
|
||||
return self.__repos_count
|
||||
self._completeIfNeeded( self._repos_count )
|
||||
return self._repos_count
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
def add_to_members( self, member ):
|
||||
assert isinstance( member, NamedUser.NamedUser ), member
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PUT",
|
||||
str( self.url ) + "/members/" + str( member._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def add_to_repos( self, repo ):
|
||||
assert isinstance( repo, Repository.Repository ), repo
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PUT",
|
||||
str( self.url ) + "/repos/" + str( repo._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, name, permission = DefaultValueForOptionalParameters ):
|
||||
assert isinstance( name, ( str, unicode ) ), name
|
||||
@@ -85,51 +77,48 @@ class Team( object ):
|
||||
}
|
||||
if permission is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "permission" ] = permission
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def get_members( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/members",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
NamedUser.NamedUser,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def get_repos( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/repos",
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
return PaginatedList.PaginatedList(
|
||||
Repository.Repository,
|
||||
self.__requester,
|
||||
self._requester,
|
||||
headers,
|
||||
data
|
||||
)
|
||||
|
||||
def has_in_members( self, member ):
|
||||
assert isinstance( member, NamedUser.NamedUser ), member
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/members/" + str( member._identity ),
|
||||
None,
|
||||
@@ -139,7 +128,7 @@ class Team( object ):
|
||||
|
||||
def has_in_repos( self, repo ):
|
||||
assert isinstance( repo, Repository.Repository ), repo
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"GET",
|
||||
str( self.url ) + "/repos/" + str( repo._identity ),
|
||||
None,
|
||||
@@ -149,64 +138,48 @@ class Team( object ):
|
||||
|
||||
def remove_from_members( self, member ):
|
||||
assert isinstance( member, NamedUser.NamedUser ), member
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ) + "/members/" + str( member._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def remove_from_repos( self, repo ):
|
||||
assert isinstance( repo, Repository.Repository ), repo
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ) + "/repos/" + str( repo._identity ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__id = None
|
||||
self.__members_count = None
|
||||
self.__name = None
|
||||
self.__permission = None
|
||||
self.__repos_count = None
|
||||
self.__url = None
|
||||
def _initAttributes( self ):
|
||||
self._id = None
|
||||
self._members_count = None
|
||||
self._name = None
|
||||
self._permission = None
|
||||
self._repos_count = None
|
||||
self._url = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "members_count" in attributes and attributes[ "members_count" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "members_count" ], int ), attributes[ "members_count" ]
|
||||
self.__members_count = attributes[ "members_count" ]
|
||||
self._members_count = attributes[ "members_count" ]
|
||||
if "name" in attributes and attributes[ "name" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ]
|
||||
self.__name = attributes[ "name" ]
|
||||
self._name = attributes[ "name" ]
|
||||
if "permission" in attributes and attributes[ "permission" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "permission" ], ( str, unicode ) ), attributes[ "permission" ]
|
||||
self.__permission = attributes[ "permission" ]
|
||||
self._permission = attributes[ "permission" ]
|
||||
if "repos_count" in attributes and attributes[ "repos_count" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "repos_count" ], int ), attributes[ "repos_count" ]
|
||||
self.__repos_count = attributes[ "repos_count" ]
|
||||
self._repos_count = attributes[ "repos_count" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
|
||||
+29
-52
@@ -1,51 +1,43 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
import GithubException
|
||||
import GithubObject
|
||||
from DefaultValueForOptionalParameters import DefaultValueForOptionalParameters
|
||||
|
||||
class UserKey( object ):
|
||||
def __init__( self, requester, attributes, completed ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
self.__completed = completed
|
||||
|
||||
class UserKey( GithubObject.CompletableGithubObject ):
|
||||
@property
|
||||
def id( self ):
|
||||
self.__completeIfNeeded( self.__id )
|
||||
return self.__id
|
||||
self._completeIfNeeded( self._id )
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def key( self ):
|
||||
self.__completeIfNeeded( self.__key )
|
||||
return self.__key
|
||||
self._completeIfNeeded( self._key )
|
||||
return self._key
|
||||
|
||||
@property
|
||||
def title( self ):
|
||||
self.__completeIfNeeded( self.__title )
|
||||
return self.__title
|
||||
self._completeIfNeeded( self._title )
|
||||
return self._title
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self.__completeIfNeeded( self.__url )
|
||||
return self.__url
|
||||
self._completeIfNeeded( self._url )
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def verified( self ):
|
||||
self.__completeIfNeeded( self.__verified )
|
||||
return self.__verified
|
||||
self._completeIfNeeded( self._verified )
|
||||
return self._verified
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
str( self.url ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, title = DefaultValueForOptionalParameters, key = DefaultValueForOptionalParameters ):
|
||||
if title is not DefaultValueForOptionalParameters:
|
||||
@@ -57,50 +49,35 @@ class UserKey( object ):
|
||||
post_parameters[ "title" ] = title
|
||||
if key is not DefaultValueForOptionalParameters:
|
||||
post_parameters[ "key" ] = key
|
||||
status, headers, data = self.__requester.request(
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
str( self.url ),
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
if self.__requester.isFailureStatus( status ): # pragma no branch
|
||||
raise GithubException.GithubException( status, data ) # pragma no cover
|
||||
self.__useAttributes( data )
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__id = None
|
||||
self.__key = None
|
||||
self.__title = None
|
||||
self.__url = None
|
||||
self.__verified = None
|
||||
def _initAttributes( self ):
|
||||
self._id = None
|
||||
self._key = None
|
||||
self._title = None
|
||||
self._url = None
|
||||
self._verified = None
|
||||
|
||||
def __completeIfNeeded( self, testedAttribute ):
|
||||
if not self.__completed and testedAttribute is None:
|
||||
self.__complete() # pragma: no cover
|
||||
|
||||
def __complete( self ): # pragma: no cover
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
self.__url,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self.__useAttributes( data )
|
||||
self.__completed = True
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
def _useAttributes( self, attributes ):
|
||||
if "id" in attributes and attributes[ "id" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self.__id = attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "key" in attributes and attributes[ "key" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "key" ], ( str, unicode ) ), attributes[ "key" ]
|
||||
self.__key = attributes[ "key" ]
|
||||
self._key = attributes[ "key" ]
|
||||
if "title" in attributes and attributes[ "title" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
|
||||
self.__title = attributes[ "title" ]
|
||||
self._title = attributes[ "title" ]
|
||||
if "url" in attributes and attributes[ "url" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self.__url = attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "verified" in attributes and attributes[ "verified" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "verified" ], bool ), attributes[ "verified" ]
|
||||
self.__verified = attributes[ "verified" ]
|
||||
self._verified = attributes[ "verified" ]
|
||||
|
||||
Reference in New Issue
Block a user