mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 03:11:09 +00:00
Reorganize
This commit is contained in:
@@ -27,3 +27,37 @@ class MethodFromCallable:
|
||||
|
||||
def apply( self, cls ):
|
||||
cls._addMethod( self.__name, self.__callable )
|
||||
|
||||
class InternalAttribute:
|
||||
class AttributeDefinition:
|
||||
def __init__( self, typePolicy ):
|
||||
self.__typePolicy = typePolicy
|
||||
|
||||
def getValueFromRawValue( self, obj, rawValue ):
|
||||
if rawValue is None:
|
||||
return None
|
||||
else:
|
||||
return self.__typePolicy.create( obj, rawValue )
|
||||
|
||||
def updateAttributes( self, obj ):
|
||||
attributes = obj._github._dataRequest( "GET", obj._baseUrl, None, None )
|
||||
obj._updateAttributes( attributes )
|
||||
obj._markAsCompleted()
|
||||
|
||||
def isLazy( self ):
|
||||
return True
|
||||
|
||||
def __init__( self, attributeName, typePolicy ):
|
||||
self.__attributeName = attributeName
|
||||
self.__typePolicy = typePolicy
|
||||
|
||||
def apply( self, cls ):
|
||||
cls._addAttribute( self.__attributeName, InternalAttribute.AttributeDefinition( self.__typePolicy ) )
|
||||
|
||||
class SeveralAttributes:
|
||||
def __init__( self, attributePolicies ):
|
||||
self.__attributePolicies = attributePolicies
|
||||
|
||||
def apply( self, cls ):
|
||||
for attributePolicy in self.__attributePolicies:
|
||||
attributePolicy.apply( cls )
|
||||
|
||||
Reference in New Issue
Block a user