def attest_insert(): #Insert the default output Distance=SYS.DistanceClass( ).update( [ ('IntsList',[4,5]), ('PowerFloat',0.5) ] ).insert('Result' ).update( [ ('IntsList',[4,5]), ('PowerFloat',1.) ] ).insert( ).update( [ ('IntsList',[4,5]), ('PowerFloat',2.) ] ).insert( ).update( [ ('IntsList',[1,2,3]), ('PowerFloat',0.5) ] ).insert( ).update( [ ('IntsList',[4,6]), ('PowerFloat',1.) ] ).insert( ).update( [ ('IntsList',[1,2,3]), ('PowerFloat',1.) ] ).insert( ).update( [ ('IntsList',[0,1]), ('PowerFloat',0.5) ] ).insert( ).hdfclose() #Return the object and the h5py return "\n\n\n\n"+SYS.represent( Distance )+'\n\n\n'+SYS.represent( os.popen('/usr/local/bin/h5ls -dlr '+Distance.HdformatingPathStr).read() )
def attest_scan(): #Scan Distance=SYS.DistanceClass( ).scan('Result' ).hdfclose() #Return the object and the h5py return "\n\n\n\n"+SYS.represent( Distance )+'\n\n\n'+SYS.represent( os.popen('/usr/local/bin/h5ls -dlr '+Distance.HdformatingPathStr).read() )
def attest_recover(): Distance=SYS.DistanceClass( ).update( [ ('/App_Model_ParameterizingDict/FindingTuplesList',[ ('IntsList',(SYS.getIsEqualBool,[4,5])), ('PowerFloat',(SYS.getIsEqualBool,1.)) ]), ('/App_Model_ResultingDict/update', [ ('MergingTuplesList', [ ('UnitsInt',(operator.eq,2)) ] ), ('FindingTuplesList',[ ('DistanceFloat',(operator.gt,30.)), #('__IntsList',(SYS.getIsEqualBool,[4,5])), ]) ] ) ] ).recover('Result' ).hdfclose() #Return the object and the h5py return "\n\n\n\n"+SYS.represent( Distance )
def attest_retrieve(): Distance=SYS.DistanceClass( ).__setitem__('/App_Model_ResultingDict/RetrievingIndexesList',(0,2) ).retrieve('Result' ).hdfclose() #Return the object and the h5py return "\n\n\n\n"+SYS.represent( Distance )
def attest_merge(): #Retrieve Distance=SYS.DistanceClass( ).merge('Result', [ ('UnitsInt',(operator.eq,2)), ] ).hdfclose() #Return the object and the h5py return "\n\n\n\n"+SYS.represent( Distance )
def attest_model(): #Build Hdf groups Modeler=SYS.ModelerClass().update( [ ('App_Model_ParameterizingDict', { 'ColumningTuplesList': [ ('MyInt',tables.Int64Col()), ('MyStr',tables.StrCol(10)), ('MyIntsList',tables.Int64Col(shape=3)) ] } ) ] ).model('Parameter') #Return the object itself return 'Attest gives : \n\n\n\n'+SYS.represent( Modeler )+'\n\n\n\n'+SYS.represent( Modeler.DatabasedModelClass.__dict__ )
def attest_retrieve(): #Retrieve Distance=SYS.DistanceClass( ).update( [ ('/App_Model_ResultingDict/MergingTuplesList', [ ('UnitsInt',(operator.eq,2)) ] ), ('/App_Model_ResultingDict/RetrievingIndexesListsList',[ ('DistanceFloat',(operator.gt,30.)), ('__IntsList',(SYS.getIsEqualBool,[4,5])), ('ParameterizedJoinedList',(SYS.getIsEqualBool,[0,1])) ]) ] ).retrieve('Result' ).hdfclose() #Return the object and the h5py return "\n\n\n\n"+SYS.represent( Distance )
def attest_join(): #Build Hdf groups Joiner=SYS.JoinerClass().hdformat().update( [ ( 'App_Structure_ChildJoiner1', SYS.JoinerClass().update( [ ('App_Model_ParameterizingDict', { 'ColumningTuplesList': [ ('MyIntsList',tables.Int64Col(shape=2)) ] } ), ('MyIntsList',[2,4]), ('App_Model_ResultingDict', { 'ColumningTuplesList': [ ('MyInt',tables.Int64Col()) ] } ), ('MyInt',1) ]) ), ('App_Model_ParameterizingDict', { 'ColumningTuplesList': [ ('MyStr',tables.StrCol(10)), ] } ), ('MyStr',"hello") ] ).walk( [ 'StructuredOrderedDict.items()' ], **{ 'BeforeUpdateList': [ ('parentize',{'ArgsVariable':"Structure"}), ('group',{'ArgsVariable':""}), ('model',{'ArgsVariable':"Parameter"}), ('table',{'ArgsVariable':""}), ('row',{'ArgsVariable':""}), ('insert',{'ArgsVariable':""}) ] } ).update( [ ('App_Model_ResultingDict', { 'ColumningTuplesList': [ ('MyFloat',tables.Float32Col()), ('MyFloatsList',tables.Float32Col(shape=3)) ], 'JoiningTuple':("Structure","Parameter") } ), ('MyFloat',0.1), ('MyFloatsList',[2.3,4.5,1.1]) ] ).model("Result" ).table( ).row( ).insert("Result" ).hdfclose() #Return the object itself return "Objects is : \n"+SYS.represent( Joiner )+'\n\n\n'+SYS.represent(os.popen('/usr/local/bin/h5ls -dlr '+Joiner.HdformatingPathStr ).read())
def findBefore(self,**_FindingVariablesDict): #debug self.debug('Find the joined model') #Alias JoinedModelStr=self.ModeledDict['JoinedModelStr'] #Check that JoinedModelStr is good if JoinedModelStr!="": #Copy the ModeledDict CopiedModeledDict=copy.copy(self.ModeledDict) #debug self.debug( [ 'First we are going to find in the joined model', 'JoinedModelStr is '+str(JoinedModelStr) ] ) #Find self.ModeledDict=self.ModeledDict['JoinedModeledDict'] self.find() JoinedModeledDict=self.ModeledDict self.ModeledDict=CopiedModeledDict #debug self.debug( [ 'Find in the joined model is done', 'JoinedModelStr is '+str(JoinedModelStr) ] ) #debug self.debug('Ok we have found the joined model') #Copy the FoundFilteredRowedDictsList JoinedFoundFilteredRowedDictsList=JoinedModeledDict['FoundFilteredRowedDictsList'] #debug self.debug( [ 'JoinedFoundFilteredRowedDictsList is ', SYS.represent(JoinedFoundFilteredRowedDictsList) ] ) #Alias JoinedRetrievingIndexesListKeyStr=self.ModeledDict['JoinedRetrievingIndexesListKeyStr'] #Make the TabledInt and the RowInt as a <JoinedModelStr>RetrievingIndexesList map( lambda __JoinedFoundFilteredRowedDict: __JoinedFoundFilteredRowedDict.__setitem__( JoinedRetrievingIndexesListKeyStr, [ __JoinedFoundFilteredRowedDict['TabledInt'], __JoinedFoundFilteredRowedDict['RowInt'], ] ), JoinedFoundFilteredRowedDictsList ) #set the JoinedFindingTuplesList JoinedFindingTuplesList=[ ( JoinedRetrievingIndexesListKeyStr, ( SYS.getIsInListBool, map( lambda __JoinedFoundFilteredRowedDict: [ __JoinedFoundFilteredRowedDict['TabledInt'], __JoinedFoundFilteredRowedDict['RowInt'], ], JoinedFoundFilteredRowedDictsList ) ) ) ] #debug self.debug( [ 'JoinedFindingTuplesList is', SYS.represent(JoinedFindingTuplesList) ] ) else: #set an default empty JoinedFindingTuplesList=[] #debug self.debug( [ 'Joiner findbefore is over', ('self.ModeledDict',self.ModeledDict,['ModelStr','FoundRowDictsList']) ] ) #Put them in the ModeledDict LocalVars=vars() map( lambda __GettingStr: self.ModeledDict.__setitem__(__GettingStr,LocalVars[__GettingStr]), [ 'JoinedFindingTuplesList', ] ) #debug self.debug('End of the method')
def rowAfter(self,**_RowingVariablesList): #debug self.debug('Start of the method') #debug self.debug('Look if we have to make row first the noded children') #IsNodingInsertingBool if 'IsNodingRowingBool' not in _InsertingVariablesList or _InsertingVariablesList['IsNodingInsertingBool']: #debug self.debug( [ 'We are going to make row all the joined noded children', 'ModelStr is '+str(ModelStr) ] ) #Row each noded children map( lambda __Variable: __Variable.row(ModelStr), self.ModeledDict['JoinedNodifiedOrderedDict'].values() ) #debug self.debug( [ 'The noded children have inserted' ] ) #debug self.debug( [ "self.ModeledDict['ModelStr'] is "+str(self.ModeledDict['ModelStr']) "We are going to check if the joined model is already inserted...", "First look if JoinedModeledDict!={} is "+str(len(JoinedModeledDict)>0) ] ) #Alias JoinedModeledDict=self.ModeledDict['JoinedModeledDict'] #Check if len(JoinedModeledDict)>0: #debug self.debug("Ok there is some not empty JoinedModeledDict here") #set JoinedRetrievingIndexesListKeyStr JoinedRetrievingIndexesListKeyStr=self.ModeledDict['JoinedRetrievingIndexesListKeyStr'] #Definition the GettingStrsList and the GettedVariablesList if 'ColumningTuplesList' in JoinedModeledDict: #debug self.debug('Check that this joined row is a new row in the table or not') #Get the GettingStrsList and GettedVariablesList GettingStrsList=SYS.unzip(JoinedModeledDict['ColumningTuplesList'],[0]) GettedVariablesList=self.pick(GettingStrsList) #Check if it was already rowed IsRowedBoolsList=map( lambda __Row: all( map( lambda __GettingStr,__GettedVariable: SYS.getIsEqualBool(__Row[__GettingStr],__GettedVariable), GettingStrsList, GettedVariablesList ) ), JoinedModeledDict['TabledTable'].iterrows() ) #debug self.debug( [ 'self.StructuredKeyStr is '+str( self.StructuredKeyStr) if hasattr(self,'StructuredKeyStr') else "", 'IsRowedBoolsList is '+str(IsRowedBoolsList) ] ) #If it is rowed then set the JoinedRetrievingIndexesList try: RowInt=IsRowedBoolsList.index(True) except ValueError: RowInt=-1 #debug self.debug('So the corresponding RowInt is '+str(RowInt)) #set the RowInt self.ModeledDict['JoinedOrderedDict'][JoinedRetrievingIndexesListKeyStr][1]=RowInt #Alias JoinedOrderedDict=self.ModeledDict['JoinedOrderedDict'] JoinedRetrievingIndexesList=self.ModeledDict['JoinedOrderedDict'][JoinedRetrievingIndexesListKeyStr] JoinedNodifiedNodeStr=self.ModeledDict['JoinedNodifiedNodeStr'] JoinedNodifiedNodedStr=self.ModeledDict['JoinedNodifiedNodedStr'] #Give the JoinedRetrievingIndexesList to itself JoinedOrderedDict.__setitem__( JoinedRetrievingIndexesListKeyStr, JoinedRetrievingIndexesList ) #debug self.debug( [ 'JoinedOrderedDict is now', SYS.represent(JoinedOrderedDict) ] ) #Give to the parent if JoinedNodifiedNodeStr!="": ParentPointer=getattr( self, JoinedNodifiedNodedStr+'ParentPointer' ) if ParentPointer!=None: ParentPointer['App_Model_'+ModelingStr+'Dict']['JoinedOrderedDict'][ getattr( self, JoinedNodifiedNodedStr+'KeyStr' )+JoinedRetrievingIndexesListKeyStr ]=JoinedRetrievingIndexesList #Update the self.RowedIdentifiedOrderedDic self.ModeledDict['RowedIdentifiedOrderedDict'].update(JoinedOrderedDict) #debug self.debug('End of the method')
def attest_recover(): #Bound an output method def outputAfter(_Recoverer): _Recoverer.MulInt=_Retriever.FirstInt*_Retriever.SecondInt SYS.RecovererClass.HookingMethodStrToMethodsListDict['outputAfter']=[outputAfter] #Retrieve Recoverer=SYS.RecovererClass( ).update( [ ('FirstInt',0), ('SecondInt',0), ('App_Model_ParameterizingDict',{ 'ColumningTuplesList': [ #ColumnStr #Col ('FirstInt', tables.Int64Col()), ('SecondInt', tables.Int64Col()) ], 'IsFeaturingBool':True, }), ('App_Model_ResultingDict',{ 'ColumningTuplesList': [ #ColumnStr #Col ('MulInt', tables.Int64Col()) ], 'JoiningTuple':("","Parameter") }) ] ).update( [ ('FirstInt',1), ('SecondInt',2) ] ).insert('Result' ).update( [ ('FirstInt',1), ('SecondInt',3) ] ).insert( ).update( [ ('FirstInt',2), ('SecondInt',2) ] ).insert( ).update( [ ('FirstInt',2), ('SecondInt',3) ] ).insert( ).update( [ ('FirstInt',3), ('SecondInt',3) ] ).insert( ).recover( 'Result' ).hdfclose() #Return the object and the h5py return "\n\n\n\n"+SYS.represent( Retriever )+'\n\n\n'+SYS.represent( os.popen('h5ls -dlr '+Retriever.HdformatingPathStr).read() )
def rowAfter(self,**_RowingVariablesList): #debug self.debug('Start of the method') #debug DebuggingStr="self.ModeledDict['ModelStr'] is "+str(self.ModeledDict['ModelStr']) DebuggingStr+='\nWe are going to check if this model is already inserted...' self.debug(DebuggingStr) #Alias JoinedModeledDict=self.ModeledDict['JoinedModeledDict'] #Check if JoinedModeledDict!={}: #set JoinedRetrievingIndexesListKeyStr JoinedRetrievingIndexesListKeyStr=self.ModeledDict['JoinedRetrievingIndexesListKeyStr'] #Definition the GettingStrsList and the GettedVariablesList if 'ColumningTuplesList' in JoinedModeledDict: #debug self.debug('Check that this row is a new row in the table or not') #Get the GettingStrsList and GettedVariablesList GettingStrsList=SYS.unzip(JoinedModeledDict['ColumningTuplesList'],[0]) GettedVariablesList=self.pick(GettingStrsList) #Check if it was already rowed IsRowedBoolsList=map( lambda __Row: all( map( lambda __GettingStr,__GettedVariable: SYS.getIsEqualBool(__Row[__GettingStr],__GettedVariable), GettingStrsList, GettedVariablesList ) ), JoinedModeledDict['TabularedTable'].iterrows() ) #debug if hasattr(self,'StructuredKeyStr'): self.debug('self.StructuredKeyStr is '+str(self.StructuredKeyStr)) self.debug('IsRowedBoolsList is '+str(IsRowedBoolsList)) #If it is rowed then set the JoinedRetrievingIndexesList try: RowInt=IsRowedBoolsList.index(True) except ValueError: RowInt=-1 #debug self.debug('So the corresponding RowInt is '+str(RowInt)) #set the RowInt self.ModeledDict['JoinedOrderedDict'][JoinedRetrievingIndexesListKeyStr][1]=RowInt #Alias JoinedOrderedDict=self.ModeledDict['JoinedOrderedDict'] JoinedRetrievingIndexesList=self.ModeledDict['JoinedOrderedDict'][JoinedRetrievingIndexesListKeyStr] JoinedNodifiedNodeStr=self.ModeledDict['JoinedNodifiedNodeStr'] #Give the JoinedRetrievingIndexesList to itself JoinedOrderedDict.__setitem__( JoinedRetrievingIndexesListKeyStr, JoinedRetrievingIndexesList ) #debug self.debug( [ 'JoinedOrderedDict is now', SYS.represent(JoinedOrderedDict) ] ) #Give to the parent if JoinedNodifiedNodeStr!="": ParentPointer=getattr( self, JoinedNodifiedNodedStr+'ParentPointer' ) if ParentPointer!=None: ParentPointer['App_Model_'+ModelingStr+'Dict']['JoinedOrderedDict'][ getattr( self, JoinedNodifiedNodedStr+'KeyStr' )+JoinedRetrievingIndexesListKeyStr ]=JoinedRetrievingIndexesList #Update the self.RowedIdentifiedOrderedDic self.ModeledDict['RowedIdentifiedOrderedDict'].update(JoinedOrderedDict) #debug self.debug('End of the method')
def find(self,**_KwargVariablesDict): #Check that JoiningDatabaseKeyStr is good if JoiningDatabaseKeyStr!="": #Find self.JoinedDeriveDatabaserPointer.find() #debug self.debug('Ok we have found the joined model') #Copy the FoundFilteredRowedDictsList JoinedFoundFilteredRowedDictsList=self.JoinedDeriveDatabaserPointer['FoundFilteredRowedDictsList'] #debug self.debug( [ 'JoinedFoundFilteredRowedDictsList is ', SYS.represent(JoinedFoundFilteredRowedDictsList) ] ) #Alias JoinedRetrievingIndexesListKeyStr=self.ModeledDict['JoinedRetrievingIndexesListKeyStr'] #Make the TabledInt and the RowInt as a <JoiningDatabaseKeyStr>RetrievingIndexesList map( lambda __JoinedFoundFilteredRowedDict: __JoinedFoundFilteredRowedDict.__setitem__( JoinedRetrievingIndexesListKeyStr, [ __JoinedFoundFilteredRowedDict['TabledInt'], __JoinedFoundFilteredRowedDict['RowInt'], ] ), JoinedFoundFilteredRowedDictsList ) #set the JoinedFindingTuplesList JoinedFindingTuplesList=[ ( JoinedRetrievingIndexesListKeyStr, ( SYS.getIsInListBool, map( lambda __JoinedFoundFilteredRowedDict: [ __JoinedFoundFilteredRowedDict['TabledInt'], __JoinedFoundFilteredRowedDict['RowInt'], ], JoinedFoundFilteredRowedDictsList ) ) ) ] #debug self.debug( [ 'JoinedFindingTuplesList is', SYS.represent(JoinedFindingTuplesList) ] ) else: #set a default empty JoinedFindingTuplesList=[] #debug self.debug( [ ('self.ModeledDict',self.ModeledDict,['ModelStr','FoundRowDictsList']) ] ) #Put them in the ModeledDict LocalVars=vars() map( lambda __GettingStr: self.ModeledDict.__setitem__(__GettingStr,LocalVars[__GettingStr]), [ 'JoinedFindingTuplesList', ] )