Improve comformance to pep8 (+dos2unix)

PyGithub is now a public projects with several public contibutors,
I have to abandon my very personal coding conventions.
This commit is contained in:
Vincent Jacques
2012-09-17 20:37:22 +02:00
parent 7f61adcaf5
commit 531c3f2d32
107 changed files with 5245 additions and 5094 deletions
+47 -45
View File
@@ -13,40 +13,42 @@
import GithubObject
class RepositoryKey( GithubObject.GithubObject ):
def __init__( self, requester, attributes, completed, repoUrl ):
GithubObject.GithubObject.__init__( self, requester, attributes, completed )
class RepositoryKey(GithubObject.GithubObject):
def __init__(self, requester, attributes, completed, repoUrl):
GithubObject.GithubObject.__init__(self, requester, attributes, completed)
self.__repoUrl = repoUrl
@property
def __customUrl( self ):
return self.__repoUrl + "/keys/" + str( self.id )
@property
def id( self ):
self._completeIfNotSet( self._id )
return self._NoneIfNotSet( self._id )
def __customUrl(self):
return self.__repoUrl + "/keys/" + str(self.id)
@property
def key( self ):
self._completeIfNotSet( self._key )
return self._NoneIfNotSet( self._key )
def id(self):
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def title( self ):
self._completeIfNotSet( self._title )
return self._NoneIfNotSet( self._title )
def key(self):
self._completeIfNotSet(self._key)
return self._NoneIfNotSet(self._key)
@property
def url( self ):
self._completeIfNotSet( self._url )
return self._NoneIfNotSet( self._url )
def title(self):
self._completeIfNotSet(self._title)
return self._NoneIfNotSet(self._title)
@property
def verified( self ):
self._completeIfNotSet( self._verified )
return self._NoneIfNotSet( self._verified )
def url(self):
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def delete( self ):
@property
def verified(self):
self._completeIfNotSet(self._verified)
return self._NoneIfNotSet(self._verified)
def delete(self):
headers, data = self._requester.requestAndCheck(
"DELETE",
self.__customUrl,
@@ -54,42 +56,42 @@ class RepositoryKey( GithubObject.GithubObject ):
None
)
def edit( self, title = GithubObject.NotSet, key = GithubObject.NotSet ):
assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title
assert key is GithubObject.NotSet or isinstance( key, ( str, unicode ) ), key
def edit(self, title=GithubObject.NotSet, key=GithubObject.NotSet):
assert title is GithubObject.NotSet or isinstance(title, (str, unicode)), title
assert key is GithubObject.NotSet or isinstance(key, (str, unicode)), key
post_parameters = dict()
if title is not GithubObject.NotSet:
post_parameters[ "title" ] = title
post_parameters["title"] = title
if key is not GithubObject.NotSet:
post_parameters[ "key" ] = key
post_parameters["key"] = key
headers, data = self._requester.requestAndCheck(
"PATCH",
self.__customUrl,
None,
post_parameters
)
self._useAttributes( data )
self._useAttributes(data)
def _initAttributes( self ):
def _initAttributes(self):
self._id = GithubObject.NotSet
self._key = GithubObject.NotSet
self._title = GithubObject.NotSet
self._url = GithubObject.NotSet
self._verified = GithubObject.NotSet
def _useAttributes( self, attributes ):
if "id" in attributes: # pragma no branch
assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
self._id = attributes[ "id" ]
if "key" in attributes: # pragma no branch
assert attributes[ "key" ] is None or isinstance( attributes[ "key" ], ( str, unicode ) ), attributes[ "key" ]
self._key = attributes[ "key" ]
if "title" in attributes: # pragma no branch
assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ]
self._title = attributes[ "title" ]
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
if "verified" in attributes: # pragma no branch
assert attributes[ "verified" ] is None or isinstance( attributes[ "verified" ], bool ), attributes[ "verified" ]
self._verified = attributes[ "verified" ]
def _useAttributes(self, attributes):
if "id" in attributes: # pragma no branch
assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"]
self._id = attributes["id"]
if "key" in attributes: # pragma no branch
assert attributes["key"] is None or isinstance(attributes["key"], (str, unicode)), attributes["key"]
self._key = attributes["key"]
if "title" in attributes: # pragma no branch
assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"]
self._title = attributes["title"]
if "url" in attributes: # pragma no branch
assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"]
self._url = attributes["url"]
if "verified" in attributes: # pragma no branch
assert attributes["verified"] is None or isinstance(attributes["verified"], bool), attributes["verified"]
self._verified = attributes["verified"]