def do_recruit(self): #Check if type(self.VisitingBeforeUpdateList)!=list: self.VisitingBeforeUpdateList=[] #add self.VisitingBeforeUpdateList+=[ ( 'PickingKeyVariablesList',['/'] ), ( 'ConcludingConditionVariable', self.RecruitingConcludeConditionVariable ), ( 'cumulate', SYS.ApplyDictClass() ) ] #visit self.visit() #debug ''' self.debug(('self.',self,['CumulatedVariablesList'])) ''' #flat self.RecruitedFlatCumulateVariablesList=SYS.filterNone( SYS.flat( self.CumulatedVariablesList ) )
def findAfter(self,**_FindingVariablesDict): #debug self.debug('Start of the method') #debug self.debug( [ ('Are we going to do a where with the FoundFilteredRowedDictsList and the '), ('filtering JoinedFindingTuplesList?'), ('self.ModeledDict ',self.ModeledDict,[ 'ModelStr', 'FoundFilteredRowedDictsList' ]), ("'JoinedFindingTuplesList' in self.ModeledDict is "+str( 'JoinedFindingTuplesList' in self.ModeledDict)) ] ) if 'JoinedFindingTuplesList' in self.ModeledDict: #debug self.debug( [ 'Ok we are going to do the where', "self.ModeledDict['JoinedFindingTuplesList'] is "+str( self.ModeledDict['JoinedFindingTuplesList']) ] ) #Where self.ModeledDict['FoundFilteredRowedDictsList']=SYS.filterNone(SYS.where( self.ModeledDict['FoundFilteredRowedDictsList'], self.ModeledDict['JoinedFindingTuplesList'] ) ) #debug self.debug('Ok the where is done.') #debug self.debug( [ 'After intersection', ('self.ModeledDict ',self.ModeledDict,[ 'ModelStr', 'FoundFilteredRowedDictsList' ] ) ] ) #debug self.debug('End of the method')
def getPrintManagerItemTuple(_ManagerItemTuple): #Debug ''' print('Pymongoer l 31') print('_ManagerItemTuple is ') print(_ManagerItemTuple) print('') ''' #filter PrintCollectionList=filter( lambda __PymongoviewDict: len(__PymongoviewDict)>0, SYS.filterNone( map( lambda __NoderItemTuple: __NoderItemTuple[1].pymongoview() if hasattr( __NoderItemTuple[1], 'pymongoview' ) else None, _ManagerItemTuple[1].ManagementDict.items() ) ) ) #Debug ''' print('PrintCollectionList is ') print(PrintCollectionList) print('') ''' #Check if len(PrintCollectionList)>0: return ( _ManagerItemTuple[0], PrintCollectionList ) else: return None
def do_feature(self): #Check if self.NodePointDeriveNoder!=None: #map self.FeaturedJoinDatabasersList=SYS.filterNone( map( lambda __NodedDatabaser: __NodedDatabaser if hasattr( __NodedDatabaser,'JoiningDownGetKeyStrsList') and __NodedDatabaser.JoiningDownGetKeyStrsList !=None and self.NodedDatabaseKeyStr in __NodedDatabaser.JoiningDownGetKeyStrsList else None, self.DatabasedDeriveDatabasersOrderedDict.values() ) ) #debug '''
def getPrintDatabaseDict(_Database): #map PrintDatabaseOrderedDictDict=collections.OrderedDict( SYS.filterNone ( map( lambda __CollectionStr: ( __CollectionStr, list(_Database[__CollectionStr].find()) ) if __CollectionStr not in ['system.indexes'] else None, _Database.collection_names() ) ) ) #Debug ''' print('_Database is ') print(_Database) print('id(_Database) is') print(id(_Database)) print("'ParentDerivePymongoer' in _Database.__dict__") print('ParentDerivePymongoer' in _Database.__dict__) print('') ''' #Get the childs database dicts if 'ParentDerivePymongoer' in _Database.__dict__: #Debug ''' print('_Database.ParentDerivePymongoer is '+SYS._str(_Database.__dict__[ 'ParentDerivePymongoer'])) print('') ''' #update PrintDatabaseOrderedDictDict.update( collections.OrderedDict( filter( lambda __ItemTuple: len(__ItemTuple[1])>0, SYS.filterNone( map( lambda __ManagerItemTuple: getPrintManagerItemTuple(__ManagerItemTuple), _Database.__dict__[ 'ParentDerivePymongoer' ].TeamDict.items() ) ) ) ) ) #return return {_Database._Database__name:PrintDatabaseOrderedDictDict}
def do_command(self): """ """ #/####################/# # Adapt the type for getting things to command # #debug ''' self.debug( [ 'Adapt the type for getting things to command', ("self.",self,[ 'CommandingGetVariable', 'CommandingSetVariable' ]) ] ) ''' #Check if type(self.CommandingGetVariable)!=list: #debug ''' self.debug( [ 'We get nicely', ('self.',self,['CommandingGetVariable']) ] ) ''' #get CommandedValueVariablesList=self[ self.CommandingGetVariable ] #Check if type(CommandedValueVariablesList)!=list: CommandedValueVariablesList=[CommandedValueVariablesList] else: #map a get CommandedValueVariablesList=map( lambda __CommandingGetVariable: self[__CommandingGetVariable], self.CommandingGetVariable ) #flat maybe CommandedValueVariablesList=SYS.flat(CommandedValueVariablesList) #filter CommandedValueVariablesList=SYS.filterNone(CommandedValueVariablesList) #debug ''' self.debug( [ 'in the end, CommandedValueVariablesList is ', SYS._str(CommandedValueVariablesList) ] ) ''' #/###################/# # Check if we have to walk before # #Check if self.CommandingBeforeWalkRigidBool: #debug ''' self.debug( [ 'we are going to walk before the command', 'CommandedValueVariablesList is '+SYS._str(CommandedValueVariablesList), 'self.getDoing(SYS.CommanderClass).values() is '+SYS._str (self.getDoing( SYS.CommanderClass).values()) ] ) ''' #Debug ''' for __CommandedValueVariable in CommandedValueVariablesList: #debug self.debug( '__CommandedValueVariable is '+SYS._str( __CommandedValueVariable) ) #set __CommandedValueVariable.set( 'GettingNewBool',False ).command( *self.getDoing().values() ).set( 'GettingNewBool',True ) ''' #set CommandedOrderedDict=self.getDoing( SYS.CommanderClass ) CommandedOrderedDict['CommandingBeforeSelfRigidBool']=False CommandedLiargVariablesList=CommandedOrderedDict.values() #map the recursion but pay watch to not set new things to walk in...it is an infinite walk either ! map( lambda __CommandedValueVariable: __CommandedValueVariable.set( 'GettingNewBool',False ).command( *CommandedLiargVariablesList ).set( 'GettingNewBool',True ), CommandedValueVariablesList ) #/####################/# # Adapt the type for setting things in the commanded variables # #debug ''' self.debug( [ 'Adapt the type for setting things in the commanded variables', ("self.",self,['CommandingSetVariable']) ] ) ''' #Check if type(self.CommandingSetVariable)!=list: #Check if hasattr(self.CommandingSetVariable,'items'): #items CommandedSetVariablesList=self.CommandingSetVariable.items() elif type(self.CommandingSetVariable )==str and self.CommandingSetVariable.startswith( Getter.GetCallPrefixStr ): #list CommandedSetVariablesList=[ ('get',self.CommandingSetVariable) ] else: #list CommandedSetVariablesList=[ self.CommandingSetVariable ] else: #alias CommandedSetVariablesList=self.CommandingSetVariable #debug ''' self.debug( [ 'in the end, CommandedSetVariablesList is ', SYS._str(CommandedSetVariablesList) ] ) ''' #/###################/# # Ok now we command locally # #Check if self.CommandingBeforeSelfRigidBool: #debug ''' self.debug( 'We command before self here' ) ''' #add self[Setter.SetMapStr](CommandedSetVariablesList) #Check for the order if self.CommandingOrderStr=="AllSetsForEachGet": #map map( lambda __CommandedValueVariable: map( lambda __CommandedSetVariable: __CommandedValueVariable.set( *__CommandedSetVariable ), CommandedSetVariablesList ), CommandedValueVariablesList ) elif self.CommandingOrderStr=="EachSetForAllGets": #map map( lambda __CommandedSetVariable: map( lambda __CommandedValueVariables: __CommandedValueVariables.set( *__CommandedSetVariable ), CommandedValueVariablesList ), CommandedSetVariablesList ) #Check if self.CommandingAfterSelfRigidBool: #debug ''' self.debug( 'We command after self here' ) ''' #add self[Setter.SetMapStr](CommandedSetVariablesList) #/###################/# # And we check for a walk after # #Check if self.CommandingAfterWalkRigidBool: #debug ''' self.debug( [ 'we are going to walk the command', 'CommandedValueVariablesList is '+SYS._str(CommandedValueVariablesList) ] ) ''' #Debug ''' for __CommandedValueVariable in CommandedValueVariablesList: #debug self.debug( '__CommandedValueVariable is '+SYS._str( __CommandedValueVariable) ) #set __CommandedValueVariable.set( 'GettingNewBool',False ).command( *self.getDoing().values() ).set( 'GettingNewBool',True ) ''' #set CommandedOrderedDict=self.getDoing( SYS.CommanderClass ) CommandedOrderedDict['CommandingBeforeSelfRigidBool']=False CommandedLiargVariablesList=CommandedOrderedDict.values() #map the recursion but pay watch to not set new things to walk in...it is an infinite walk either ! map( lambda __CommandedValueVariable: __CommandedValueVariable.set( 'GettingNewBool',False ).command( *CommandedLiargVariablesList ).set( 'GettingNewBool',True ), CommandedValueVariablesList )
def setCommandingExtraKeyVariable(self,_ExtraStr=""): #/##################/# # Switch case depending on the team or manage level # #debug ''' self.debug( [ 'We setCommandingKeyVariable here', ('self.',self,[ 'TeamedOnceBool', 'StructuringTeamerCommandKeyVariable', 'StructuringManagerCommandKeyVariable' ]), 'We get the good team or management keys' ] ) ''' #set CommandingKeyVariableKeyStr='Commanding'+_ExtraStr+'KeyVariable' #Check if self.TeamedOnceBool: #/##################/# # get # #set StructuringCommandKeyVariableKeyStr='StructuringTeamerCommand'+_ExtraStr+'KeyVariable' #get StructuringTeamerCommandKeyVariable=getattr( self, StructuringCommandKeyVariableKeyStr ) #debug ''' self.debug( [ 'StructuringTeamerCommandKeyVariable is ', SYS._str(StructuringTeamerCommandKeyVariable) ] ) ''' #/###############/# # Determine the CommandedLiargVariablesList # #Check if StructuringTeamerCommandKeyVariable==None: #all the key StructureKeyStrsList=[] #Check elif type(StructuringTeamerCommandKeyVariable)==list and len( StructuringTeamerCommandKeyVariable )>0 and type( StructuringTeamerCommandKeyVariable[0] )==str: #alias StructureKeyStrsList=StructuringTeamerCommandKeyVariable #Check elif StructuringTeamerCommandKeyVariable=="#all": #all the key StructureKeyStrsList=self.TeamDict.keys() else: #mapCondition StructureKeyStrsList=self.mapCondition( StructuringTeamerCommandKeyVariable, self.TeamDict.keys(), _SetAttrOrCallBool=True ) #/###############/# # Now get and filter in the team # #debug ''' self.debug( [ 'We get the managed values in the Teamer', 'StructureKeyStrsList is ', SYS._str(StructureKeyStrsList) ] ) ''' #set setattr( self, CommandingKeyVariableKeyStr, SYS.filterNone( map( lambda __KeyStr: self.TeamDict[__KeyStr] if __KeyStr in self.TeamDict else None, StructureKeyStrsList ) ) ) else: #/###############/# # Determine the CommandedLiargVariablesList # #debug ''' self.debug( [ 'We setCommandingKeyVariable in a manager', ('self.',self,['StructuringManagerCommandKeyVariable']) ] ) ''' #/##################/# # get # #set StructuringCommandKeyVariableKeyStr='StructuringManagerCommand'+_ExtraStr+'KeyVariable' #get StructuringManagerCommandKeyVariable=getattr( self, StructuringCommandKeyVariableKeyStr ) #Check if StructuringManagerCommandKeyVariable==None: #all the key StructureKeyStrsList=[] #Check elif type(StructuringManagerCommandKeyVariable )==list and len(StructuringManagerCommandKeyVariable )>0 and type(StructuringManagerCommandKeyVariable[0])==str: #alias StructureKeyStrsList=StructuringManagerCommandKeyVariable #Check elif StructuringManagerCommandKeyVariable=="#all": #all the key StructureKeyStrsList=self.ManagementDict.keys() else: #mapCondition StructureKeyStrsList=self.mapCondition( StructuringManagerCommandKeyVariable, self.ManagementDict.keys(), _SetAttrOrCallBool=True ) #/###############/# # Now get and filter in the management # #debug ''' self.debug( [ 'We get the teamed values in the Manager', 'StructureKeyStrsList is ', str(StructureKeyStrsList) ] ) ''' #set setattr( self, CommandingKeyVariableKeyStr, SYS.filterNone( map( lambda __KeyStr: self.ManagementDict[__KeyStr] if __KeyStr in self.ManagementDict else None, StructureKeyStrsList ) ) )
def do_parent(self): #get ParentedDeriveTeamerVariable=self.ParentDeriveTeamerVariable #debug ''' self.debug( [ 'We parent here', ('self.',self,[ #'ManagementPointDeriveTeamer', 'NameStr' ]), 'ParentedDeriveTeamerVariable!=None is', str(ParentedDeriveTeamerVariable!=None) ] ) ''' #Check if ParentedDeriveTeamerVariable!=None: #/####################/# # Set shortly the grand parent # if hasattr(self.ParentDeriveTeamerVariable,'ParentGrandDeriveTeamerVariable'): #get self.ParentGrandDeriveTeamerVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable #Check if self.ParentGrandDeriveTeamerVariable!=None: #Check if self.ParentGrandDeriveTeamerVariable.TeamTagStr!="": #set self.ParentGrandTeamTagStr=self.ParentGrandDeriveTeamerVariable.TeamTagStr #Check if self.ParentGrandDeriveTeamerVariable.ManagementTagStr!="": #set self.ParentGrandManagementTagStr=self.ParentGrandDeriveTeamerVariable.ManagementTagStr #/####################/# # Now build the list chain of Teamers and Managers # #add self.ParentedTotalDeriveParentersList=[ ParentedDeriveTeamerVariable ]+ParentedDeriveTeamerVariable.ParentedTotalDeriveParentersList #add if self.TeamTagStr!="": #add self.ParentedTotalDeriveTeamersList=[ ParentedDeriveTeamerVariable ]+ParentedDeriveTeamerVariable.ParentedTotalDeriveTeamersList #set self.ParentedTotalDeriveManagersList=ParentedDeriveTeamerVariable.ParentedTotalDeriveManagersList else: #add self.ParentedTotalDeriveManagersList=[ ParentedDeriveTeamerVariable ]+ParentedDeriveTeamerVariable.ParentedTotalDeriveManagersList #set self.ParentedTotalDeriveTeamersList=ParentedDeriveTeamerVariable.ParentedTotalDeriveTeamersList #/####################/# # Now build the ordered dict chain of Teamers and Managers # #dict self.ParentedTotalListDict=ListDict( map( lambda __ParentedTotalDeriveParenter: ( __ParentedTotalDeriveParenter.TeamTagStr if __ParentedTotalDeriveParenter.TeamTagStr!="" else __ParentedTotalDeriveParenter.ManagementTagStr, __ParentedTotalDeriveParenter ), self.ParentedTotalDeriveParentersList ) ) #debug ''' self.debug( [ 'The ParentedTotalListDict is setted', 'self.ParentedTotalListDict.keys() is ', str(self.ParentedTotalListDict.keys()) ] ) ''' #Check if self.ParentDeriveTeamerVariable.TeamTagStr!='': #init with self.ParentedTotalSingularListDict=ListDict( [( SYS.getSingularStrWithPluralStr( self.ParentDeriveTeamerVariable.TeamTagStr ), self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable )] ) else: #init self.ParentedTotalSingularListDict=ListDict() #dict self.ParentedTotalSingularListDict.update( SYS.filterNone( map( lambda __ParentedTotalDeriveTeamer: ( SYS.getSingularStrWithPluralStr( __ParentedTotalDeriveTeamer.ParentDeriveTeamerVariable.TeamTagStr ), __ParentedTotalDeriveTeamer ) if __ParentedTotalDeriveTeamer.ParentDeriveTeamerVariable!=None else None, self.ParentedTotalDeriveTeamersList ) ) ) #/####################/# # Now build the paths # #map [ self.ParentedTotalPathStr, self.ParentedTeamPathStr, self.ParentedManagementPathStr, ]=map( lambda __ParentedList: Pather.PathPrefixStr+Pather.PathPrefixStr.join( SYS.reverse( map( lambda __ParentedDeriveTeamer: __ParentedDeriveTeamer.ParentKeyStr, __ParentedList ) ) ), map( lambda __KeyStr: getattr(self,__KeyStr), [ 'ParentedTotalDeriveParentersList', 'ParentedTotalDeriveTeamersList', 'ParentedTotalDeriveManagersList', ] ) ) #debug ''' self.debug( ("self.",self,[ 'ParentedTotalPathStr', 'ParentedTeamPathStr', 'ParentedManagementPathStr' ] ) ) ''' #/####################/# # Set the top teamer variable # #Check if len(self.ParentedTotalDeriveParentersList)>0: #last one self.ParentTopDeriveTeamerVariable=self.ParentedTotalDeriveParentersList[-1] #debug ''' self.debug( ('self.',self,['ParentTopDeriveTeamerVariable']) ) ''' else: #set self.ParentTopDeriveTeamerVariable=self #debug ''' self.debug( [ 'Finally', ('self.',self,['ParentTopDeriveTeamerVariable']) ] ) ''' #/####################/# # link to the ParentTagStr # #set self.ParentTagStr=self.ParentedTotalPathStr.replace('/','_')+'_'+self.ParentKeyStr #/####################/# # Adapt the shape of the ParentedTriggerVariablesList # for the trigger #init self.ParentedTriggerVariablesList=SYS.SetList( self.ParentingTriggerVariable )
def do_explore(self): """ """ #debug ''' self.debug( [ "We explore here" ] ) ''' #Check if self.ExploredSucessesInt < self.ExploringSuccessesInt: # # Prepare # #Check if hasattr(self.ExploringRangeVariable,'items'): self.ExploredRangeTuplesList=self.ExploringRangeVariable.items() #Check if hasattr(self.ExploringConditionVariable,'items'): self.ExploredConditionTuplesList=self.ExploringConditionVariable.items() #Check if len(self.ExploredRangeTuplesList)!=len(self.ExploredParameterStrsList): self.ExploredParameterStrsList = map( lambda __TuplesList:__TuplesList[0], self.ExploredRangeTuplesList ) # # Prepare Children # #Check if self.ExploredManagersVariable == None: #debug self.debug( [ ('self.',self,[ 'TeamingClassesDict' ]) ] ) #sum self.ExploredManagersVariable = SYS.sum( SYS.filterNone( map( lambda __TeamStr: self.TeamDict[__TeamStr].ManagementDict.values() if __TeamStr in self.TeamDict else None, self.TeamingClassesDict.keys() ) ) ) #Check if self.ParentDeriveTeamerVariable == None: #coordinate one first time self.coordinate(self.ExploringMethodStr) #set ExploredTopMethodStr=self.ExploringMethodStr+"Top" #Check if hasattr(self,ExploredTopMethodStr): #set self.ExploredMethodStr = ExploredTopMethodStr if self.ExploredMethodStr=="": self.ExploredMethodStr = self.ExploringMethodStr # # Pick # #Check while self.ExploringTrialsInt > self.ExploredTrialsInt : #count self.ExploredTrialsInt +=1 #debug ''' self.debug( [ "We test with a new trial set", ('self.',self,[ 'ExploredTrialsInt' ]) ] ) ''' # # Init # #init the ranges map( lambda __TuplesList: setattr( self, __TuplesList[0], __TuplesList[1](self) ), self.ExploredRangeTuplesList ) # # Check Children # #debug self.debug( [ "We first check the children" ] ) #map map( lambda __Manager: __Manager.explore( _MethodStr = self.ExploringMethodStr, _ConditionVariable = SYS.update( self.ExploringConditionVariable, { "explore":getattr( self.__class__, self.ExploringMethodStr+__Manager.CoordinatedParentSingularStr ) } ) if hasattr(__Manager,self.ExploringMethodStr+__Manager.CoordinatedParentSingularStr) else self.ExploringConditionVariable, _SuccessesInt=1 ) if __Manager.ExploredCheckBool==False else None, self.ExploredManagersVariable ) # # Test # #debug self.debug( [ "Now we do the local test", ('self.',self,[ 'ExploringMethodStr', 'ExploredMethodStr' ]) ] ) #call getattr(self,self.ExploredMethodStr)() # # Each Check # #init self.ExploredCheckBool = True #loop for __ConditionTuple in self.ExploredConditionTuplesList: #Check if __ConditionTuple[1](self) == False: #set self.ExploredCheckBool = False #break break #debug ''' self.debug( [ ('self.',self,[ 'ExploredCheckBool' ]) ] ) ''' # # Total Check # #Check if self.ExploredCheckBool: #count self.ExploredSucessesInt += 1 #keep self.ExploredStoreTuplesListsList.append( map( lambda __KeyStr: (__KeyStr,getattr(self,__KeyStr)), self.ExploredKeepStrsList+self.ExploredParameterStrsList ) ) #debug ''' self.debug( [ "it is a sucess", ('self.',self,['ExploredStoreTuplesListsList']) ] ) ''' #break maybe if self.ExploredSucessesInt >= self.ExploringSuccessesInt: #break break #debug ''' self.debug( [ ('We reached the max of Trials ot pick') ] ) ''' else: #debug '''
def do_reboot(self): # debug """ self.debug( [ 'self.__dict__.keys() is '+str(self.__dict__.keys()), ('self.',self,[ 'RebootingDoStrsList', 'RebootingNameStrsList' ]) ] ) """ # filter self.RebootedWatchBoolKeyStrsList = SYS._filter( lambda _KeyStr: (_KeyStr.startswith("_Watch") or _KeyStr.startswith("Watch")) and ( "Watch".join(_KeyStr.split("Watch")[1:]).split("With")[0] in self.RebootingDoStrsList if self.RebootingAllDoBool == False else True ) and ( any(map(lambda __NameStr: _KeyStr.endswith(__NameStr + "Bool"), self.RebootingNameStrsList)) if self.RebootingAllNameBool == False else True ), self.__dict__.keys(), ) # map map( lambda __RebootedWatchBoolKeyStr: self.__setattr__( __RebootedWatchBoolKeyStr if __RebootedWatchBoolKeyStr[0] != "_" else __RebootedWatchBoolKeyStr[1:], False, ), self.RebootedWatchBoolKeyStrsList, ) # Check if self.RebootingSetDoIsBool: # set if self.RebootingAllNameBool: # filter self.RebootingNameStrsList = SYS.filterNone( map( lambda __MroClass: __MroClass.NameStr if hasattr(__MroClass, "DoStr") else None, self.__class__.__mro__, ) ) # debug """ self.debug(('self.',self,['RebootingNameStrsList'])) """ # map map( lambda __RebootingClass: self.setDone(__RebootingClass) # if hasattr(__RebootingClass,'DoneAttributeVariablesOrderedDict') # else None, , map( lambda __RebootingClassStr: getattr(SYS, __RebootingClassStr) # if hasattr(SYS,__RebootingClassStr) # else None , map(SYS.getClassStrWithNameStr, self.RebootingNameStrsList), ), )
def setCommandingKeyVariable(self): #/##################/# # Switch case depending on the team or manage level # #debug ''' self.debug( [ 'We setCommandingKeyVariable here', ('self.',self,[ 'TeamedOnceBool', 'StructureTeamerCommandKeyRigidVariable', 'StructureManagerCommandKeyRigidVariable' ]), 'We get the good team or management keys' ] ) ''' #Check if self.TeamedOnceBool: #/##################/# # get # #get StructureTeamerCommandKeyRigidVariable=getattr( self, 'StructureTeamerCommandKeyRigidVariable' ) #debug ''' self.debug( [ 'StructureTeamerCommandKeyRigidVariable is ', SYS._str(StructureTeamerCommandKeyRigidVariable) ] ) ''' #/###############/# # Determine the CommandedLiargVariablesList # #Check if StructureTeamerCommandKeyRigidVariable==None: #all the key StructureKeyStrsList=[] #Check elif type(StructureTeamerCommandKeyRigidVariable)==list and len( StructureTeamerCommandKeyRigidVariable )>0 and type( StructureTeamerCommandKeyRigidVariable[0] )==str: #alias StructureKeyStrsList=StructureTeamerCommandKeyRigidVariable #Check elif StructureTeamerCommandKeyRigidVariable=="#all": #all the key StructureKeyStrsList=self.TeamDict.keys() else: #mapCondition StructureKeyStrsList=self.mapCondition( StructureTeamerCommandKeyRigidVariable, self.TeamDict.keys(), _SetAttrOrCallBool=True ) #/###############/# # Now get and filter in the team # #debug ''' self.debug( [ 'We get the managed values in the Teamer', 'StructureKeyStrsList is ', SYS._str(StructureKeyStrsList) ] ) ''' #set setattr( self, 'CommandingKeyVariable', SYS.filterNone( map( lambda __KeyStr: self.TeamDict[__KeyStr] if __KeyStr in self.TeamDict else None, StructureKeyStrsList ) ) ) else: #/###############/# # Determine the CommandedLiargVariablesList # #debug ''' self.debug( [ 'We setCommandingKeyVariable in a manager', ('self.',self,['StructuringManagerCommandKeyVariable']) ] ) ''' #/##################/# # get # #get StructureManagerCommandKeyRigidVariable=getattr( self, 'StructureManagerCommandKeyRigidVariable' ) #/##################/# # Sort the dict # #debug ''' self.debug( [ 'before sort', 'self.ManagementDict.keys() is ', SYS._str(self.ManagementDict.keys()) ] ) ''' #sort self.ManagementDict.sort() #debug ''' self.debug( [ 'after sort', 'self.ManagementDict.keys() is ', SYS._str(self.ManagementDict.keys()) ] ) ''' #/##################/# # determine the StructureKeyStrsList # #Check if StructureManagerCommandKeyRigidVariable==None: #all the key StructureKeyStrsList=[] #Check elif type(StructureManagerCommandKeyRigidVariable )==list and len(StructureManagerCommandKeyRigidVariable )>0 and type(StructureManagerCommandKeyRigidVariable[0])==str: #alias StructureKeyStrsList=StructureManagerCommandKeyRigidVariable #Check elif StructureManagerCommandKeyRigidVariable=="#all": #all the key StructureKeyStrsList=self.ManagementDict.keys() else: #mapCondition StructureKeyStrsList=self.mapCondition( StructureManagerCommandKeyRigidVariable, self.ManagementDict.keys(), _SetAttrOrCallBool=True ) #/###############/# # Now get and filter in the management # #debug ''' self.debug( [ 'We get the teamed values in the Manager', 'StructureKeyStrsList is ', str(StructureKeyStrsList) ] ) ''' #filterNone CommandingKeyVariable=SYS.filterNone( map( lambda __KeyStr: self.ManagementDict[__KeyStr] if __KeyStr in self.ManagementDict else None, StructureKeyStrsList ) ) #/##################/# # Maybe sort # """ #debug self.debug( [ 'before sort', 'CommandingKeyVariable is ', SYS._str(CommandingKeyVariable) ] ) #sort CommandingKeyVariable=SYS.sort( CommandingKeyVariable ) #debug self.debug( [ 'after sort', 'CommandingKeyVariable is ', SYS._str(CommandingKeyVariable) ] ) """ #set setattr( self, 'CommandingKeyVariable', CommandingKeyVariable )
def do_find(self): #debug ''' self.debug( [ 'we are going to find', ("self.",self,[ 'FindingWhereVariable' ]) ] ) ''' #/###################/# # Case of mongo # #If the FoundMongoIsBool was not yet setted if self.FoundMongoIsBool==False: #debug ''' self.debug( [ 'FoundMongoRowDictsList was not yet setted' ] ) ''' #Check if self.ModelMongoBool: #find in the list self.FoundMongoRowDictsList=list( self.ModeledMongoCollection.find( self.FindingWhereVariable ) ) #set self.FoundMongoIsBool=True #debug ''' self.debug( [ ("self.",self,['FoundMongoRowDictsList']) ] ) ''' #/###################/# # Case of hdf # #If the FoundHdfIsBool was not yet setted if self.FoundHdfIsBool==False: #debug ''' self.debug( [ 'FoundHdfRowDictsList was not yet setted', ] ) ''' #Check if self.ModelHdfBool: #Take the first one in the list self.FoundHdfRowDictsList=Rower.getRowedDictsListWithTable( #self.TabularedHdfGroupVariable._f_getChild( # self.TabularedHdfKeyStrsList[0] #) self.ModeledHdfTable ) #set self.FoundHdfIsBool=True #debug ''' self.debug( [ ("self.",self,['FoundHdfRowDictsList']) ] ) ''' #Now we find with a condition Tuples list self.FoundHdfRowDictsList=SYS.filterNone( SYS.where( self.FoundHdfRowDictsList, self.FindingWhereVariable ) ) #debug ''' self.debug( [ 'The where is over now', ("self.",self,['FoundFilterRowDictsList']) ] ) ''' #/##################/# # Maybe recover # #Check if self.FindingRecoverBool: #Check if len(self.FoundMongoRowDictsList)==1: #get self.FoundRecoverDict=self.FoundMongoRowDictsList[0] elif len(self.FoundHdfRowDictsList)==1: #get self.FoundRecoverDict=self.FoundHdfRowDictsList[0] #debug ''' self.debug( [ 'Now we update with the self.RecoveredDict', 'self.RecoveredDict is '+str(self.RecoveredDict) ] ) ''' #set the RetrievingIndexesList and retrieve self.RetrievingIndexIntsList=[ 0, self.FoundRecoverDict['RowInt'] ] #debug ''' self.debug( [ ('self.',self,['RetrievingIndexIntsList']) ] ) ''' #Now we can retrieve self.retrieve()
def do_merge(self): #Check if self.ModelingHdfBool: #debug ''' self.debug( ('self.',self,[ 'ModeledKeyStr', 'MergingConditionVariable', 'TabularedTableKeyStrsList' ]) ) ''' #Debug ''' print( map( lambda __TabularedKeyStr: __TabularedKeyStr.split(Shaper.ShapingJoiningStr), self.TabularedTableKeyStrsList ) ) ''' #Bind with MergedShapingDictsList setting MergedShapingDictsList=map( lambda __StrsList: dict( map( lambda __ShapingStr: SYS.getUnSerializedTuple( self.NodePointDeriveNoder, __ShapingStr.split( Shaper.ShapingTuplingStr ) ) #Remove the suffix and the prefix ,__StrsList[1:-1] if len(__StrsList)>2 else [] ) ), map( lambda __TabularedKeyStr: __TabularedKeyStr.split(Shaper.ShapingJoiningStr), self.TabularedTableKeyStrsList ) ) #debug ''' self.debug('MergedShapingDictsList is '+str(MergedShapingDictsList)) ''' #Bind with MergedFilteredShapingDictsList MergedFilteredShapingDictsList=SYS.where( MergedShapingDictsList, self.MergingConditionVariable ) #debug ''' self.debug('MergedFilteredShapingDictsList is '+str(MergedFilteredShapingDictsList)) ''' #Bind with MergedTablesList setting MergedTablesList=SYS.filterNone( map( lambda __Table,__MergedFilteredShapingDict: __Table if __MergedFilteredShapingDict!=None else None, self.TabularedTablesOrderedDict.values(), MergedFilteredShapingDictsList )) MergedRowedDictsListsList=map( lambda __MergedTable: map( lambda __RowedDict: dict(__RowedDict,**{ 'TabledInt':int( __MergedTable.name.split(Tabler.TablingOrderStr)[1] ) } ), Rower.getRowedDictsListWithTable(__MergedTable) ), MergedTablesList ) #debug ''' self.debug('MergedRowedDictsListsList is '+str(MergedRowedDictsListsList)) ''' #Reduce if len(MergedRowedDictsListsList)>0: self.MergedRowedDictsList=reduce(operator.__add__,MergedRowedDictsListsList)
def do_reboot(self): #set if self.RebootingAllNameBool: #filter self.RebootingNameStrsList=SYS.filterNone( map( lambda __MroClass: __MroClass.NameStr if hasattr(__MroClass,'DoStr') else None, self.__class__.__mro__ ) ) #set if self.RebootingAllDoBool: #filter self.RebootingDoStrsList=SYS.filterNone( map( lambda __MroClass: __MroClass.DoStr if hasattr(__MroClass,'DoStr') else None, self.__class__.__mro__ ) ) #debug ''' self.debug( ('self.',self,[ 'RebootingDoStrsList', 'RebootingNameStrsList' ]) ) ''' #map map( lambda __RebootingNameStr: self.setSwitch( __RebootingNameStr, self.RebootingDoStrsList ), self.RebootingNameStrsList ) #Check if self.RebootingSetDoIsBool: #debug ''' self.debug(('self.',self,['RebootingNameStrsList'])) ''' #map map( lambda __RebootingClass: self.setDone( __RebootingClass ) #if hasattr(__RebootingClass,'DoneAttributeVariablesOrderedDict') #else None, ,map( lambda __RebootingClassStr: getattr( SYS, __RebootingClassStr ) #if hasattr(SYS,__RebootingClassStr) #else None ,map(SYS.getClassStrWithNameStr,self.RebootingNameStrsList) ) )