コード例 #1
0
	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')
コード例 #2
0
	def do_row(self):
		""""""
		
		#debug
		'''
		self.debug(
			[
				'We row here'
			]
		)
		'''

		#Check	
		if self.ModeledParentControllerDeriveModelerVariable!=None:
			
			#debug
			'''
			self.ModeledParentControllerDeriveModelerVariable.debug('ParentSpeaking...')
			'''

			#Check
			if self.ModelMongoBool:

				#Update
				self.RowedMongoPickOrderedDict.update(
					zip(
						self.RowingKeyStrsList,
						#self.ModeledParentControllerDeriveModelerVariable[Getter.GetMapStr](
						#	*self.ModelKeyStrsList
						#).ItemizedMapValueVariablesList
						self.ModeledParentControllerDeriveModelerVariable.mapGet(
							self.ModelKeyStrsList
						)
					)
				)

				#debug
				'''
				self.debug(
					[
						('self.',self,[
										'RowedMongoPickOrderedDict',
										'ModeledMongoCollection'
									]
						),
						'list(self.ModeledMongoCollection.find()) is '+SYS._str(
							list(self.ModeledMongoCollection.find()))
					]
				)
				'''

				#Check if it was already rowed
				self.RowedMongoIsBoolsList=map(
						lambda __Row:
						all(
							map(
									lambda __RowedItemTuple:
									SYS.getIsEqualBool(
														__Row[__RowedItemTuple[0]],
														__RowedItemTuple[1]
													),
									self.RowedMongoPickOrderedDict.items()
								)
						),
						self.ModeledMongoCollection.find()
					)

				#debug
				'''
				self.debug(
					[
						('self.',self,[
							'RowedMongoIsBoolsList'
						]),
						'Maybe there is now row or no rowing Key str ...so it is false already',
						'len(self.RowedMongoIsBoolsList)==0 is ',
						str(len(self.RowedMongoIsBoolsList)==0),
						'len(self.RowedMongoPickOrderedDict)==0 is',
						str(len(self.RowedMongoPickOrderedDict))
					]
				)
				'''

				#set
				if len(self.RowedMongoIsBoolsList)==0 or len(self.RowedMongoPickOrderedDict)==0:
					self.RowedMongoIsBool=False
				else:
					self.RowedMongoIsBool=any(self.RowedMongoIsBoolsList)

				#Init to the len of the table
				self.RowedMongoIndexInt=len(self.RowedMongoIsBoolsList)
				
				#debug
				'''
				self.debug(('self.',self,[
						'RowedMongoIndexInt',
						'RowedMongoIsBool'
					]))
				'''
				
				#But maybe find a last index
				if self.RowedMongoIsBool: 
					if len(self.RowedMongoIsBoolsList)>0:
						self.RowedMongoIndexInt=self.RowedMongoIsBoolsList.index(True)

				#debug
				'''
				self.debug(('self.',self,['RowedMongoIsBool','RowedMongoIndexInt']))
				'''

			#Check
			if self.ModelHdfBool:

				#debug
				'''
				self.debug('This is a hdf row here')
				'''

				#/##################/#
				# First check the good size
				#

				if self.RowKeyStrToColumnStrOrderedDict==None or len(
					self.ModelingDescriptionTuplesList)!=len(
					self.RowKeyStrToColumnStrOrderedDict):

					#Bind with RowGetStrToColumnStrOrderedDict setting
					self.RowKeyStrToColumnStrOrderedDict=collections.OrderedDict(
							map(
								lambda _ModelingSealTuple:
								(
									_ModelingSealTuple[0],
									_ModelingSealTuple[1]
								),
								self._ModelingDescriptionTuplesList
								)
							)

					#Bind with 
					self.RowHdfColumnStrsList=map(
							lambda __RowingKeyStr:
							self.RowKeyStrToColumnStrOrderedDict[__RowingKeyStr],
							self.RowingKeyStrsList
						)

				#/#################/#
				# Pick the values to be rowed in the hdf variables
				#

				#debug
				'''
				self.debug(
					('self.',self,[
						'RowingKeyStrsList',
						'RowHdfColumnStrsList'
						])
				)
				'''
				
				#Update
				self.RowedHdfPickOrderedDict.update(
					zip(
						self.RowHdfColumnStrsList,
						#self.ModeledParentControllerDeriveModelerVariable[Getter.GetMapStr](
						#	*self.RowingKeyStrsList
						#).ItemizedMapValueVariablesList
						self.ModeledParentControllerDeriveModelerVariable.mapGet(
							self.RowingKeyStrsList
						)
					)
				)

				#debug
				'''
				self.debug(
					[
						'Ok we have almost end the row',
						('self.',self,[
									'RowedHdfPickOrderedDict',
								]
						),
						'Check now if it is a new row'
					]
				)
				'''

				#/#################/#
				# Check if it is a new row
				#

				#Check if it was already rowed
				self.RowedHdfIsBoolsList=map(
						lambda __Row:
						all(
							map(
									lambda __RowedItemTuple:
									SYS.getIsEqualBool(
														__Row[__RowedItemTuple[0]],
														__RowedItemTuple[1]
													),
									self.RowedHdfPickOrderedDict.items()
								)
							),
						self.ModeledHdfTable.iterrows()
					)

				#debug
				'''
				self.debug(
					[
						'Is is a new row ?',
						('self.',self,['RowedHdfIsBoolsList']),
						'Maybe there is now row or no rowing Key str ...so it is false already',
						'len(self.RowedHdfIsBoolsList)==0 is ',
						str(len(self.RowedHdfIsBoolsList)==0),
						'len(self.RowedHdfPickOrderedDict)==0 is',
						str(len(self.RowedHdfPickOrderedDict))
					]
				)	
				'''

				#set
				if len(self.RowedHdfIsBoolsList)==0 or len(self.RowedHdfPickOrderedDict)==0:
					self.RowedHdfIsBool=False
				else:
					self.RowedHdfIsBool=any(self.RowedHdfIsBoolsList)

				#Init to the len of the table
				self.RowedHdfIndexInt=self.ModeledHdfTable.nrows

				#But maybe find a last index
				if self.RowedHdfIsBool: 
					if len(self.RowedHdfIsBoolsList)>0:
						self.RowedHdfIndexInt=self.RowedHdfIsBoolsList.index(True)

				#debug
				'''
コード例 #3
0
	def row(self,**_VariablesList):

		#debug
		self.debug('Start of the method')

		#debug
		self.debug(
					[
						"self.ModelingModelStr is "+str(self.ModelingModelStr),
						"We are going to check if the joined model is already inserted...",
						"First look if self.JoinedModeledDatabase!={} is "+str(len(self.JoinedModeledDatabase)>0)
					]
				)

		#Check
		if self.JoinedDatabasePointer!=None:

			#debug
			self.debug("Ok there is a self.JoinedDatabasePointer")

			#Alias
			JoinedRetrievingIndexesList=self.JoinedRetrievingIndexesList
			JoinedRetrievingIndexesListKeyStr=self.JoinedRetrievingIndexesListKeyStr

			#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(self.JoinedModeledDatabase.ModelingColumningTuplesList,[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
							)
					),
					self.JoinedDatabasePointer.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
			JoinedRetrievingIndexesList[1]=RowInt
			#self.ModeledDict['JoinedOrderedDict'][JoinedRetrievingIndexesListKeyStr][1]=RowInt


			#Alias
			'''
			JoinedOrderedDict=self.ModeledDict['JoinedOrderedDict']
			JoinedRetrievingIndexesList=self.ModeledDict['JoinedOrderedDict'][JoinedRetrievingIndexesListKeyStr]

			#Give the JoinedRetrievingIndexesList to itself
			JoinedOrderedDict.__setitem__(
				JoinedRetrievingIndexesListKeyStr,
				JoinedRetrievingIndexesList
			)
			'''

			'''
			#debug
			self.debug(
						[
							'JoinedOrderedDict is now',
							SYS.represent(JoinedOrderedDict)
						]
					)
			'''

			#debug
			#self.debug('So we set the JoinedRetrievingIndexesList in the RowedIdentifiedOrderedDict')

			#Update the self.RowedIdentifiedOrderedDic
			#self.ModeledDict['RowedIdentifiedOrderedDict'].update(JoinedOrderedDict)
			#self.ModeledDict['RowedIdentifiedOrderedDict'].__setitem__(
			#			JoinedRetrievingIndexesListKeyStr,
			#			JoinedRetrievingIndexesList
			#		)

		#debug
		self.debug('End of the method')
コード例 #4
0
	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')
コード例 #5
0
	def join(	
				self,
				_ModelStr="",
				**_LocalJoiningVariablesDict
			):

		#debug
		print('Joiner join method')
		print('_ModelStr is ',_ModelStr)
		if hasattr(self,"StructuredKeyStr"):
			print('self.StructuredKeyStr is ',self.StructuredKeyStr)
		print('')

		#Maybe we need to refresh some modeled and tabulared attributes
		if _ModelStr!="":

			#debug
			'''
			print('_ModelStr is ',_ModelStr)
			print('')
			'''

			#row
			self.tabular(_ModelStr)

		else:

			#set again the _ModelStr
			_ModelStr=self.ModeledDict['ModelStr']

		#Init maybe the _LocalJoiningVariablesDict
		if 'IsJoiningBool' not in _LocalJoiningVariablesDict:

			#set IsScanningBool to False
			_LocalJoiningVariablesDict['IsJoiningBool']=False

			#Refresh attributes
			self.JoinedJoinedList=[-1,-1]
			self.JoinedOrderedDict=collections.OrderedDict()
			self.JoinedNodifiedOrderedDict=collections.OrderedDict()

		#Init a default False IsCheckingJoiningBool
		if 'IsCheckingJoiningBool' not in _LocalJoiningVariablesDict:
			_LocalJoiningVariablesDict['IsCheckingJoiningBool']=True

		#set the JoiningTuple
		if 'JoiningTuple' not in _LocalJoiningVariablesDict:

			#Case where there are joins
			if 'JoiningTuple' in self.ModeledDict:

				#set to the _LocalJoiningVariablesDict
				_LocalJoiningVariablesDict['JoiningTuple']=self.ModeledDict['JoiningTuple']

				#Maybe we have to structure
				if self.IsGroupedBool==False:

					#debug
					'''
					print('Join We have to structure first')
					if hasattr(self,"StructuredKeyStr"):
						print('self.StructuredKeyStr is ',self.StructuredKeyStr)
					'''
					
					#Structure
					self.structure(self.ModeledDict['JoiningTuple'][0])

			else:

				#set a default
				_LocalJoiningVariablesDict['JoiningTuple']=("","")

		#Nodify if there is the nodified objects
		if _LocalJoiningVariablesDict['IsJoiningBool']==False and _LocalJoiningVariablesDict['JoiningTuple'
		][0]!="":

			#debug
			print('Joiner we are going to nodify the ',_LocalJoiningVariablesDict['JoiningTuple'][0])
			if hasattr(self,'StructuredKeyStr'):
				print('self.StructuredKeyStr is ',self.StructuredKeyStr)
			print('')

			#Nodify
			self.nodify(_LocalJoiningVariablesDict['JoiningTuple'][0])
			self.JoinedNodifiedOrderedDict=copy.copy(self.NodifiedOrderedDict)
			self.JoinedNodifiedNodeStr=self.NodifiedNodeStr
			self.JoinedNodifiedNodedStr=SYS.getDoneStrWithDoStr(self.NodifiedNodeStr)
			self.JoinedNodifiedNodingStr=SYS.getDoneStrWithDoStr(self.NodifiedNodeStr)

			#debug
			print('self.JoinedNodifiedOrderedDict is ',self.JoinedNodifiedOrderedDict)
			print('')

		#debug
		'''
		print("_LocalJoiningVariablesDict['JoiningTuple'] is ",
			_LocalJoiningVariablesDict['JoiningTuple'])
		print('')
		'''

		#If there is a joined model
		if len(self.JoinedNodifiedOrderedDict)==0 or _LocalJoiningVariablesDict['IsJoiningBool']:

			#debug
			'''
			print('We have the right to join !')
			print("_LocalJoiningVariablesDict['IsJoiningBool']",
				_LocalJoiningVariablesDict['IsJoiningBool'])
			print('self.ModeledDict is ',self.ModeledDict)
			print('')
			'''

			#Tabular for the _JoiningRowingStr if JoiningTuple is not None
			if _LocalJoiningVariablesDict['JoiningTuple'][1]!=None:
				self.JoinedModelStr=_LocalJoiningVariablesDict['JoiningTuple'][1]
				self.JoinedModeledStr=SYS.getDoneStrWithDoStr(self.JoinedModelStr)
				self.tabular(self.JoinedModelStr)
				self.JoinedModeledDict=copy.copy(self.ModeledDict)
				self.JoinedModeledKeyStr=self.ModeledKeyStr
				self.JoinedJoinedList[0]=self.ShapedTabularedInt
				self.JoinedTabularedTable=self.TabularedTable

			#debug
			'''
			print('self.JoinedModeledDict is ',self.JoinedModeledDict)
			print('self.JoinedModeledKeyStr is ',self.JoinedModeledKeyStr)
			print('self.JoinedJoinedList is ',self.JoinedJoinedList)
			print('')
			'''

			#Check if the actual setup is already rowed
			if _LocalJoiningVariablesDict['IsCheckingJoiningBool'] and self.JoinedJoinedList[1]==-1:

				#Definition the GettingStrsList and the GettedVariablesList
				if 'ColumningTuplesList' in self.JoinedModeledDict:

					#Get the GettingStrsList and GettedVariablesList
					GettingStrsList=SYS.unzip(self.JoinedModeledDict['ColumningTuplesList'],[0])
					GettedVariablesList=self.pick(GettingStrsList)

					#debug
					'''
					print(map(
							lambda __Row:
							map(
									lambda __GettingStr,__GettedVariable:
									all(__Row[__GettingStr]==__GettedVariable),
									GettingStrsList,
									GettedVariablesList
								),
							JoinedTabularedTable.iterrows()
						)
					)
					'''

					#Check if it was already rowed
					IsRowedBoolsList=map(
							lambda __Row:
							all(
								map(
										lambda __GettingStr,__GettedVariable:
										SYS.getIsEqualBool(__Row[__GettingStr],__GettedVariable),
										GettingStrsList,
										GettedVariablesList
									)
							),
							self.JoinedTabularedTable.iterrows()
						)					

					#debug
					'''
					print('self.StructuredKeyStr is ',self.StructuredKeyStr)
					print('IsRowedBoolsList is ',IsRowedBoolsList)
					print('')
					'''

					#If it is rowed then set the JoinedJoinedList
					try:
						IndexInt=IsRowedBoolsList.index(True)
					except ValueError:
						IndexInt=-1
					self.JoinedJoinedList[1]=IndexInt

			#Give to itself
			JoinedOrderedSetTagStr=self.JoinedNodifiedNodedStr+'JoinedOrderedDict'
			if hasattr(self,JoinedOrderedSetTagStr):
				self.JoinedOrderedDict=getattr(self,JoinedOrderedSetTagStr)
			if self.JoinedOrderedDict==None:
				self.JoinedOrderedDict=collections.OrderedDict()
			self.JoinedOrderedDict.__setitem__(
				self.JoinedJoinedListKeyStr,self.JoinedJoinedList
			)

			if self.JoinedNodifiedNodedStr!="":
				ParentPointer=getattr(self,self.JoinedNodifiedNodedStr+'ParentPointer')
				if ParentPointer!=None:
					#Give to the Parent
					JoinedOrderedDict=getattr(ParentPointer,JoinedOrderedSetTagStr)
					JoinedOrderedDict[getattr(self,self.JoinedNodifiedNodedStr+'KeyStr'
						)+self.JoinedJoinedListKeyStr]=self.JoinedJoinedList

			#debug
			'''
			print('JoinedModeledDict is ',JoinedModeledDict)
			print('JoinedList is ',JoinedList)
			print('')
			'''

			#Tabular again to set again the ModeledDict
			self.tabular(_ModelStr)
				
		else:

			#debug
			'''
			print('This either a not last level of child or it is not yet authorized to join')
			print('self.JoinedNodifiedOrderedDict.values() is ',self.JoinedNodifiedOrderedDict.values())
			print('len(self.NodifiedOrderedDict.values()) is ',len(self.NodifiedOrderedDict.values()))
			print("_LocalJoiningVariablesDict['IsJoiningBool']",_LocalJoiningVariablesDict['IsJoiningBool'])
			print('so join the deeper children groups first')
			print('')
			'''

			map(
					lambda __JoiningObjects:
					__JoiningObjects.join(
											self.ModeledDict['ModelStr'],
											**_LocalJoiningVariablesDict
										),
					self.JoinedNodifiedOrderedDict.values()
				)

			'''
			print('The deeper children groups are joined now')
			print('So join here !')
			print('')
			'''

			self.join(
						self.ModeledDict['ModelStr'],
						**dict(
								_LocalJoiningVariablesDict,**{'IsJoiningBool':True}
							)
					)


		#Return self
		return self
コード例 #6
0
	def recoverBefore(self,**_LocalRecoveringVariablesDict):

		#debug
		print('Joiner recoverBefore method')
		print('self.RetrievedFilteredRowedDictsList is ')
		SYS._print(self.RetrievedFilteredRowedDictsList)
		if hasattr(self,'StructuredKeyStr'):
				print("self['StructuredKeyStr'] is ",self.StructuredKeyStr)
		print('')

		if len(self.RetrievedFilteredRowedDictsList)==1:
				
			#debug
			'''
			print('Joiner It is good, there is one solution !')
			print('')
			'''

			#Definition a JoinedRecoveredDict
			JoinedRecoveredDict=self.RetrievedFilteredRowedDictsList[0]

			#debug
			print('Joiner JoinedRecoveredDict is ')
			SYS._print(JoinedRecoveredDict)
			print('self.JoinedNodifiedNodedStr is ',self.JoinedNodifiedNodedStr)
			if hasattr(self,'StructuredKeyStr'):
				print("self['StructuredKeyStr'] is ",self.StructuredKeyStr)
			print('')

			#Maybe we have to recover the children before
			ChildJoinersList=self.JoinedNodifiedOrderedDict.values()
			if len(ChildJoinersList)>0:

				#set each Children and recover each
				JoinedNodifiedKeyStr=self.JoinedNodifiedNodedStr+'KeyStr'
					
				#debug
				print('We are going to make recover each children before')
				if hasattr(self,'StructuredKeyStr'):
					print('self.StructuredKeyStr is ',self.StructuredKeyStr)
				print('')
				print('self.JoinedNodifiedOrderedDict.values() is ',self.JoinedNodifiedOrderedDict.values())
				print('')

				#Map a Recover
				map(
						lambda __JoinedJoiner:
						__JoinedJoiner.__setitem__(
								'/App_Model_'+self.ModeledDict['ModelingStr']+'Dict/RetrievingIndexesListsList',
								[
									(
										JoinStr+self.JoinedJoinedListKeyStr,
										(
											SYS.getIsEqualBool,
											JoinedRecoveredDict[
											self.JoinedNodifiedNodedStr+getattr(
													__JoinedJoiner,
													JoinedNodifiedKeyStr
													)+self.JoinedJoinedListKeyStr
											]
										)
									)
								]
						).recover(self.ModeledKeyStr),
						ChildJoinersList
					)

			#Definition the 
			AppendingGettingStrsList=SYS.unzip(self.JoinedFilteredMergedRowedDictsListTuplesList,[0])

			#debug
			print('Joiner maybe update first the joined model')
			print('self.JoinedFilteredMergedRowedDictsListTuplesList is')
			SYS._print(self.JoinedFilteredMergedRowedDictsListTuplesList)
			print('AppendingGettingStrsList is ',AppendingGettingStrsList)

			#Next we have maybe to update with the joined model	
			if '/' in AppendingGettingStrsList:	

				#Definition the IndexInt of the joined model
				IndexInt=AppendingGettingStrsList.index('/')

				#Definition the JoinedFilteredMergedRowedDictsList
				JoinedFilteredMergedRowedDictsList=self.JoinedFilteredMergedRowedDictsListTuplesList[
						IndexInt][1] 

				#Definition the JoinedJoinedList
				JoinedJoinedList=JoinedRecoveredDict[self.JoinedJoinedListKeyStr]

				#debug
				print('JoinedFilteredMergedRowedDictsList is ')
				SYS._print(JoinedFilteredMergedRowedDictsList)
				print('JoinedJoinedList is ',JoinedJoinedList)
				if hasattr(self,'StructuredKeyStr'):
					print("self['StructuredKeyStr'] is ",self.StructuredKeyStr)
				print('')

				#Take the first element of self.JoinedFilteredMergedRowedDictsTuplesList which corresponds to the Joined Model at this level	
				JoinedRowedDict=next(
						RowedDict for RowedDict in JoinedFilteredMergedRowedDictsList
						if SYS.getIsEqualBool(
							RowedDict[self.JoinedJoinedListKeyStr],
							JoinedJoinedList
						)
					)

				#debug
				'''
				print('JoinedRowedDict is ',JoinedRowedDict)
				print('')
				'''

				#Update
				self.update(JoinedRowedDict.items())
			
		else:

			#debug
			print('Joiner There are multiple retrieved states')
			if hasattr(self,'StructuredKeyStr'):
				print("self['StructuredKeyStr'] is ",self.StructuredKeyStr)
			print('self.RetrievedFilteredRowedDictsList is ')
			SYS._print(self.RetrievedFilteredRowedDictsList)
			print('')

			#Stop the recover
			self.IsRecoveringBool=False
コード例 #7
0
	def do_row(self):
		""""""
		
		#debug
		'''
		self.debug('We row here')
		'''

		#Check	
		if self.ModelDeriveControllerVariable!=None:
			
			#debug
			'''
			self.ModelDeriveControllerVariable.debug('ParentSpeaking...')
			'''

			#Check
			if self.ModelingMongoBool:

				#Update
				self.RowedMongoPickOrderedDict.update(
					zip(
						self.RowingKeyStrsList,
						self.ModelDeriveControllerVariable[Getter.GetMapStr](
							*self.ModelKeyStrsList
						).ItemizedMapValueVariablesList
					)
				)

				#debug
				'''
				self.debug(
					[
						('self.',self,[
										'RowedMongoPickOrderedDict',
										'TabledMongoCollection'
									]
						),
						'list(self.TabledMongoCollection.find()) is '+SYS._str(
							list(self.TabledMongoCollection.find()))
					]
				)
				'''

				#Check if it was already rowed
				self.RowedMongoIsBoolsList=map(
						lambda __Row:
						all(
							map(
									lambda __RowedItemTuple:
									SYS.getIsEqualBool(
														__Row[__RowedItemTuple[0]],
														__RowedItemTuple[1]
													),
									self.RowedMongoPickOrderedDict.items()
								)
						),
						self.TabledMongoCollection.find()
					)

				#debug
				'''
				self.debug(('self.',self,[
						'RowedMongoIsBoolsList'
					]))
				'''

				#set
				if len(self.RowedMongoIsBoolsList)==0:
					self.RowedMongoIsBool=False
				else:
					self.RowedMongoIsBool=any(self.RowedMongoIsBoolsList)

				#Init to the len of the table
				self.RowedMongoIndexInt=len(self.RowedMongoIsBoolsList)
				
				#debug
				'''
				self.debug(('self.',self,[
						'RowedMongoIndexInt',
						'RowedMongoIsBool'
					]))
				'''
				
				#But maybe find a last index
				if self.RowedMongoIsBool: 
					if len(self.RowedMongoIsBoolsList)>0:
						self.RowedMongoIndexInt=self.RowedMongoIsBoolsList.index(True)

				#debug
				'''
				self.debug(('self.',self,['RowedMongoIsBool','RowedMongoIndexInt']))
				'''

			#Check
			if self.ModelingHdfBool:

				#debug
				'''
				self.debug('This is a hdf row here')
				'''

				#/#################/#
				# Pick the values to be rowed in the hdf variables
				#

				#debug
				'''
				self.debug(
					('self.',self,[
						'RowingKeyStrsList',
						'RowHdfColumnStrsList'
						])
				)
				'''

				#Update
				self.RowedHdfPickOrderedDict.update(
					zip(
						self.RowHdfColumnStrsList,
						self.ModelDeriveControllerVariable[Getter.GetMapStr](
							*self.RowingKeyStrsList
						).ItemizedMapValueVariablesList
					)
				)

				#debug
				'''
				self.debug(
					[
						'Ok we have almost end the row',
						('self.',self,[
									'RowedHdfPickOrderedDict',
								]
						),
						'Check now if it is a new row'
					]
				)
				'''
				
				#/#################/#
				# Check if it is a new row
				#

				#Check if it was already rowed
				self.RowedHdfIsBoolsList=map(
						lambda __Row:
						all(
							map(
									lambda __RowedItemTuple:
									SYS.getIsEqualBool(
														__Row[__RowedItemTuple[0]],
														__RowedItemTuple[1]
													),
									self.RowedHdfPickOrderedDict.items()
								)
							),
						self.TabledHdfTable.iterrows()
					)

				#debug
				'''
				self.debug(
					[
						('self.',self,['RowedHdfIsBoolsList'])
					]
				)	
				'''

				#set
				if len(self.RowedHdfIsBoolsList)==0:
					self.RowedHdfIsBool=False
				else:
					self.RowedHdfIsBool=any(self.RowedHdfIsBoolsList)

				#Init to the len of the table
				self.RowedHdfIndexInt=self.TabledHdfTable.nrows

				#But maybe find a last index
				if self.RowedHdfIsBool: 
					if len(self.RowedHdfIsBoolsList)>0:
						self.RowedHdfIndexInt=self.RowedHdfIsBoolsList.index(True)

				#debug
				'''