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
+21 -18
View File
@@ -15,53 +15,56 @@ import datetime
import GithubException
class _NotSetType:
pass
NotSet = _NotSetType()
class BasicGithubObject( object ):
def __init__( self, requester, attributes, completed ): ### 'completed' may be removed if I find a way
class BasicGithubObject(object):
def __init__(self, requester, attributes, completed): # 'completed' may be removed if I find a way
self._requester = requester
self._initAttributes()
self._useAttributes( attributes )
self._useAttributes(attributes)
@staticmethod
def _parentUrl( url ):
return "/".join( url.split( "/" )[ : -1 ] )
def _parentUrl(url):
return "/".join(url.split("/")[: -1])
@staticmethod
def _NoneIfNotSet( value ):
def _NoneIfNotSet(value):
if value is NotSet:
return None
else:
return value
@staticmethod
def _parseDatetime( s ):
def _parseDatetime(s):
if s is None:
return None
elif len( s ) == 24:
return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%S.000Z" )
elif len( s ) == 25:
return datetime.datetime.strptime( s[ : 19 ], "%Y-%m-%dT%H:%M:%S" ) + ( 1 if s[ 19 ] == '-' else -1 ) * datetime.timedelta( hours = int( s[ 20 : 22 ] ), minutes = int( s[ 23 : 25 ] ) )
elif len(s) == 24:
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z")
elif len(s) == 25:
return datetime.datetime.strptime(s[:19], "%Y-%m-%dT%H:%M:%S") + (1 if s[19] == '-' else -1) * datetime.timedelta(hours=int(s[20:22]), minutes=int(s[23:25]))
else:
return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%SZ" )
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ")
class GithubObject( BasicGithubObject ):
def __init__( self, requester, attributes, completed ):
BasicGithubObject.__init__( self, requester, attributes, completed )
class GithubObject(BasicGithubObject):
def __init__(self, requester, attributes, completed):
BasicGithubObject.__init__(self, requester, attributes, completed)
self.__completed = completed
def _completeIfNotSet( self, value ):
def _completeIfNotSet(self, value):
if not self.__completed and value is NotSet:
self.__complete()
def __complete( self ):
def __complete(self):
headers, data = self._requester.requestAndCheck(
"GET",
self._url,
None,
None
)
self._useAttributes( data )
self._useAttributes(data)
self._completed = True