mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Refactor
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
class AttributeFromCallable:
|
||||
class AttributeDefinition:
|
||||
def __init__( self, name, callable ):
|
||||
self.__name = name
|
||||
self.__callable = callable
|
||||
|
||||
def getValueFromRawValue( self, obj, rawValue ):
|
||||
return rawValue
|
||||
|
||||
def updateAttributes( self, obj ):
|
||||
obj._updateAttributes( { self.__name: self.__callable( obj ) } )
|
||||
|
||||
def isLazy( self ):
|
||||
return False
|
||||
|
||||
def __init__( self, name, callable ):
|
||||
self.__name = name
|
||||
self.__callable = callable
|
||||
|
||||
def apply( self, cls ):
|
||||
cls._addAttribute( self.__name, AttributeFromCallable.AttributeDefinition( self.__name, self.__callable ) )
|
||||
|
||||
class MethodFromCallable:
|
||||
def __init__( self, name, callable ):
|
||||
self.__name = name
|
||||
self.__callable = callable
|
||||
|
||||
def apply( self, cls ):
|
||||
cls._addMethod( self.__name, self.__callable )
|
||||
Reference in New Issue
Block a user