protected boolean generatePythonConstructors ( String container , List < ? extends XtendMember > members , PyAppendable it , IExtraLanguageGeneratorContext context ) { // Prepare field initialization boolean hasConstructor = false ; for ( final XtendMember member : members ) { if ( context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; } if ( member instanceof SarlConstructor ) { hasConstructor = true ; generate ( member , it , context ) ; it . newLine ( ) ; } } if ( context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; } if ( ! hasConstructor ) { it . append ( "def __init__(self):" ) ; //$NON-NLS-1$ it . increaseIndentation ( ) . newLine ( ) ; final List < SarlField > fields = context . getMultimapValues ( INSTANCE_VARIABLES_MEMENTO , container ) ; if ( fields . isEmpty ( ) ) { it . append ( "pass" ) ; //$NON-NLS-1$ } else { for ( final SarlField field : fields ) { generatePythonField ( field , it , context ) ; } } it . decreaseIndentation ( ) . newLine ( ) ; } return true ; }
Generate the constructors for a Python class .