mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Improve documentation generation
This commit is contained in:
+10
-15
@@ -9,16 +9,16 @@ class BadGithubObjectException( Exception ):
|
||||
pass
|
||||
|
||||
def InternalSimpleAttribute( attributeName ):
|
||||
return InternalAttribute( attributeName, SimpleTypePolicy() )
|
||||
return InternalAttribute( attributeName, SimpleTypePolicy( None ) )
|
||||
|
||||
def InternalSimpleAttributes( *attributeNames ):
|
||||
return SeveralAttributePolicies( [ InternalSimpleAttribute( attributeName ) for attributeName in attributeNames ] )
|
||||
return SeveralAttributePolicies( [ InternalSimpleAttribute( attributeName ) for attributeName in attributeNames ], "Attributes" )
|
||||
|
||||
def InternalObjectAttribute( attributeName, type ):
|
||||
return InternalAttribute( attributeName, ObjectTypePolicy( type ) )
|
||||
|
||||
def ExternalSimpleAttribute( attributeName ):
|
||||
return ExternalAttribute( attributeName, SimpleTypePolicy() )
|
||||
def ExternalSimpleAttribute( attributeName, type ):
|
||||
return ExternalAttribute( attributeName, SimpleTypePolicy( type ) )
|
||||
|
||||
def BaseUrl( baseUrl ):
|
||||
return AttributeFromCallable( "_baseUrl", baseUrl )
|
||||
@@ -26,20 +26,16 @@ def BaseUrl( baseUrl ):
|
||||
def Identity( identity ):
|
||||
return AttributeFromCallable( "_identity", identity )
|
||||
|
||||
class Editable( MethodFromCallable ):
|
||||
def __init__( self, mandatoryParameters, optionalParameters ):
|
||||
MethodFromCallable.__init__( self, "edit", mandatoryParameters, optionalParameters, self.__execute )
|
||||
|
||||
def __execute( self, obj, **data ):
|
||||
def Editable( mandatoryParameters, optionalParameters ):
|
||||
def __execute( obj, **data ):
|
||||
attributes = obj._github._dataRequest( "PATCH", obj._baseUrl, None, data )
|
||||
obj._updateAttributes( attributes )
|
||||
return SeveralAttributePolicies( [ MethodFromCallable( "edit", mandatoryParameters, optionalParameters, __execute ) ], "Modification" )
|
||||
|
||||
class Deletable( MethodFromCallable ):
|
||||
def __init__( self ):
|
||||
MethodFromCallable.__init__( self, "delete", [], [], self.__execute )
|
||||
|
||||
def __execute( self, obj ):
|
||||
def Deletable():
|
||||
def __execute( obj ):
|
||||
obj._github._statusRequest( "DELETE", obj._baseUrl, None, None )
|
||||
return SeveralAttributePolicies( [ MethodFromCallable( "delete", [], [], __execute ) ], "Deletion" )
|
||||
|
||||
def GithubObject( className, *attributePolicies ):
|
||||
class GithubObject:
|
||||
@@ -107,7 +103,6 @@ def GithubObject( className, *attributePolicies ):
|
||||
def _autoDocument( cls ):
|
||||
doc = "Class `" + cls.__name__ + "`\n"
|
||||
doc += "=" * ( len( cls.__name__ ) + 8 ) + "\n"
|
||||
doc += "* Attributes: see [API]()\n"
|
||||
for attributePolicy in cls.__attributePolicies:
|
||||
doc += attributePolicy.autoDocument()
|
||||
doc += "\n"
|
||||
|
||||
Reference in New Issue
Block a user