mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 19:31:10 +00:00
Move generated code to 'github' instead of 'src/github'
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import GithubObject
|
||||
|
||||
class RepositoryKey( GithubObject.GithubObject ):
|
||||
def __init__( self, requester, attributes, completed, repoUrl ):
|
||||
GithubObject.GithubObject.__init__( self, requester, attributes, completed )
|
||||
self.__repoUrl = repoUrl
|
||||
|
||||
@property
|
||||
def __customUrl( self ):
|
||||
return self.__repoUrl + "/keys/" + str( self.id )
|
||||
|
||||
@property
|
||||
def id( self ):
|
||||
self._completeIfNotSet( self._id )
|
||||
return self._NoneIfNotSet( self._id )
|
||||
|
||||
@property
|
||||
def key( self ):
|
||||
self._completeIfNotSet( self._key )
|
||||
return self._NoneIfNotSet( self._key )
|
||||
|
||||
@property
|
||||
def title( self ):
|
||||
self._completeIfNotSet( self._title )
|
||||
return self._NoneIfNotSet( self._title )
|
||||
|
||||
@property
|
||||
def url( self ):
|
||||
self._completeIfNotSet( self._url )
|
||||
return self._NoneIfNotSet( self._url )
|
||||
|
||||
@property
|
||||
def verified( self ):
|
||||
self._completeIfNotSet( self._verified )
|
||||
return self._NoneIfNotSet( self._verified )
|
||||
|
||||
def delete( self ):
|
||||
status, headers, data = self._request(
|
||||
"DELETE",
|
||||
self.__customUrl,
|
||||
None,
|
||||
None
|
||||
)
|
||||
self._checkStatus( status, data )
|
||||
|
||||
def edit( self, title = GithubObject.NotSet, key = GithubObject.NotSet ):
|
||||
assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title
|
||||
assert key is GithubObject.NotSet or isinstance( key, ( str, unicode ) ), key
|
||||
post_parameters = dict()
|
||||
if title is not GithubObject.NotSet:
|
||||
post_parameters[ "title" ] = title
|
||||
if key is not GithubObject.NotSet:
|
||||
post_parameters[ "key" ] = key
|
||||
status, headers, data = self._request(
|
||||
"PATCH",
|
||||
self.__customUrl,
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
self._checkStatus( status, data )
|
||||
self._useAttributes( data )
|
||||
|
||||
def _initAttributes( self ):
|
||||
self._id = GithubObject.NotSet
|
||||
self._key = GithubObject.NotSet
|
||||
self._title = GithubObject.NotSet
|
||||
self._url = GithubObject.NotSet
|
||||
self._verified = GithubObject.NotSet
|
||||
|
||||
def _useAttributes( self, attributes ):
|
||||
if "id" in attributes: # pragma no branch
|
||||
assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
|
||||
self._id = attributes[ "id" ]
|
||||
if "key" in attributes: # pragma no branch
|
||||
assert attributes[ "key" ] is None or isinstance( attributes[ "key" ], ( str, unicode ) ), attributes[ "key" ]
|
||||
self._key = attributes[ "key" ]
|
||||
if "title" in attributes: # pragma no branch
|
||||
assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
|
||||
self._title = attributes[ "title" ]
|
||||
if "url" in attributes: # pragma no branch
|
||||
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
|
||||
self._url = attributes[ "url" ]
|
||||
if "verified" in attributes: # pragma no branch
|
||||
assert attributes[ "verified" ] is None or isinstance( attributes[ "verified" ], bool ), attributes[ "verified" ]
|
||||
self._verified = attributes[ "verified" ]
|
||||
Reference in New Issue
Block a user