def _str_spaced_(self,space=None): baseSpace=' ' if space is None: space=baseSpace old_stdout = sys.stdout sys.stdout = mystdout = StringIO() sys.stdout.write("\n\n") #print space+"Args :\n\n" for propertyName, value in vars(solverParamClass).iteritems(): if( (propertyName.startswith('__') or propertyName.endswith('__')) ==False ): #check if it is a property if( repr(value).find('property')!=-1): attrValue=getattr(self, propertyName) sys.stdout.write( "%s* "%(space+space,) ) sys.stdout.write(str(propertyName)) #if(propertyName=='subInfParam'): if( is_sub_inf_param(classType=attrValue.__class__) or is_inf_param(classType=attrValue.__class__) ): sys.stdout.write(str("\n\n")) sys.stdout.write(str(attrValue._str_spaced_(space+baseSpace))) else: sys.stdout.write(" : default = ") sys.stdout.write(str(attrValue)) #sys.stdout.write("\n\n\n") #sys.stdout.write(space+' ') docStrAttr="\n\n"+str(solverParamClass.__dict__[propertyName].__doc__ ) sys.stdout.write(docStrAttr.replace("\n\n","\n\n%s"%(space+space+space,))) sys.stdout.write("\n\n") sys.stdout.write(" \n\n\n") sys.stdout = old_stdout return mystdout.getvalue()
def _attributeTypeDict(self): adict=dict() for propertyName, value in vars(self.__class__).iteritems(): if( (propertyName.startswith('__') or propertyName.endswith('__')) ==False ): #check if it is a property if( repr(value).find('property')!=-1): attrValue=getattr(self, propertyName) classOfAttr=attrValue.__class__ if is_sub_inf_param(classType=classOfAttr) : adict[propertyName]=(classOfAttr,True) else: adict[propertyName]=(classOfAttr,False) return adict
def _attributeTypeDict(self): adict = dict() for propertyName, value in vars(self.__class__).iteritems(): if ((propertyName.startswith('__') or propertyName.endswith('__')) == False): #check if it is a property if (repr(value).find('property') != -1): attrValue = getattr(self, propertyName) classOfAttr = attrValue.__class__ if is_sub_inf_param(classType=classOfAttr): adict[propertyName] = (classOfAttr, True) else: adict[propertyName] = (classOfAttr, False) return adict
def _str_spaced_(self, space=None): baseSpace = ' ' if space is None: space = baseSpace old_stdout = sys.stdout sys.stdout = mystdout = StringIO() sys.stdout.write("\n\n") #print space+"Args :\n\n" for propertyName, value in vars(solverParamClass).iteritems(): if ((propertyName.startswith('__') or propertyName.endswith('__')) == False): #check if it is a property if (repr(value).find('property') != -1): attrValue = getattr(self, propertyName) sys.stdout.write("%s* " % (space + space, )) sys.stdout.write(str(propertyName)) #if(propertyName=='subInfParam'): if (is_sub_inf_param(classType=attrValue.__class__) or is_inf_param(classType=attrValue.__class__)): sys.stdout.write(str("\n\n")) sys.stdout.write( str(attrValue._str_spaced_(space + baseSpace))) else: sys.stdout.write(" : default = ") sys.stdout.write(str(attrValue)) #sys.stdout.write("\n\n\n") #sys.stdout.write(space+' ') docStrAttr = "\n\n" + str( solverParamClass.__dict__[propertyName].__doc__ ) sys.stdout.write( docStrAttr.replace( "\n\n", "\n\n%s" % (space + space + space, ))) sys.stdout.write("\n\n") sys.stdout.write(" \n\n\n") sys.stdout = old_stdout return mystdout.getvalue()