Improve documentation generation

This commit is contained in:
Vincent Jacques
2012-02-26 12:44:06 +00:00
parent a437b6d47e
commit 0719ff429f
5 changed files with 22 additions and 18 deletions
+10 -3
View File
@@ -1,3 +1,5 @@
from ArgumentsChecker import *
class AttributeFromCallable:
class AttributeDefinition:
def __init__( self, name, callable ):
@@ -26,15 +28,20 @@ class AttributeFromCallable:
### @todo include the ArgumentsChecker
class MethodFromCallable:
def __init__( self, name, callable ):
def __init__( self, name, mandatoryParameters, optionalParameters, callable ):
self.__argumentsChecker = ArgumentsChecker( mandatoryParameters, optionalParameters )
self.__name = name
self.__callable = callable
def apply( self, cls ):
cls._addMethod( self.__name, self.__callable )
cls._addMethod( self.__name, self.__execute )
def __execute( self, obj, *args, **kwds ):
data = self.__argumentsChecker.check( args, kwds )
return self.__callable( obj, **data )
def autoDocument( self ):
return "* `" + self.__name + "( ... )`\n"
return "* `" + self.__name + "(" + self.__argumentsChecker.documentParameters() + ")`\n"
class InternalAttribute:
class AttributeDefinition: