Merge branch 'develop' into topic/ExperimentOnDocumentation

Conflicts:
	github/Github.py
	github/GithubObject.py
This commit is contained in:
Vincent Jacques
2012-11-22 21:21:15 +01:00
452 changed files with 7889 additions and 7060 deletions
+23 -18
View File
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
@@ -15,54 +17,57 @@ import datetime
import GithubException
class _NotSetType:
def __repr__( self ):
return "NotSet"
NotSet = _NotSetType()
class BasicGithubObject( object ):
def __init__( self, requester, attributes ):
class BasicGithubObject(object):
def __init__(self, requester, attributes):
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