예제 #1
0
	def do_status(self):

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

		#Check
		if self.StatusingProcessStr!="":

			#call
			self.StatusedSnapshotStr=self.process(
				"ps -ef | grep "+self.StatusingProcessStr
			).ProcessedBashStr

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

			#map
			if self.StatusingProcessStr=='Python':

				#filter
				self.StatusedLineStrsList=SYS._filter(
						lambda __LineStr:
						SYS.PythonPathStr in __LineStr,
						self.StatusedSnapshotStr.split('\n')
					)
			else:

				#split
				self.StatusedLineStrsList=self.StatusedSnapshotStr.split('\n')

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

					]
				)
			'''
			
			#filter
			self.StatusedLineStrsList=SYS._filter(
					lambda __StatusedLineStr:
					__StatusedLineStr!='',
					self.StatusedLineStrsList
				)

			#call
			self.StatusedIdStrsList=map(
				lambda __LineStr:
				__LineStr.split()[1],
				self.StatusedLineStrsList	
			)

			#debug
			'''
예제 #2
0
def status(_ProcessStr):

	#call
	SnapshotStr=self.process(
		"ps -ef | grep "+_ProcessStr
	).ProcessedBashStr

	#Debug
	'''
	print('Processer')
	print('SnapshotStr is '+SnapshotStr)
	print('')
	'''

	#map
	if _ProcessStr=='Python':

		#filter
		LineStrsList=SYS._filter(
				lambda __LineStr:
				SYS.PythonPathStr in __LineStr,
				SnapshotStr.split('\n')
			)
	else:

		#split
		LineStrsList=SnapshotStr.split('\n')

	#debug
	'''
	print('Processer')
	print('LineStrsList is ')
	print(LineStrsList)
	print('')
	'''
	
	#filter
	LineStrsList=SYS._filter(
			lambda __LineStr:
			__LineStr!='',
			LineStrsList
		)

	#call
	IdStrsList=map(
		lambda __LineStr:
		__LineStr.split()[1],
		LineStrsList	
	)

	#debug
	'''
	print('Processer')
	print('IdStrsList is ')
	print(IdStrsList)
	print('')
	'''

	return ' '.join(map(str,IdStrsList))
	def propertize(self,_Class):

		#debug
		'''
		print('Propertiser l.47 default method')
		print('_Class is ',_Class)
		print('')
		'''

		#Check
		if hasattr(_Class,"DefaultAttributeItemTuplesList"):

			#debug
			'''
			print('_Class.DefaultAttributeItemTuplesList is',_Class.DefaultAttributeItemTuplesList)
			print('')
			'''

			#set the PropertizedDefaultTuplesList
			_Class.PropertizedDefaultTuplesList=SYS._filter(
														lambda __DefaultSetTuple:
														type(__DefaultSetTuple[1]
															)==property or (
															hasattr(__DefaultSetTuple[1],'items'
																) and 'DefaultValueType' in __DefaultSetTuple[1
															] and __DefaultSetTuple[1
															]['DefaultValueType']==property),
														_Class.DefaultAttributeItemTuplesList
													)
    def propertize_setModelingDescriptionTuplesList(self, _SettingValueVariable):

        # set
        self._ModelingDescriptionTuplesList = _SettingValueVariable

        # /###################/#
        # Update the ModelKeyStrsList
        #

        # extend
        self._ModelKeyStrsList = SYS.unzip(_SettingValueVariable, [0])

        # debug
        """
		self.debug(
			[
				'We have binded ModelingDescriptionTuplesList to ModelKeyStrsList',
				('self.',self,['ModelingDescriptionTuplesList'])
			]
		)
		"""

        # /###################/#
        # Look for items where it is a get dimension
        #

        # filter
        self.ModelDimensionTuplesList = map(
            lambda __DescriptionTuple: (__DescriptionTuple[0], __DescriptionTuple[2]),
            SYS._filter(lambda __DescriptionTuple: type(__DescriptionTuple[2]) in [list, tuple], _SettingValueVariable),
        )

        # debug
        """
예제 #5
0
	def do_pool(self):

		#debug
		self.debug(('self.',self,[
									'PoolingSubsetLengthInt',
									'PoolingSetLengthInt'
								]))

		#Combine
		self.PooledIntsListsList=list(
			itertools.combinations(
				xrange(self.PoolingSetLengthInt),
				self.PoolingSubsetLengthInt
			)
		)
		
		#debug
		'''
		self.debug(('self.',self,['PooledIntsListsList']))
		'''

		#filter only the one with the pitch 0
		self.PooledIntsListsList=SYS._filter(
			lambda __PooledInt:
			__PooledInt[0]==0,
			self.PooledIntsListsList
		)
예제 #6
0
def getDatabasedColWithGetKeyStr(_GetKeyStr):

    # import
    import tables

    # Definition
    global AnalyzingColStrsList

    # Definition
    DatabasedColStr = SYS._filter(
        lambda __AnalyzingColStr: _GetKeyStr.endswith(__AnalyzingColStr), AnalyzingColStrsList
    )[0]

    # Debug
    """
	print('l 55 getDatabasedColWithGetKeyStr')
	print('DatabasedColStr is ')
	print(DatabasedColStr)
	print('')
	"""

    # Get the Col Class
    if DatabasedColStr == "Str":
        DatabasedColClass = getattr(tables, "StringCol")
    else:
        DatabasedColClass = getattr(tables, DatabasedColStr + "Col")

        # Return
    if DatabasedColStr == "Str":
        return DatabasedColClass(100)
    else:
        return DatabasedColClass()
예제 #7
0
	def propertize_setModelingDescriptionTuplesList(self,_SettingValueVariable):

		#set
		BaseClass.propertize_setModelingDescriptionTuplesList(self,_SettingValueVariable)

		#filter
		self.ShapingDimensionTuplesList=map(
			lambda __DescriptionTuple:
			(__DescriptionTuple[0], __DescriptionTuple[2]),
			SYS._filter(
				lambda __DescriptionTuple:
				type(__DescriptionTuple[2]) in [list,tuple],
				_SettingValueVariable
			)
		)

		#debug
		'''
예제 #8
0
	def do_attest(self):

		#set the TestedFolderPathStr
		if self.AttestingFolderPathStr=="":

			#In the gl
			self.AttestingFolderPathStr=SYS.PythonlogyLocalFolderPathStr+self.DoClass.__module__.replace(
				'.','/')+'/Attests/'

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

		#set the AttestedMethodStrsList
		self.AttestedMethodStrsList=SYS._filter(
				lambda __AttributeKeyStr:
				__AttributeKeyStr.startswith(AttestingPrefixStr),
				dir(self.DoClass)
			)

		#set
		self.AttestedUnboundMethodsList=map(
			lambda __AttestedMethodStr:
			getattr(self.DoClass,__AttestedMethodStr),
			self.AttestedMethodStrsList
		)

		#debug
		'''
		print('self.AttestedMethodStrsList is '+str(self.AttestedMethodStrsList))
		print('')
		'''

		#set
		if hasattr(self.DoClass,'setAttest')==False:
			setattr(
				self.DoClass,
				setAttest.__name__,
				setAttest
			)
def getModeledColWithGetKeyStr(_GetKeyStr):

	#import
	import tables

	#Definition
	global AnalyzingColStrsList

	#Definition
	ModeledColStr=SYS._filter(
		lambda __AnalyzingColStr:
			_GetKeyStr.endswith(__AnalyzingColStr),
			AnalyzingColStrsList
		)[0]

	#Debug
	'''
	print('l 55 getModeledColWithGetKeyStr')
	print('ModeledColStr is ')
	print(ModeledColStr)
	print('')
	'''

	#Get the Col Class
	if ModeledColStr=='Str':
		ModeledColClass=getattr(
							tables,
							'StringCol'
						)
	else:
		ModeledColClass=getattr(
							tables,
							ModeledColStr+'Col'
						)

	#Return
	if ModeledColStr=='Str':
		return ModeledColClass(100)
	else:
		return ModeledColClass() 
	def __call__(self,_Class):

		#debug
		'''
		print('Defaultor l.31 __call__ method')
		print('_Class is ',_Class)
		print('')
		'''

		#Call the parent init method
		BaseClass.__call__(self,_Class)

		#debug
		'''
		print('Defaultor l.47 look for an __init__ method')
		print('_Class is ',_Class)
		print('')
		'''

		#Check
		if hasattr(_Class,"__init__"):

			#debug
			'''
			print('It has an __init__ method')
			print('')
			'''

			#get
			InitWrapUnboundMethod=getattr(_Class,DefaultWrapMethodStr) if hasattr(_Class,DefaultWrapMethodStr) else DefaultInitFunction

			#set the DefaultDict
			_Class.InitInspectDict=SYS.InspectDict(InitWrapUnboundMethod)

			#Definition the DefaultAttributeItemTuplesList
			DefaultAttributeItemTuplesList=map(
					lambda __DefaultSetItemTuple:
					(
						DefaultPrefixStr.join(
						__DefaultSetItemTuple[0].split(DefaultPrefixStr)[1:]
						),
						getDefaultedValueVariableWithSetVariable(
								__DefaultSetItemTuple[1]
							)
					),
					SYS._filter(
								lambda __DefaultItemTuple:
								__DefaultItemTuple[0].startswith(DefaultPrefixStr),
								_Class.InitInspectDict['DefaultOrderedDict'].items()
							)
			)

			#set
			_Class.DefaultAttributeVariablesOrderedDict=collections.OrderedDict(
					DefaultAttributeItemTuplesList
				)

			#debug
			'''
			print('_Class.DefaultAttributeItemTuplesList is ',_Class.DefaultAttributeItemTuplesList)
			print('')
			'''

			#set at the level of the class
			map(	
					lambda __DefaultSetItemTuple:
					setattr(_Class,*__DefaultSetItemTuple),
					_Class.DefaultAttributeVariablesOrderedDict.items()
				)

			#set the DefaultSpecificKeyStrsList
			_Class.DefaultSpecificKeyStrsList=_Class.DefaultAttributeVariablesOrderedDict.keys()

			#Get the BaseKeyStrsList
			_Class.DefaultBaseKeyStrsList=list(
								SYS.collect(
											_Class,
											'__bases__',
											'DefaultSpecificKeyStrsList'
								)
			)
			
			#Debug
			'''
			print("l 269 Defaultor")
			print("DefaultDecorationMethodStr is ",DefaultDecorationMethodStr)
			print("")
			'''

			#Define the decorated function
			InitExecStr="def "+DefaultDecorationMethodStr+"(_InstanceVariable,"
			InitExecStr+="*_LiargVariablesList,"
			InitExecStr+="**_KwargVariablesDict):\n\t"
			InitExecStr+="initDefault(_InstanceVariable,"
			InitExecStr+="*_LiargVariablesList,"
			InitExecStr+="**dict(_KwargVariablesDict,**{'DefaultWrapMethodStr':'"+DefaultWrapMethodStr+"','DefaultClassStr':'"+_Class.__name__+"'}))\n"
		
			#debug
			'''
			print('Defaultor l 280')
			print('InitExecStr is ')
			print(InitExecStr)
			print('')
			'''
			
			#exec
			six.exec_(InitExecStr)

			#set with the specific name
			setattr(
						_Class,
						DefaultDecorationMethodStr,
						locals()[DefaultDecorationMethodStr]
					)

			#set with the DoMethodStr shortcut
			setattr(
						_Class,
						"__init__",
						locals()[DefaultDecorationMethodStr]
					)

			#set in the class fi not already 
			if hasattr(_Class,'setDefault')==False:

				#set setDefault
				setattr(
							_Class,
							setDefault.__name__,
							setDefault
						)
				
				#set setDefaultMutable
				setattr(
							_Class,
							setDefaultMutable.__name__,
							setDefaultMutable
						)

			#Add to the KeyStrsList
			_Class.KeyStrsList+=[
										#'DefaultAttributeItemTuplesList',
										'DefaultAttributeVariablesOrderedDict',
										'InitInspectDict',
										'DefaultBaseKeyStrsList',
										'DefaultSpecificKeyStrsList'
								]
		#Return 
		return _Class
def setDefault(
	_InstanceVariable,
	_ClassVariable,
	_AttributeKeyVariable=None,
	**_KwargVariablesDict
):
	
	#/#################/#
	# Get all the default classes
	#

	#get
	DefaultClassesList=SYS.GetList(_ClassVariable,SYS)

	#Debug
	print('setDefault l 168')
	print('DefaultClassesList is ')
	print(DefaultClassesList)
	print('')

	#/#################/#
	# Get all the attribute to default set again and filter 
	# the ones that have not the right
	#

	#Check
	if _AttributeKeyVariable==None:
		AttributeKeyStrsList=SYS.sum(
			map(
				lambda __DefaultClass:
				__DefaultClass.DefaultSpecificKeyStrsList,
				DefaultClassesList
			)
		)
	elif type(_AttributeKeyVariable)!=list:
		AttributeKeyStrsList=[_AttributeKeyVariable]
	else:
		AttributeKeyStrsList=_AttributeKeyVariable

	#Check
	if 'DefaultNotSetTagStrsList' in _KwargVariablesDict:

		#filter
		AttributeKeyStrsList=SYS._filter(
				lambda __AttributeKeyStr:
				__AttributeKeyStr not in _KwargVariablesDict['DefaultNotSetTagStrsList'],
				AttributeKeyStrsList
			)
		
	#Debug
	print('Defaultor l 194')
	print('AttributeKeyStrsList is ')
	print(AttributeKeyStrsList)
	print('')

	#map a set for all the class attributes into the instance
	map(
			lambda __AttributeKeyStr:
			_InstanceVariable.__setattr__
			(
				__AttributeKeyStr,
				getattr(
						_InstanceVariable.__class__,
						__AttributeKeyStr
					)
			),
			AttributeKeyStrsList
		)

	#set
	'''
	setDefaultMutable(
		_InstanceVariable,
		DefaultClassesList,
		AttributeKeyStrsList
	)
	'''

	#return 
	return _InstanceVariable
예제 #12
0
		DoClass.DoneNotAttributesOrderedDict=collections.OrderedDict()

		#Check
		if hasattr(DoClass,'DefaultAttributeItemTuplesList'):
			
			#Debug
			'''
			print('Doer l.383')
			print('DoClass.DefaultAttributeItemTuplesList is ',_Class.DefaultAttributeItemTuplesList)
			print('')
			'''

			#Check for doing and done keyStrs
			DoClass.DoneAttributeVariablesOrderedDict=collections.OrderedDict(SYS._filter(
													lambda __DefaultAttributeTuple:
													__DefaultAttributeTuple[0].startswith(DoneStr),
													DoClass.DefaultAttributeItemTuplesList
												))
			DoClass.DoingAttributeVariablesOrderedDict=collections.OrderedDict(SYS._filter(
													lambda __DefaultAttributeTuple:
													__DefaultAttributeTuple[0].startswith(DoingStr),
													DoClass.DefaultAttributeItemTuplesList
												))

			#Definition
			DoMethodKeyStr=DoingDoMethodStr+DoMethodStr

			#Debug
			'''
			print('Doer l.401')
			print('DoClass.DoneAttributeVariablesOrderedDict is ',DoClass.DoneAttributeVariablesOrderedDict)
예제 #13
0
	def do_insert(self,**_KwargVariablesDict):
		""" """

		#/################/#
		# Check the row before
		#

		#debug
		'''
		self.debug(
			[
				'row maybe before...',
				'self.getSwitch(\'row\') is',
				SYS.indent(self.getSwitch('row'))
			]
		)
		'''
		
		#reset
		self.setDone(Rower.RowerClass)

		#row first
		self.row()

		#debug
		'''
		self.debug(
			[
				('self.',self,[
					'InsertedMongoNotRowPickOrderedDict',
					'InsertedHdfNotRowPickOrderedDict'
				])
			]
		)
		'''

		#/###################/#
		# set
		# 

		#Bind 
		self.InsertedNotRowKeyStrsList=set(self.ModelKeyStrsList
			)-set(
				self.RowingKeyStrsList
			)

		#Check
		if self.ModelMongoBool:

			#/#################/#
			# Check if the row is unique
			#

			#Debug
			'''
			self.debug(
				[
					'We are mongo insert here',
					('self.',self,[
						'RowedMongoIsBoolsList'
						]),
					'self.ModeledMongoCollection.find().count() is '+str(
						self.ModeledMongoCollection.find().count()),
					'len(self.RowedMongoIsBoolsList) is '+str(len(self.RowedMongoIsBoolsList))
				]
			)
			'''
			
			#Append and row if it is new
			if self.RowedMongoIsBool==False and self.ModeledMongoCollection.find(
				).count()==len(self.RowedMongoIsBoolsList):

				#Check
				if self.ModeledMongoCollection!=None:

					#debug
					'''
					self.debug(
						[
							'This is a new collection row',
							('self.',self,[
										'RowingKeyStrsList',
										'InsertedNotRowKeyStrsList'
									]),
							'Before update',
							('self.',self,['InsertedMongoNotRowPickOrderedDict'])
						]
					)
					'''

					#Pick and update				
					self.InsertedMongoNotRowPickOrderedDict.update(
						zip(
								self.InsertedNotRowKeyStrsList,
								#self.ModeledParentControllerDeriveModelerVariable[
								#	Getter.GetMapStr
								#](
								#	*self.InsertedNotRowKeyStrsList
								#).ItemizedMapValueVariablesList
								self.ModeledParentControllerDeriveModelerVariable.mapGet(
									self.InsertedNotRowKeyStrsList
								)
							)
					)

					#debug
					'''
					self.debug(
						[
							'After update',
							('self.',self,['InsertedMongoNotRowPickOrderedDict'])
						]
					)
					'''
					
					#Definition the InsertedItemTuplesList
					self.InsertedItemTuplesList=[
											('RowInt',self.RowedMongoIndexInt)
										]+self.RowedMongoPickOrderedDict.items(
					)+self.InsertedMongoNotRowPickOrderedDict.items()

					#debug
					'''
					self.debug(
							('self.',self,[
									'InsertedItemTuplesList',
									'ModeledMongoCollection'
								])
						)
					'''

					#insert
					self.ModeledMongoCollection.insert(
						dict(self.InsertedItemTuplesList)
					)

					#Define
					InsertedCursor=self.ModeledMongoCollection.find()

					#debug
					'''
					self.debug('list(InsertedCursor) is '+SYS._str(list(InsertedCursor)))
					'''

		#Check
		if self.ModelHdfBool:

			#map
			self.InsertedNotRowColumnStrsList=map(
				lambda __NotRowKeyStr:
				self.RowKeyStrToColumnStrOrderedDict[__NotRowKeyStr],
				self.InsertedNotRowKeyStrsList
			)

			#/#################/#
			# Check if the row is unique
			#

			#Debug
			'''
			self.debug(
				[
					'We are hdf insert here',
					('self.',self,[
						'RowedHdfIsBool'
						]),
					'len(self.RowedHdfIsBoolsList) is '+str(len(self.RowedHdfIsBoolsList)),
					'self.ModeledHdfTable.nrows is '+str(self.ModeledHdfTable.nrows)
				]
			)
			'''

			#Append and row if it is new
			if self.RowedHdfIsBool==False and len(
				self.RowedHdfIsBoolsList)==self.ModeledHdfTable.nrows:

				#Check
				if self.ModeledHdfTable!=None:

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

					#Get the row
					Row=None
					Row=self.ModeledHdfTable.row

					#debug
					'''
					self.debug(
						[
							'We pick in the controller the values',
							('self.',self,[
								'InsertedNotRowKeyStrsList'
							])
						]
					)
					'''

					#Pick and update				
					self.InsertedHdfNotRowPickOrderedDict.update(
						zip(
								self.InsertedNotRowKeyStrsList,
								self.ModeledParentControllerDeriveModelerVariable[
									Getter.GetMapStr
								](
									*self.InsertedNotRowKeyStrsList
									).ItemizedMapValueVariablesList
							)
					)

					#debug
					'''
					self.debug(
						[
							'We prepare the InsertedItemTuplesList',
							('self.',self,[
											'RowedHdfPickOrderedDict',
											'InsertedHdfNotRowPickOrderedDict'
										])
						]
					)
					'''

					#Definition the InsertedItemTuplesList
					self.InsertedItemTuplesList=[
											('RowInt',self.RowedHdfIndexInt)
										]+self.RowedHdfPickOrderedDict.items(
					)+self.InsertedHdfNotRowPickOrderedDict.items()
							
					#debug
					'''
					self.debug(
						[
							'This is a new hdf row',
							('self.',self,['InsertedItemTuplesList'])
							#'Colnames are : '+str(self.ModeledHdfTable.colnames),
							#'self.ModeledHdfTable is '+str(dir(self.ModeledHdfTable)),
							#'self.ModeledDescriptionClass is '+(str(self.ModeledDescriptionClass.columns) if hasattr(self.ModeledDescriptionClass,'columns') else ""),
							#'Row is '+str(dir(Row)),
							#'Row.table is '+str(Row.table),
							#'TabularedHdfTablesOrderedDict is '+str(self.TabularedHdfTablesOrderedDict)
						]
					)
					'''
					
					#/###################/#
					# Watch... The list or arrays needs to be at least one dimension
					#

					#debug
					'''
					self.debug(
						[
							'We filter the items that have null size...',
							('self.',self,['InsertedItemTuplesList'])
						]
					)
					'''

					#filter
					self.InsertedItemTuplesList=SYS._filter(
						lambda __InsertedItemTuple:
						hasattr(
							__InsertedItemTuple[1],
							'__len__'
						)==False or len(__InsertedItemTuple[1])!=0,
						self.InsertedItemTuplesList
					)

					try:

						#debug
						'''
						self.debug(
								[
									'Ok now we try to append in the rows',
									('self.',self,['InsertedItemTuplesList'])
								]
							)
						'''

						#set
						map(
								lambda __InsertingTuple:
								Row.__setitem__(*__InsertingTuple),
								self.InsertedItemTuplesList
							)

						#debug
						'''
						self.debug(
								[
									'It has worked !'
								]
							)
						'''

					except ValueError:

						#debug
						'''
						self.debug(
								[
									'It hasn\'t worked !',
									'Check if we have already tried to change the shapes',
									('self.',self,['InsertedErrorBool'])
								]
							)
						'''

						#Check
						if self.InsertedErrorBool==False:

							#debug
							'''
							self.debug(
									[
										'First try to change shapes !',
										'so find the shape that was not good'
									]
								)
							'''

							#set
							self.InsertedErrorBool=True

							#/###################/#
							# Then find where the shape was not good
							#

							#Definition the InsertedOldDimensionIntsListsList
							InsertedOldDimensionIntsList=map(
									lambda __ModeledDescriptionDimensionGetKeyStrsList:
									self.ModeledParentControllerDeriveModelerVariable[Getter.GetMapStr](
										__ModeledDescriptionDimensionGetKeyStrsList
									).ItemizedMapValueVariablesList,
									self.ModeledDescriptionDimensionGetKeyStrsListsList
								)

							#import numpy
							import numpy as np

							#Definition the InsertedNewDimensionIntsListsList
							InsertedNewDimensionIntsListsList=map(
								lambda __ModeledDescriptionGetKeyStr:
								list(
										np.shape(
											self.ModeledParentControllerDeriveModelerVariable[
												__ModeledDescriptionGetKeyStr
											]
										)
								),
								self.ModeledDescriptionGetKeyStrsList
							)

							#debug
							'''
							self.debug(
								[
									('vars ',vars(),
											[
												'InsertedOldDimensionIntsList',
												'InsertedNewDimensionIntsListsList'
											]),
									('self.',self,[
											'ModeledDescriptionDimensionGetKeyStrsListsList'
										])
								]
							)
							'''

							#set the shaping attributes to their new values
							map(
									lambda __ModeledDescriptionDimensionGetKeyStrsList,__InsertedOldDimensionList,__InsertedNewDimensionList:
									self.ModeledParentControllerDeriveModelerVariable[
											Setter.SetMapStr
										](
										zip(
											__ModeledDescriptionDimensionGetKeyStrsList,
											__InsertedNewDimensionList
											)
									) if __InsertedNewDimensionList!=__InsertedOldDimensionList
									else None,
									self.ModeledDescriptionDimensionGetKeyStrsListsList,
									InsertedOldDimensionIntsList,
									InsertedNewDimensionIntsListsList
								)

							#debug
							'''
							self.debug(
									[
										'Ok we have updated the shaping variables'
									]
								)
							'''

							#/###################/#
							# Reset the configurating methods
							#

							#debug
							'''
							self.debug(
									[
										'Refind the original ModelingDescriptionTuplesList',
										('self.',self,[
											'ModelingDescriptionTuplesList',
											'ModelDescriptionTuplesList'
										])
									]
								)
							'''

							#Keep the old ModelDescription
							self.ModelingDescriptionTuplesList=copy.copy(
								self.ModelDescriptionTuplesList
							)

							#switch model
							self.setSwitch('model')

							#setDone
							self.setDone(
								[
									Modeler.ModelerClass,
								]
							)
							
							#debug
							'''
							self.debug(
									[
										'Now we remodel...',
										('self.',self,[
											'WatchBeforeModelWithModelerBool',
											'ModelingDescriptionTuplesList'
										])
									]
								)
							'''

							#model to relaunch everything
							self.model()

							#debug
							'''
							self.debug(
									[
										'Now we have remodeled...',
										('self.',self,[
											'ModelingDescriptionTuplesList'
										])
									]
								)
							'''

							#/###################/#
							# insert again
							#

							#debug
							'''
							self.debug(
								[
									'Ok model again is done, so now we insert'
								]
							)
							'''

							#switch row
							self.setSwitch('row')

							#insert 
							self.MroClassesDict['InserterClass'].insert(self)

							#debug
							'''
							self.debug(
								[
									'Cool it seems that insert worked now'
								]
							)
							'''
							
							#set
							self.InsertedErrorBool=False

						#Check
						else:

							#debug
							self.debug(
								[	
									'Nope definitely that is not working...'
								]
							)

					#/###################/#
					# Finish with append and flush
					#

					#debug
					'''
					self.debug('The Row setting was good, so append insert')
					'''

					#Append and Insert
					Row.append()
				
					#flush
					self.ModeledHdfTable.flush()

			else:

				#debug
				'''
				self.debug(
							[
								'This is maybe not an IdentifyingInserter',
								'Or it is already rowed',
								'self.InsertedIsBoolsList is '+str(self.InsertedIsBoolsList)
							]
						)
				'''
				pass

		#/################/#
		# setSwitch row
		#
		
		#debug
		'''
		self.debug(
			[
				'Before to leave we setSwitch row again'
			]
		)
		'''

		#setSwitch row
		self.setSwitch('row')

		#debug
		'''
    def getModelColVariableWithKeyStr(self, _KeyStr):

        # import
        import tables

        # Definition
        global ModelOneColStrsList, ModelListColStrsList, ModelArrayColStrsList

        # /##################/#
        # Look for one single type
        #

        # Definition
        List = SYS._filter(lambda __ModelOneColStr: _KeyStr.endswith(__ModelOneColStr), ModelOneColStrsList)

        # Check
        if len(List) == 1:

            # Get
            ModelOneColStr = List[0]

            # Debug
            """
			print('l 55 getModelColVariableWithKeyStr')
			print('ModeledColStr is ')
			print(ModeledColStr)
			print('')
			"""

            # Get the Col Class
            if ModelOneColStr == "Str":
                ModelColClass = getattr(tables, "StringCol")
            else:
                ModelColClass = getattr(tables, ModelOneColStr + "Col")

                # Return
            if ModelOneColStr == "Str":
                return ModelColClass(100)
            else:
                return ModelColClass()

        else:

            # /##################/#
            # Look for a shaped type
            #

            # Check
            for __TypeStr in ["List", "Array"]:

                # Definition
                ModeledEndBoolsList = map(
                    lambda __ModelListColStr: _KeyStr.endswith(__ModelListColStr),
                    globals()["Model" + __TypeStr + "ColStrsList"],
                )

                # Check
                if True in ModeledEndBoolsList:

                    # /####################/#
                    # Get the type
                    #

                    # get
                    ModelOneColStr = ModelOneColStrsList[ModeledEndBoolsList.index(True)]

                    # debug
                    """
					self.debug(
						[
							'ModelOneColStr is ',
							ModelOneColStr
						]
					)
					"""

                    # Get the Col Class
                    if ModelOneColStr == "Str":
                        ModelColClass = getattr(tables, "StringCol")
                    else:
                        ModelColClass = getattr(tables, ModelOneColStr + "Col")

                        # /####################/#
                        # Look if there is no a shape
                        #

                        # Check
                    if _KeyStr in self.__class__.DefaultAttributeVariablesOrderedDict:

                        # get
                        ClassValueVariable = self.__class__.DefaultAttributeVariablesOrderedDict[_KeyStr]

                        # debug
                        """
						self.debug(
							[
								'There is a shape ',
								"ClassValueVariable['ShapeKeyStrsList'] is ",
								str(ClassValueVariable['ShapeKeyStrsList'])
							]
						)
						"""

                        # Check
                        if hasattr(ClassValueVariable, "items") and "ShapeKeyStrsList" in ClassValueVariable:

                            # return
                            return (ModelColClass, ClassValueVariable["ShapeKeyStrsList"])

                            # Return
                    if ModelOneColStr == "Str":
                        return ModelColClass(100, shape=(1))
                    else:
                        return ModelColClass(shape=(1))
	def do_figure(self):	
		
		#/###################/#
		# First we get the children figurers and check what they are
		#

		#debug
		self.debug(
				[
					'We figure here',
					#('self.',self,['ViewFirstDeriveViewerVariable'])
					'self.TeamDict.keys() is ',
					str(self.TeamDict.keys())
				]
			)

		#filter
		FiguredTeamTagStrsList=SYS._filter(
			lambda __KeyStr:
			__KeyStr in ['Panels','Axes','Plots'],
			self.TeamDict.keys()
		)

		#Check
		if len(FiguredTeamTagStrsList)==1:

			#filter
			self.FiguredTeamTagStr=FiguredTeamTagStrsList[0]

			#get
			self.FiguredDeriveTeamerVariablesList=self.TeamDict[
				self.FiguredTeamTagStr
			].ManagementDict.values()
		
		#debug
		'''
		self.debug(
				[
					('self.',self,[
							'FiguredTeamTagStr',
							#'FiguredDeriveTeamerVariablesList'
						])
				]
			)
		'''

		#/###################/#
		# do something before descending a figure call
		#

		if self.FiguredTeamTagStr=='Panels':

			#debug
			'''
			self.debug(
					[
						'I am the top figurer...'
					]
				)
			'''

		elif self.FiguredTeamTagStr=='Axes' or self.ParentDeriveTeamerVariable.TeamTagStr=='Panels':

			#/###############/#
			# Add an axe for the symbol of the panel
			#

			#debug
			'''
			self.debug(
					[
						'We transform the team dict Axes to add a panel axe',
						'self.TeamDict[\'Axes\'] is ',
						SYS._str(self.TeamDict['Axes'])
					]
				)
			'''

			#team
			self.team('Axes')

			#debug
			'''
			self.debug(
					[
						'before setting',
						'self.TeamedValueVariable.ManagementDict is ',
						SYS._str(self.TeamedValueVariable.ManagementDict),
						'Manager.ManagementDict is ',
						str(Manager.ManagementDict)
					]
				)
			'''

			#map an add
			map(
				lambda __DeriveFigurer:
				setattr(
					__DeriveFigurer,
					'ManagementIndexInt',
					__DeriveFigurer.ManagementIndexInt+1
				),
				self.TeamedValueVariable.ManagementDict.values()
			)

			#update
			self.TeamedValueVariable.ManagementDict=Manager.ManagementDict(
				[
					(
						'Panel',SYS.FigurerClass(
							**{

								'ManagementTagStr':'Panel',
								'ManagementIndexInt':0,
								'ParentDeriveTeamerVariable':self.TeamedValueVariable,
								'ViewFirstDeriveViewerVariable':self.ViewFirstDeriveViewerVariable,
								'FigurePyplotVariable':self.FigurePyplotVariable,
								'FiguringShapeIntsTuple':(1,1),
								'FiguringDrawVariable':{
									'#axes':
									{
										'set_axis_off':[],
										#'text':'$\\textbf{'+self.ManagementTagStr+'}$'
									}
								},
								'FiguredPanelDeriveTeamerVariable':self,
							}
						)
					)
				],
				**self.TeamedValueVariable.ManagementDict
			)

			#debug
			'''
			self.debug(
					[
						'after setting',
						'self.TeamedValueVariable.ManagementDict is ',
						SYS._str(self.TeamedValueVariable.ManagementDict)
					]
				)
			'''

			#Add maybe a shift in the next figure
			if len(self.TeamedValueVariable.ManagementDict)>1:

				#debug
				'''
				self.debug(
						[
							'We add a shift down and right to the next figure',
							'self.TeamedValueVariable.ManagementDict.get(1) is',
							SYS._str(self.TeamedValueVariable.ManagementDict.get(1))
						]
					)
				'''

				#set
				self.TeamedValueVariable.ManagementDict.get(1).FiguringShiftIntsTuple=(1,1)

			#/##################/#
			# There are some Axes to count
			#

			#map get
			self.FiguredShiftTuplesList=map(
					lambda __DeriveFigurer:
					(
						__DeriveFigurer.FiguringShapeIntsTuple,
						__DeriveFigurer.FiguringShiftIntsTuple
					),
					self.TeamDict['Axes'].ManagementDict.values()
				)

			#debug
			'''
			self.debug(
					[
						'I am a still Panel...',
						('self.',self,[
							'FiguredShiftTuplesList',
							'ManagementIndexInt'
						])
					]
				)
			'''

			#/###############/#
			# Determine what is the anchor considering the one of the last panel
			#

			#Check
			if self.ManagementIndexInt>0:

				#debug
				'''
				self.debug(
					[
						'We get the previous Panel',
						'self.ParentDeriveTeamerVariable.ManagementDict is ',
						SYS._str(self.ParentDeriveTeamerVariable.ManagementDict)
					]
				)
				'''

				#get the previous
				FiguredPreviousPanelFigurer=self.ParentDeriveTeamerVariable.ManagementDict.get(
					self.ManagementIndexInt-1
				)

				#debug
				'''
				self.debug(
						[
							'We look for the previous panel...',
							#('FiguredPreviousPanelFigurer.',FiguredPreviousPanelFigurer,[
							#		'FiguredAnchorIntsList',
							#		'FiguredPanelShapeIntsList'
							#	]
							#)
						]
					)
				'''

				#Check
				if self.FiguringShiftIntsTuple[0]>0:

					#add
					self.FiguredAnchorIntsList[0]=FiguredPreviousPanelFigurer.FiguredAnchorIntsList[0
							]+self.FiguringShiftIntsTuple[0]+FiguredPreviousPanelFigurer.FiguredPanelShapeIntsList[0]+1

				if self.FiguringShiftIntsTuple[1]>0:

					#add
					self.FiguredAnchorIntsList[1]=FiguredPreviousPanelFigurer.FiguredAnchorIntsList[1
							]+self.FiguringShiftIntsTuple[1]+FiguredPreviousPanelFigurer.FiguredPanelShapeIntsList[1]+1

				#debug
				self.debug(
						[
							'we have setted the new anchor',
							('self.',self,['FiguredAnchorIntsList'])
						]
					)

			#/###############/#
			# Init the Cursor for after
			#

			#init
			self.FiguredCursorIntsList=copy.copy(self.FiguredAnchorIntsList)


			#/###############/#
			# Look maybe at a Panel without Axes and Plots
			#

			#Check
			if len(self.TeamDict['Axes']==1):

				#debug
				'''
				self.debug(
						[
							'I am a Panel without Axes and Plots',
							'So we just set an axe here'
						]
					)
				'''

				#set
				self.setAxes()

				#/###################/#
				# if there axes setted then apply the draw set variable 
				#

				#Check
				if self.FiguredAxesVariable!=None:

					#debug
					'''
					self.debug(
							[
								'There are axes so command the figuring draw variable',
								('self.',self,[
									'FiguringDrawVariable'
								])
							]
						)
					'''

					#commad self
					#self.command(self,self.FiguringDrawVariable)
					#self.command(self,[])
					self['#map@set'](self.FiguringDrawVariable)

				#return
				return

		elif self.FiguredTeamTagStr=='Plots':

			#debug
			'''
			self.debug(
					[
						'I am an Axes..',
						('self.',self,['ParentDeriveTeamerVariable'])
					]
				)
			'''

			#get the parent panel
			self.FiguredPanelDeriveTeamerVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

			#debug
			'''
			self.debug(
					[
						'I am still an Axes..',
						('self.',self,[
							'FiguredPanelDeriveTeamerVariable',
							#'ViewFirstDeriveViewerVariable',
							'FiguredAnchorIntsList',
							'FiguringShapeIntsTuple'
						])
					]
				)
			'''

			#alias
			self.FiguringGridIntsTuple=self.ViewFirstDeriveViewerVariable.FiguringGridIntsTuple
			self.setAxes()

			#debug
			'''
			self.debug(
					[
						'I am still an Axes..',
						('self.',self,['FiguredAxesVariable'])
					]
				)
			'''

		else:

			#debug
			'''
			self.debug(
					[
						'I dont have such panels axes plots...',
						'So I can be a plot or the top one axe one plot figurer'
					]
				)
			'''

			#Check
			if self!=self.ViewFirstDeriveViewerVariable:

				#get
				FiguredParentParentVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

				#debug
				'''
				self.debug(
					[
						'FiguredParentParentVariable.ParentDeriveTeamerVariable.TeamTagStr is ',
						FiguredParentParentVariable.ParentDeriveTeamerVariable.TeamTagStr,
						'FiguredParentParentVariable is ',
						SYS._str(FiguredParentParentVariable)
					]
				)
				'''

				#Check
				if FiguredParentParentVariable.ParentDeriveTeamerVariable.TeamTagStr=='Views':

					#/###################/#
					# build a FiguredAxesVariables
					#

					#debug
					'''
					self.debug(
							[
								'I am a panel without Axes and Plots so just set an axis here...',
							]
						)
					'''

					#alias
					self.FiguringGridIntsTuple=self.ViewFirstDeriveViewerVariable.FiguringGridIntsTuple

					#set
					self.setAxes()

				#Check
				elif FiguredParentParentVariable.ParentDeriveTeamerVariable.TeamTagStr=='Panels':

					#alias
					self.FiguredPanelDeriveTeamerVariable=FiguredParentParentVariable

					#/###################/#
					# build a FiguredAxesVariables
					#

					#debug
					'''
					self.debug(
							[
								'I am an axes without Plots so just set an axis here...',
							]
						)
					'''

					#alias
					self.FiguringGridIntsTuple=self.ViewFirstDeriveViewerVariable.FiguringGridIntsTuple
					self.FiguredAnchorIntsList=self.FiguredPanelDeriveTeamerVariable.FiguredCursorIntsList

					#set
					self.setAxes()

				else:

					#/###################/#
					# point to the FiguredAxesVariable
					#

					#debug
					self.debug(
							[
								'I am Plot..',
								'I set my FiguredAxesVariables corresponding to my parent one',
								#'FiguredParentParentVariable is ',
								#SYS._str(FiguredParentParentVariable),
								'FiguredParentParentVariable.ManagementTagStr is ',
								FiguredParentParentVariable.ManagementTagStr,
								'FiguredParentParentVariable.FiguredAxesVariable is ',
								FiguredParentParentVariable.FiguredAxesVariable,
							]
						)

					#get the parent panel
					self.FiguredAxesDeriveTeamerVariable=FiguredParentParentVariable

					#get the one of the parent
					self.FiguredAxesVariable=self.FiguredAxesDeriveTeamerVariable.FiguredAxesVariable

				#debug
				self.debug(
						[
							'I have definitely an axes..',
							('self.',self,['FiguredAxesVariable'])
						]
					)

				#/###################/#
				# if there axes setted then apply the draw set variable 
				#

				#Check
				if self.FiguredAxesVariable!=None:

					#debug
					'''
					self.debug(
							[
								'There are axes so command the figuring draw variable',
								('self.',self,[
									'FiguringDrawVariable'
								])
							]
						)
					'''

					#commad self
					#self.command(self,self.FiguringDrawVariable)
					#self.command(self,[])
					self['#map@set'](self.FiguringDrawVariable)

				#/###################/#
				# if it is the last then trigger the axes to set also
				#

				#Check
				if self.ManagementIndexInt==(len(self.ParentDeriveTeamerVariable.ManagementDict)-1):

					#debug
					'''
					self.debug(
						[
							'I am the last plot of this axes !',
							'Lets the axes setting itself now',
							('self.FiguredAxesDeriveTeamerVariable',
								self.FiguredAxesDeriveTeamerVariable,
								['FiguringDrawVariable'])
						]
					)
					'''

					#commad self
					self.FiguredAxesDeriveTeamerVariable['#map@set'](
						self.FiguredAxesDeriveTeamerVariable.FiguringDrawVariable
					)


			else:

				#debug
				self.debug(
						[
							'I am the top figurer but with just one axes..',
							('self.',self,['FiguringGridIntsTuple'])
						]
					)

				#Set the size of the grid to this just one plot
				self.FiguringGridIntsTuple=(1,1)

				#get the parent panel
				self.FiguredPanelDeriveTeamerVariable=self.ParentDeriveTeamerVariable

				#init
				self.setAxes()

				#map set
				self['#map@set'](
					self.FiguringDrawVariable
				)		
예제 #16
0
	def do_debug(self):

		'''
		#Special keywords args
		if self.DebuggingPrintVariable=='<DoingVariables>':
			self.debug(('self.',self,self.__class__.DoingAttributeVariablesOrderedDict.keys()))
		'''

		#Debug
		'''
		print(
				'Debugger l 170'
			)
		print('Start debug')
		print('self.DebuggingIsBool is '+str(self.DebuggingIsBool))
		print('')
		'''
		
		#Check
		if self.DebuggingIsBool:

			#debug
			'''
			print('Debugger debug method')
			print('DebuggedCurrentFrame is ',DebuggedCurrentFrame)
			print('self.DebuggedFramesList is ',self.DebuggedFramesList)
			print('')
			'''

			#Definition the DebuggedCurrentFrame
			DebuggedCurrentFrame=inspect.currentframe()
			for __BackInt in xrange(self.DebuggingBacksInt):
				DebuggedCurrentFrame=DebuggedCurrentFrame.f_back

			#Init the DebuggedStr
			DebuggedStr=DebugStartStr

			#Append maybe for the first time
			DebuggedDecorationBool=False
			if len(self.DebuggedFramesList
				)==0 or DebuggedCurrentFrame!=self.DebuggedFramesList[0]:

				#debug
				'''
				print('This is the first frame ')
				print('')
				'''

				#Build the DebuggedBackFramesList
				DebuggedBackFramesList=[]
				DebuggedBackFrame=DebuggedCurrentFrame
				while DebuggedBackFrame.f_back!=None:
					#if hasattr(self,DebuggedBackFrame.f_back.f_code.co_name):

					#debug
					'''
					print("DebuggedCurrentFrame.f_code.co_name is ",DebuggedCurrentFrame.f_code.co_name)
					print("DebuggedBackFrame.f_back.f_code.co_name is ",DebuggedBackFrame.f_back.f_code.co_name)
					print('')
					'''

					#Append
					if DebuggedBackFrame.f_back.f_code.co_name in self.DebuggingNotFrameFunctionStrsList or DebuggedBackFrame.f_back.f_code.co_filename.split('/')[-1] in self.DebuggingNotFrameCodeStrsList:
						DebuggedDecorationBool=True
					else:
						DebuggedBackFramesList.append(DebuggedBackFrame.f_back)
					DebuggedBackFrame=DebuggedBackFrame.f_back

				#Reduce the DebuggedBackFramesList with the DebuggedCurrentFrame
				self.DebuggedFramesList=[DebuggedCurrentFrame]+DebuggedBackFramesList

				#Debug
				'''
				print('DebuggedCurrentFrame.f_code.co_name is ',DebuggedCurrentFrame.f_code.co_name)
				print('')
				'''

				#set
				CodeStr= DebuggedCurrentFrame.f_code.co_filename.split('/')[-1]

				#Shift maybe
				if DebuggedCurrentFrame.f_code.co_name in self.DebuggingNotFrameFunctionStrsList or CodeStr in self.DebuggingNotFrameCodeStrsList:
					self.DebuggedFramesList=self.DebuggedFramesList[1:]
					DebuggedCurrentFrame=self.DebuggedFramesList[0] 

				#set the DebuggedBackFrameStr
				DebuggedBackFrameStr='\nFrom '+' | '.join(
						map(
							lambda __InspectedList:
							' '.join(__InspectedList),
							map(getDebuggedListWithFrame,DebuggedBackFramesList)
						)
					)

				#Check
				if self.DebuggingFrameBool:

					#Add the name of the function or method
					DebuggedStr+=DebugHeadPrefixStr+" ".join(
								[
									'/'.join(DebuggedCurrentFrame.f_code.co_filename.split('/')[-2:]),
									DebuggedCurrentFrame.f_code.co_name
								]
								)+DebuggedBackFrameStr+DebugHeadSuffixStr

			#Update the RepresentingDict
			Printer.PrintAlineaStr=''.join(
				[DebugElementStr]*(len(self.DebuggedFramesList)-1))

			#debug
			'''
			print('self.DebuggedAlineaStr is ',self.DebuggedAlineaStr)
			print('self.DebuggingRepresentingDict is ',self.DebuggingRepresentingDict)
			print('')
			'''

			#Add the lineno
			DebuggedStr+='l.'+str(DebuggedCurrentFrame.f_lineno)+' : '

			#Add some features to identify the instance
			if self.DebuggingIdentityBool:

				#add
				DebuggedStr+=DebugWhoStr+'I am with '+str(
					SYS._filter(
								lambda __ItemTuple:
								__ItemTuple[0].endswith('TagStr'),
								#and __ItemTuple[0] not in self.__class__.DefaultBaseKeyStrsList
								#			+self.__class__.DefaultSpecificKeyStrsList,
								self.__dict__.items()
							)
					)+", "+str(self.PrintIdInt)+" "+DebugWhoStr

			#Add the DebuggedStr from the debugging variable
			DebuggedStr+=getDebuggedStrWithPrintVariable(
				self.DebuggingPrintStr)

			#add the end
			DebuggedStr+=DebugEndStr
				
			#Print
			if SYS.DebugPrintBool:

				#_print
				self._print(
							str(DebuggedStr)+Printer.PrintAlineaStr,
							**{
								#'RepresentedDeepInt':1
							}
						)
예제 #17
0
	def getReprStr(self,**_KwargVariablesDict):

		#Debug
		'''
		print('l 741 getReprStr')
		print('_KwargVariablesDict is ')
		print(_KwargVariablesDict)
		print('')
		'''

		#debug
		'''
		_Variable.debug(('_Variable.__class__',self.__class__,[
				'PrintingKeyStrsList',
				'DefaultBaseKeyStrsList',
				'DefaultSpecificKeyStrsList',
				'PrintedNotSpecificKeyStrsList'
				]))
		'''

		#/###################/#
		# Print the Default Key Strs... form the Instance or the still the Class
		#

		#Debug
		'''
		print('Printer l 846')
		print('self.PrintingInstanceSkipKeyStrsList is ')
		print(self.PrintingInstanceSkipKeyStrsList)
		print('')
		'''
		
		#Check
		if self.PrintingClassSkipKeyStrsList==None:
			self.PrintingClassSkipKeyStrsList=[]
		if self.PrintingInstanceSkipKeyStrsList==None:
			self.PrintingInstanceSkipKeyStrsList=[]

		#filter the skip key strs
		PrintedDefaultSpecificKeyStrsList=SYS._filter(
				lambda __DefaultSpecificKeyStr:
				__DefaultSpecificKeyStr not in list(
					self.PrintingInstanceSkipKeyStrsList
				)+list(
					self.PrintingClassSkipKeyStrsList), 
				self.__class__.DefaultSpecificKeyStrsList
			)

		#Represent the Specific KeyStrs
		PrintTuplesList=map(
					lambda __SpecificKeyStr:
					(
						"<Spe>"+("<Instance>"
						if __SpecificKeyStr in self.__dict__ 
						else (
							"<Instance>_"
							if hasattr(
									self.__class__,__SpecificKeyStr
							) and type(getattr(
								self.__class__,__SpecificKeyStr
							))==property and getattr(
								self.__class__,'_'+__SpecificKeyStr
							)!=getattr(self,'_'+__SpecificKeyStr) and (
							'_'+__SpecificKeyStr not in self.PrintingClassSkipKeyStrsList and __SpecificKeyStr not in self.PrintingInstanceSkipKeyStrsList
							)
							else
							"<Class>"
							)
						)+__SpecificKeyStr,
						getattr(self,__SpecificKeyStr)
					),
					PrintedDefaultSpecificKeyStrsList
			)

		#/###################/#
		# Print the Default Base Key Strs... form the Instance or the still the Class
		#

		#Represent the BaseKeyStrs
		if self.PrintingBaseBool:
			
			#Debug
			'''
			print('Printer l 723')
			print('We print the bases')
			print('self.__class__.DefaultBaseKeyStrsList is ')
			print(self.__class__.DefaultBaseKeyStrsList)
			print('')
			'''

			#filter remove
			PrintedDefaultBaseKeyStrsList=SYS._filter(
					lambda __DefaultSpecificKeyStr:
					__DefaultSpecificKeyStr not in list(
						self.PrintingInstanceSkipKeyStrsList
					)+list(self.PrintingClassSkipKeyStrsList), 
					self.__class__.DefaultBaseKeyStrsList
				)

			#filter add
			if self.PrintingInstanceForceBaseKeyStrsList!=None:

				#add
				PrintedDefaultBaseKeyStrsList+=self.PrintingInstanceForceBaseKeyStrsList
			
			#map	
			PrintTuplesList+=map(
									lambda __BaseKeyStr:
									(
										"<Base>"+("<Instance>"
										if __BaseKeyStr in self.__dict__
										else "<Class>"
										)+__BaseKeyStr
										,
										getattr(self,__BaseKeyStr)
									),
									PrintedDefaultBaseKeyStrsList
								)

		#/###################/#
		# Print the New key strs in the instance
		#

		#print the NewInstanceKeyStrs in the __dict__
		if self.PrintingNewInstanceBool:
			
			#filter
			PrintedNewInstanceTuplesList=SYS._filter(
				lambda __NewItemTuple:
				__NewItemTuple[0
				] not in self.__class__.DefaultSpecificKeyStrsList+self.__class__.DefaultBaseKeyStrsList,
				self.__dict__.items()
			)

			#filter
			PrintedNewInstanceTuplesList=SYS._filter(
					lambda __PrintedNewInstanceTuple:
					__PrintedNewInstanceTuple[0] not in list(
						self.PrintingInstanceSkipKeyStrsList)+list(
						self.PrintingClassSkipKeyStrsList),
					PrintedNewInstanceTuplesList
				)

			#map
			PrintTuplesList+=map(
				lambda __NewItemTuple:
				(
					"<New><Instance>"+__NewItemTuple[0],
					__NewItemTuple[1]
				),
				PrintedNewInstanceTuplesList
			)

		#/###################/#
		# Print the New key strs in the class
		#

		#Represent the NewClassKeyStrs in the _self.__class____.__dict__
		if self.PrintingNewClassBool:


			#filter
			PrintedNewClassKeyStrsList=SYS._filter(
					lambda __KeyStr:
					__KeyStr not in self.__class__.KeyStrsList and __KeyStr not in self.__dict__,
					SYS.getKeyStrsListWithClass(
						self.__class__
					)
				)

			#filter
			PrintedNewClassKeyStrsList=SYS._filter(
					lambda __NewClassKeyStr:
					__NewClassKeyStr not in list(
					self.PrintingInstanceSkipKeyStrsList)+list(
					self.PrintingClassSkipKeyStrsList),
					PrintedNewClassKeyStrsList
				)

			#filter
			PrintTuplesList+=map(
				lambda __NewKeyStr:
				(
					"<New><Class>"+__NewKeyStr,
					self.__class__.__dict__[__NewKeyStr]
				),
				PrintedNewClassKeyStrsList
			)
		
		#/###################/#
		# Print force key strs
		#

		#Debug
		'''
		print('Printer l 811')
		print('We add some forced Key Strs')
		print('')
		'''
		
		#Check
		if self.PrintingInstanceForceKeyStrsList==None:
			self.PrintingInstanceForceKeyStrsList=[]

		#map
		PrintTuplesList+=map(
				lambda __PrintingKeyStr:
				(
					"<Spe><Instance>"+__PrintingKeyStr,
					self.__dict__[__PrintingKeyStr]
				) 
				if __PrintingKeyStr in self.__dict__ and __PrintingKeyStr in self.__class__.DefaultSpecificKeyStrsList
				else(
						(
							"<Base><Instance>"+__PrintingKeyStr,
							self.__dict__[__PrintingKeyStr]
						) 
						if __PrintingKeyStr in self.__dict__ and __PrintingKeyStr in self.__class__.DefaultBaseKeyStrsList
						else
						(
							(
								"<Base><Class>"+__PrintingKeyStr,
								getattr(self,__PrintingKeyStr)
							)
							if __PrintingKeyStr not in self.__dict__
							else
							(
								"<New><Instance>"+__PrintingKeyStr,
								self.__dict__[__PrintingKeyStr]
							)
						)
				),
				list(
					self.PrintingInstanceForceKeyStrsList
				)+list(self.PrintingClassForceKeyStrsList)
			)
					
		#Append
		global PrintAlreadyIdIntsList

		#debug
		'''
		print('Printer l.629')
		print('id(self) is ',id(self))
		print('self not in PrintAlreadyIdIntsList is ',str(
			self not in PrintAlreadyIdIntsList))
		print('')
		'''

		#define the PrintStr
		self.PrintStr=getPointerStr(
					self,
					**_KwargVariablesDict
				)+getPrintStr(
					dict(PrintTuplesList),
					**_KwargVariablesDict
				)

		#return
		return self.PrintStr
예제 #18
0
	def do_imitate(self):

		#Debug
		'''
		print('l. 63 Imitater')
		print('self.ImitatingFunction is ',self.ImitatingFunction)
		print('')
		'''

		#Definitions
		ImitatedDoMethodStr=self.ImitatingFunction.__name__
		ImitatedDoStr=ImitatedDoMethodStr[0].upper()+ImitatedDoMethodStr[1:]
		ImitatedDoerStr=Doer.getDoerStrWithDoStr(ImitatedDoStr)

		#Debug
		'''
		print('ImitatedDoMethodStr is ',ImitatedDoMethodStr)
		print('ImitatedDoStr is ',ImitatedDoStr)
		print('ImitatedDoerStr is ',ImitatedDoerStr)
		print('')
		'''

		#Definitions
		ImitatedModule=getattr(SYS,ImitatedDoerStr)
		ImitatedClass=getattr(ImitatedModule,SYS.getClassStrWithNameStr(ImitatedDoerStr))
		ImitatedDoneExecStr=getattr(
			ImitatedClass,
			ImitatedClass.NameStr+'DoneExecStr'
		).replace('def DoerFunction','def ImitaterFunction')

		#Define
		def imitateDo(_InstanceVariable,*_LiargVariablesList,**_KwargVariablesDict):
			
			#Debug
			'''
			print('Imitater l.93 inside of the function imitateDo')
			print('_InstanceVariable is ',_InstanceVariable)
			print('_LiargVariablesList is ',_LiargVariablesList)
			print('_KwargVariablesDict is ',_KwargVariablesDict)
			print('')
			'''

			if len(_KwargVariablesDict)>0:

				#group by
				[ImitatedItemTuplesList,ImitatedNotItemTuplesList]=SYS.groupby(
					lambda __ItemTuple:hasattr(_InstanceVariable,__ItemTuple[0]),
					_KwargVariablesDict.items()
				)

				#Debug
				'''
				print('ImitatedItemTuplesList is ',ImitatedItemTuplesList)
				print('ImitatedNotItemTuplesList is ',ImitatedNotItemTuplesList)
				print('')
				'''

				#set in the instance the corresponding kwarged arguments
				map(	
						lambda __ItemTuple:
						#set direct explicit attributes
						_InstanceVariable.__setattr__(*__ItemTuple),
						ImitatedItemTuplesList
					)

				#Define
				ImitatedKwargDict=dict(ImitatedNotItemTuplesList)

			else:

				#Define
				ImitatedKwargDict={}

			#Init
			ImitatedOutputVariable=None

			#Debug
			'''
			print('l.141 Imitater')
			print('self.ImitatingFunction is ',self.ImitatingFunction)
			print('ImitatedKwargDict is ',ImitatedKwargDict)
			print('')
			'''
			
			#call the imitated function
			if len(ImitatedKwargDict)>0:
				ImitatedOutputVariable=self.ImitatingFunction(
									_InstanceVariable,
									*_LiargVariablesList,
									**ImitatedKwargDict
								)
			else:
				ImitatedOutputVariable=self.ImitatingFunction(
						_InstanceVariable,
						*_LiargVariablesList
						)

			#Check
			if ImitatedClass.DoingGetBool==False:

				#Return 
				return _InstanceVariable
			
			else:

				#Return the 
				return ImitatedOutputVariable

		#Link
		ImitatedFunctionKeyStr='imitate'+ImitatedDoStr+'With'+inspect.getmodule(
			self.ImitatingFunction
					).__name__.split('.')[-1]
		if hasattr(ImitatedClass,ImitatedFunctionKeyStr)==False:
			setattr(ImitatedClass,ImitatedFunctionKeyStr,imitateDo)
		else:

			ImitatedLastInt=sorted(
				map(
					lambda __MethodKeyStr:
					(int)(__MethodKeyStr.split('_')[-1]),
					SYS._filter(
						lambda __KeyStr:
						__KeyStr.startswith(ImitatedFunctionKeyStr),
						ImitatedClass.__dict__.keys()
						)
				)
			)[-1]
			setattr(ImitatedClass,ImitatedFunctionKeyStr+'_'+str(ImitatedLastInt),imitateDo)

		#Add to the ImitatedDoneExecStr
		ImitatedDoneExecStr+='\n\treturn _InstanceVariable.'+ImitatedFunctionKeyStr+'(*_LiargVariablesList,**_KwargVariablesDict)'

		#Debug
		'''
		print('ImitatedDoneExecStr is ')
		print(ImitatedDoneExecStr)
		print('')
		'''
		
		#exec
		six.exec_(ImitatedDoneExecStr)

		#set the name
		locals()['ImitaterFunction'].__name__=self.__class__.NameStr+Doer.DoingDecorationStr+ImitatedDoMethodStr

		#Link
		self.ImitatedFunction=locals()['ImitaterFunction']
	def do_figure(self):	

		#/###################/#
		# First we get the children figurers and check what they are
		#

		#debug
		'''
		self.debug(
				[
					'We figure here',
					('self.',self,['ViewFirstDeriveViewerVariable'])
				]
			)
		'''

		#filter
		FiguredTeamTagStrsList=SYS._filter(
			lambda __KeyStr:
			__KeyStr in ['Panels','Axes','Plots'],
			self.TeamDict.keys()
		)

		#Check
		if len(FiguredTeamTagStrsList)==1:

			#filter
			self.FiguredTeamTagStr=FiguredTeamTagStrsList[0]

			#get
			self.FiguredDeriveTeamerVariablesList=self.TeamDict[
				self.FiguredTeamTagStr
			].ManagementDict.values()
		
		#debug
		'''
		self.debug(
				[
					('self.',self,[
							'FiguredTeamTagStr',
							#'FiguredDeriveTeamerVariablesList'
						])
				]
			)
		'''

		#/###################/#
		# do something before descending a figure call
		#

		if self.FiguredTeamTagStr=='Panels':

			#debug
			'''
			self.debug(
					[
						'I am the top figurer...'
					]
				)
			'''

		elif self.FiguredTeamTagStr=='Axes':

			#debug
			'''
			self.debug(
					[
						'I am a Panel...'
					]
				)
			'''

		elif self.FiguredTeamTagStr=='Plots':

			#debug
			self.debug(
					[
						'I am an Axes..',
						('self.',self,['ParentDeriveTeamerVariable'])
					]
				)

			#get the parent panel
			self.FiguredPanelDeriveTeamerVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

			#debug
			self.debug(
					[
						'I am still an Axes..',
						('self.',self,[
							'FiguredPanelDeriveTeamerVariable',
							'ViewFirstDeriveViewerVariable',
							'FiguringAnchorIntsTuple',
							'FiguringShapeIntsTuple'
						])
					]
				)

			#init
			from matplotlib import pyplot
			self.FiguredAxesVariable=pyplot.subplot2grid(
					self.ViewFirstDeriveViewerVariable.FiguringGridIntsTuple, 
					self.FiguringAnchorIntsTuple, 
					rowspan=self.FiguringShapeIntsTuple[0],
					colspan=self.FiguringShapeIntsTuple[1]
				)

			#link
			self.FiguredAxesVariable._figure=self.FigurePyplotVariable

			#debug
			self.debug(
					[
						'I am still an Axes..',
						('self.',self,['FiguredAxesVariable'])
					]
				)

		else:

			#debug
			'''
			self.debug(
					[
						'I dont have such panels axes plots...',
						'So I can be a plot or the top one axe one plot figurer'
					]
				)
			'''

			#Check
			if self!=self.ViewFirstDeriveViewerVariable:

				#/###################/#
				# point to the FiguredAxesVariable
				#

				#debug
				self.debug(
						[
							'I am Plot..',
							'I set my FiguredAxesVariables corresponding to my parent one',
							('self.',self,['ParentDeriveTeamerVariable'])
						]
					)

				#get the parent panel
				self.FiguredAxesDeriveTeamerVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

				#get the one of the parent
				self.FiguredAxesVariable=self.FiguredAxesDeriveTeamerVariable.FiguredAxesVariable

				#debug
				self.debug(
						[
							'I am Plot..',
							('self.',self,['FiguredAxesVariable'])
						]
					)

				#/###################/#
				# if there axes setted then apply the draw set variable 
				#

				#Check
				if self.FiguredAxesVariable!=None:

					#debug
					self.debug(
							[
								'There are axes so command the figuring draw variable',
								('self.',self,[
									'FiguringDrawVariable'
								])
							]
						)

					#commad self
					#self.command(self,self.FiguringDrawVariable)
					#self.command(self,[])
					self['#map@set'](self.FiguringDrawVariable)

				#/###################/#
				# if it is the last then trigger the axes to set also
				#

				#Check
				if self.ManagementIndexInt==(len(self.ParentDeriveTeamerVariable.ManagementDict)-1):

					#debug
					self.debug(
						[
							'I am the last plot of this axes !',
							'Lets the axes setting itself now',
							('self.FiguredAxesDeriveTeamerVariable',
								self.FiguredAxesDeriveTeamerVariable,
								['FiguringDrawVariable'])
						]
					)

					#commad self
					self.FiguredAxesDeriveTeamerVariable['#map@set'](
						self.FiguredAxesDeriveTeamerVariable.FiguringDrawVariable
					)


			else:

				#debug
				self.debug(
						[
							'I am the top figurer but with just one axes..',
							('self.',self,['FiguringGridIntsTuple'])
						]
					)

				#Set the size of the grid to this just one plot
				self.FiguringGridIntsTuple=(1,1)

				#get the parent panel
				self.FiguredPanelDeriveTeamerVariable=self.ParentDeriveTeamerVariable

				#init
				from matplotlib import pyplot
				self.FiguredAxesVariable=pyplot.subplot2grid(
						self.FiguringGridIntsTuple, 
						self.FiguringAnchorIntsTuple, 
						rowspan=self.FiguringShapeIntsTuple[0],
						colspan=self.FiguringShapeIntsTuple[1]
					)

				#link
				self.FiguredAxesVariable._figure=self.FigurePyplotVariable	

				#map set
				self['#map@set'](
					self.FiguringDrawVariable
				)		

		#/###################/#
		# map a figure into them
		#

		#debug
		#self.debug(
		#		'Go map further the figure call'
		#	)

		#map
		#map(
		#		lambda __FiguredDeriveTeamerVariable:
		#		__FiguredDeriveTeamerVariable.figure(),
		#		self.FiguredDeriveTeamerVariablesList
		#	)

		

		#/###################/#
		# now do something here depending on the Tag
		#

		if self.FiguredTeamTagStr=='Panels':

			#debug
			'''
			self.debug(
					[
						'I am the top figurer...'
					]
				)
			'''

		elif self.FiguredTeamTagStr=='Axes':

			#debug
			'''
			self.debug(
					[
						'I am a Panel...'
					]
				)
			'''

		else:

			#debug
			'''
	def do_hierarchize(	
				self
			):

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

		if self.HierarchizingDatabaseNodeStr=="":
			self.HierarchizingDatabaseNodeStr=self.ModelingNodeStr

		#Init a default value
		if self.HierarchizingDatabaseKeyStr=="":
			self.HierarchizingDatabaseKeyStr=self.ModeledCollectionKeyStr

		#Check
		if self.HierarchizingNodeStr!="":

			#Check
			if self.NodePointDeriveNoder!=None:
					
				#debug
				'''
				self.debug('Look for the hierarchized variables...')
				'''

				#set
				self.HierarchizedNodeVariablesList=self.NodePointDeriveNoder[
						Noder.NodingPrefixGetStr+self.HierarchizingNodeStr+Noder.NodingSuffixGetStr
					]

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

				#set
				self.HierarchizedDeriveDatabasersList=map(
					lambda __HierarchizedNodeVariable:
					SYS._filter(
							lambda __NodedDatabaser:
							getattr(
								__NodedDatabaser,
								'Noded'+self.HierarchizingDatabaseNodeStr+'KeyStr'
								).startswith(
								self.HierarchizingDatabaseKeyStr
							),
							getattr(
									__HierarchizedNodeVariable,
									'Noded'+self.HierarchizingDatabaseNodeStr+'OrderedDict'
							).values()
					)[0],
					self.HierarchizedNodeVariablesList
				)

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

				#set
				self.HierarchizedKeyStrsList=map(
					lambda __HierarchizedVariable:
					getattr(
						__HierarchizedVariable,
						self.NodePointDeriveNoder.NodedKeyStrKeyStr
					),
					self.HierarchizedNodeVariablesList
				)

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

				#set
				self.HierarchizedRetrieveIndexesListColumnStrsList=map(
						lambda __HierarchizedKeyStr:
						'Hierarchized'+__HierarchizedKeyStr+'RetrieveIndexesList',
						self.HierarchizedKeyStrsList
					)

				#set
				self.HierarchizedRetrieveIndexesListGetStrsList=map(
						lambda __HierarchizedKeyStr:
						'Hierarchized'+self.ModelingNodeStr+self.ModeledCollectionKeyStr+'To'+__HierarchizedKeyStr+'RetrieveIndexesList',
						self.HierarchizedKeyStrsList
					)
				
				#debug
				'''
	def do_document(self):
		
		#debug
		'''
		self.debug(
				[
					('self.',self,[
						'DocumentingSubReadmeIsBool',
						'DocumentingConceptDocumentIsBool'
					])
				]
			)
		'''

		#Check
		if self.DocumentingConceptFolderPathStr=="":
			self.DocumentingConceptFolderPathStr='ShareYourSystem'.join(
				os.getcwd().split('ShareYourSystem')[:-1]
			)+'ShareYourSystem/'

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

		#debug
		self.folder(
			self.DocumentingConceptFolderPathStr
		)
		self.DocumentedConceptModuleStr=self.FolderedModuleStr

		#debug
		'''
		self.debug(('self.',self,[
									'FolderedModuleStr',
									'FolderedDirKeyStrsList'
								]))
		'''

		#filter
		self.DocumentedSubNameStrsList=SYS._filter(
			lambda __FolderedDirKeyStr:
			os.path.isdir(
				self.FolderingPathVariable+__FolderedDirKeyStr
			) and __FolderedDirKeyStr in Doer.DoerStrToDoStrOrderedDict.keys(),
			self.FolderedDirKeyStrsList
		)	

		#debug
		'''
		self.debug(('self.',self,['DocumentedSubNameStrsList','DocumentNameStrsList']))
		'''
		
		#sort
		self.DocumentedSubNameStrsList=SYS._filter(
				lambda __DocumentNameStr:
				__DocumentNameStr in self.DocumentedSubNameStrsList,
				DocumentNameStrsList
			)
		#map
		self.DocumentedSubModuleStrsList=map(
			lambda __DocumentedSubNameStr:
			self.DocumentedConceptModuleStr+'.'+__DocumentedSubNameStr,
			self.DocumentedSubNameStrsList
		)	

		#Check
		self.DocumentedConceptNameStr=self.FolderingPathVariable.split(
					'/'
			)[-1] if self.FolderingPathVariable[-1]!='/' else self.FolderingPathVariable.split('/'
			)[-2]

		#debug
		'''
		self.debug(('self.',self,[
									'DocumentedSubNameStrsList',
									'DocumentedSubModuleStrsList',
									'DocumentedConceptNameStr'
								]))
		'''

		#check
		if self.DocumentedConceptNameStr in SYS.PluralStrToSingularStrOrderedDict.keys():
			
			#debug
			self.debug(
				[
					'We get the concept module',
					('self.',self,[
							'DocumentedConceptNameStr'
						])
				]
			)

			#folder
			self.DocumentedConceptModule=self.folder(
					getattr(SYS,self.DocumentedConceptNameStr)
				).FolderedModuleDict['ModuleVariable']

		#join
		self.DocumentedConceptModuleFolderPathStr='/'.join(
			self.DocumentedConceptModule.__file__.split(
			'/'
			)[:-1]
		)+'/'

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

		#filter
		self.DocumentedSubModulesList=SYS._filter(
				lambda __AttributeValueVariable:
				type(__AttributeValueVariable).__name__=='module',
				self.DocumentedConceptModule.__dict__.values()
			)

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

		#Check
		if self.DocumentingSubReadmeIsBool:

			#debug
			'''
			self.debug(
						[
							'we build sub modules readmes here',
							('self.',self,['DocumentedSubModuleStrsList'])
						]
					)
			'''

			#map
			map(
					lambda __DocumentedSubModuleStr:
					self.folder(
							__DocumentedSubModuleStr
						).scriptbook(
						_GuideTuplesList=[
								('001','Document','Markdown'),
							],
							**{
								'GuidingBookStr':"Doc",
							}
						).notebook(
							"PreReadme.ipynb"
						).nbconvert(
							"Readme.md"
						),
					self.DocumentedSubModuleStrsList
				)
			
		#Check
		if self.DocumentingConceptSlideIsBool:
			
			#debug
			'''
			self.debug(
						[
							'we slide here',
							('self.',self,['DocumentedSubModuleStrsList'])
						]
						)
			'''

			#map
			map(
					lambda __DocumentedSubModuleStr:
					self.folder(
							__DocumentedSubModuleStr
						).scriptbook(
						_GuideTuplesList=[
								('001','Document','Markdown'),
								('002','Github','Markdown'),
							],
							**{
								'GuidingBookStr':"Doc",
							}
						).notebook(
							"Presentation.ipynb",
							**{'WritingLoadBool':False}
						).nbconvert(
							"Presentation.html",
							'Slide'
						),
					self.DocumentedSubModuleStrsList
				)
			
			#mv for Nbviewer ipython notebooks
			map(
					lambda __DocumentedSubModuleStr:
					os.popen(
						'cp '+sys.modules[
							__DocumentedSubModuleStr
						].LocalFolderPathStr+'Presentation.ipynb '+DocumentNbviewerLocalFolderPathStr+__DocumentedSubModuleStr.split(
								'.'
							)[-1]+'.ipynb'
					),
					self.DocumentedSubModuleStrsList
				)

			#mv for Ouvaton slide in html
			map(
					lambda __DocumentedSubModuleStr:
					os.popen(
						'cp '+sys.modules[
							__DocumentedSubModuleStr
						].LocalFolderPathStr+'Presentation.html '+DocumentOntologyLocalFolderPathStr+__DocumentedSubModuleStr.split(
								'.'
							)[-1]+'.html'
					),
					self.DocumentedSubModuleStrsList
				)

			#mv for Ouvaton slide in php
			map(
					lambda __DocumentedSubModuleStr:
					os.popen(
						'cp '+sys.modules[
							__DocumentedSubModuleStr
						].LocalFolderPathStr+'Presentation.html '+DocumentOntologyLocalFolderPathStr+__DocumentedSubModuleStr.split(
								'.'
							)[-1]+'.php'
					),
					self.DocumentedSubModuleStrsList
				)

			#map
			self.DocumentedSubModuleLocalFolderPathStrsList=map(
					lambda __DocumentedSubModuleStr:
					SYS.PythonlogyLocalFolderPathStr+__DocumentedSubModuleStr.replace(
						'.','/'
					),
					self.DocumentedSubModuleStrsList
				)

			#map
			self.DocumentedPresentationsDictsList=map(
					lambda __DocumentedSubModuleFolderPathStr:
					self.folder(
							__DocumentedSubModuleFolderPathStr
						).file(
							'Presentation.ipynb',
							_ModeStr='r',
							_FormatStr='json'
						).file(
							_ModeStr='c'
						).FiledReadVariable,
					self.DocumentedSubModuleLocalFolderPathStrsList
				)					

			#debug
			'''
			self.debug(
						'self.DocumentedPresentationsDictsList is '+SYS._str(self.DocumentedPresentationsDictsList)
					)
			'''

			#copy
			self.DocumentedConceptNotebookDict=copy.copy(Celler.CellInitDict)

			#flat
			DocumentedFlatPresentationsDictsList=SYS.flat(
					map(
							lambda __DocumentedPresentationsDict:
							copy.deepcopy(
								__DocumentedPresentationsDict['worksheets'][0]['cells']
								),
							self.DocumentedPresentationsDictsList
						)
					)

			#Flat all the presentations
			self.DocumentedConceptNotebookDict['worksheets']=[
				{
					'cells':map(
						lambda __DocumentedFlatPresentationsDict,__IndexInt:
						dict(__DocumentedFlatPresentationsDict,**{
							'prompt_number':__IndexInt}),
						DocumentedFlatPresentationsDictsList,
						xrange(len(DocumentedFlatPresentationsDictsList))
					)
				}
			]

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

			#Write
			self.folder(
					self.DocumentingConceptFolderPathStr
				).file(
					_KeyStr='Concept'+self.GuidingBookStr+'.ipynb',
					_WriteVariable=self.DocumentedConceptNotebookDict,
					_FormatStr="json"
				).file(
					_ModeStr='c'
				)

			#nbconvert
			self.NotebookedCodeDict=self.DocumentedConceptNotebookDict
			self.folder(
					self.DocumentingConceptFolderPathStr
				).nbconvert(
					_FormatStr='Slide',
					_FileKeyStr='Concept'+self.GuidingBookStr+'.ipynb'
				)

			#set
			self.DocumentedSlideLocalFilePathStr=DocumentOntologyLocalFolderPathStr+self.DocumentedConceptModule.__name__.split('.')[-1]+'.html'

			#cp
			os.popen('cp '+self.FiledPathStr+' '+self.DocumentedSlideLocalFilePathStr+self.DocumentedConceptModule.__name__.split('.')[-1]+'.ipynb')

			#mv with .html extension
			os.popen(
					'cp '+self.FiledPathStr.replace(
					'.ipynb',
					'.html'
					)+' '+self.DocumentedSlideLocalFilePathStr
				)

			#mv with .php extension
			os.popen(
					'mv '+self.FiledPathStr.replace(
					'.ipynb',
					'.html'
					)+' '+self.DocumentedSlideLocalFilePathStr.replace('.html','.php')
				)

			#deploy
			try:
				self.deploy(
					_ClientFilePathStrToServerFilePathStrOrderedDict=collections.OrderedDict(
						[
							(
								self.DocumentedSlideLocalFilePathStr,
								DocumentOntologyOuvatonFolderPathStr+self.DocumentedConceptModule.__name__.split('.'
									)[-1]+'.php'
							)
						]
					)
				)
			except:
				print('There is NO Internet !')
				
		#Check
		if self.DocumentingConceptReadmeIsBool:

			#debug
			'''
			self.debug('we build the concept readme here')
			'''

			#import submodules
			'''
			map(
					lambda __DocumentedSubModuleStr:
					importlib.import_modules(__DocumentedSubModuleStr),
					self.DocumentedSubModuleStrsList
				)
			'''

			#readme
			self.folder(
					self.DocumentedConceptModuleStr
				).scriptbook(
					_GuideTuplesList=[
						('001','Document','Markdown'),
						('002','Ouvaton','Markdown'),
						('1','Github','Markdown'),
					],
					**{'GuidingBookStr':"Doc"}
				)

			#notebook
			self.scriptbook(
					_GuideTuplesList=[]
				).notebook(
					"PreReadme.ipynb"
				).nbconvert(
					"Readme.md",
					'Markdown',
			)

		#Check
		if self.DocumentingConceptDocumentIsBool:

			#debug
			'''
			self.debug(
						[
							'we document here',
							('self.',self,['DocumentedConceptModuleFolderPathStr'])
						]
					)
			'''

			'''
			#document
			self.document(
				**{'PackagingModuleVariable':self.DocumentedConceptModuleStr}
			)	
			'''

			#folder
			self.folder(self.DocumentedConceptModuleStr)

			#mv with .php extension
			os.popen(
					'cp '+self.PackagedLocalFolderPathStr+'Readme.md  '+DocumentDocumentLocalFolderPathStr+self.DocumentedConceptModuleStr.split('.')[-1]+'.md'
				)

		if self.DocumentingSiteDocumentIsBool:

			#open
			os.popen(
						'mkdocs build --clean'
				)

			#deploy
			try:
				self.deploy(
					_ClientFilePathStrToServerFilePathStrOrderedDict=collections.OrderedDict(
						[
							(
								self.DocumentedSlideLocalFilePathStr,
								DocumentOntologyOuvatonFolderPathStr+self.DocumentedConceptModule.__name__.split('.'
									)[-1]+'.php'
							)
						]
					)
				)
			except:
				print('There is NO Internet !')
	def do_inform(self):
		
		#debug
		self.debug(('self.',self,['DocumentingReadmeIsBool','DocumentingConceptIsBool']))

		#install first
		self.install()

		#Check
		if self.DocumentingConceptFolderPathStr=="":
			self.DocumentingConceptFolderPathStr='ShareYourSystem'.join(
				os.getcwd().split('ShareYourSystem')[:-1]
			)+'ShareYourSystem/'

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

		"""
		#direct the Install command
		self.direct(
						lambda _LiargVariablesList,_FolderPathStr,_FileKeyStrsList:
						self.readme(
							**{
								'FolderingPathVariable':_FolderPathStr
							}
						) if '__init__.py' in _FileKeyStrsList and _FolderPathStr.startswith('_'
						)==False else None
						,[],
						**{'FolderingPathVariable':self.DocumentingConceptFolderPathStr}
					)
		"""

		#debug
		self.folder(self.DocumentingConceptFolderPathStr)

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

		#filter
		self.DocumentedNameStrsList=SYS._filter(
			lambda __FolderedDirKeyStr:
			os.path.isdir(
				self.FolderingPathVariable+__FolderedDirKeyStr
			) and __FolderedDirKeyStr in Doer.DoerStrToDoStrOrderedDict.keys(),
			self.FolderedDirKeyStrsList
		)	

		#debug
		'''
		self.debug(('self.',self,['DocumentedNameStrsList','InstalledNameStrsList']))
		'''
		
		#sort
		self.DocumentedNameStrsList=SYS._filter(
				lambda __InstalledNameStr:
				__InstalledNameStr in self.DocumentedNameStrsList,
				self.InstalledNameStrsList
			)
		#map
		self.DocumentedModulePathStrsList=map(
			lambda __DocumentedNameStr:
			self.FolderingPathVariable+__DocumentedNameStr+'/',
			self.DocumentedNameStrsList
		)	

		#debug
		'''
		self.debug(('self.',self,[
									'DocumentedNameStrsList',
									'DocumentedModulePathStrsList'
								]))
		'''

		#Check
		self.DocumentedConceptStr=self.FolderingPathVariable.split('/')[-1] if self.FolderingPathVariable[-1]!='/' else self.FolderingPathVariable.split('/')[-2]
		if self.DocumentedConceptStr in PluralStrToSingularStrOrderedDict.keys():
			self.DocumentedConceptModule=self.package(self.FolderedModuleStr).PackagingModuleVariable

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

		#filter
		self.DocumentedModulesList=SYS._filter(
				lambda __AttributeValueVariable:
				type(__AttributeValueVariable).__name__=='module',
				self.DocumentedConceptModule.__dict__.values()
			)

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

		#map
		self.DocumentedPresentationsDictsList=map(
				lambda __DocumentedModulePathStr:
				self.readme(
					**{
						'FolderingPathVariable':__DocumentedModulePathStr
					}
				).load(
					**{
						'FilingKeyStr':'Presentation.ipynb',
						'LoadingFormatStr':'json'
					}
				).close().LoadedReadVariable
				if self.DocumentingReadmeIsBool
				else
				self.load(
					**{
						'FolderingPathVariable':__DocumentedModulePathStr,
						'FilingKeyStr':'Presentation.ipynb',
						'LoadingFormatStr':'json'
					}
				).close().LoadedReadVariable,
				self.DocumentedModulePathStrsList
			)

		#debug
		'''
		self.debug(
					'self.DocumentedPresentationsDictsList is '+SYS._str(self.DocumentedPresentationsDictsList)
				)
		'''

		#Check
		if self.DocumentingConceptIsBool:

			#Copy
			self.DocumentedConceptNotebookDict=copy.copy(Celler.CellingInitDict)

			#SYS._print(self.DocumentedPresentationsDictsList[0]['worksheets'][0]['cells'][0])
			#print(self.DocumentedConceptNotebookDict)

			DocumentedFlatPresentationsDictsList=SYS.flat(
					map(
							lambda __DocumentedPresentationsDict:
							copy.deepcopy(
								__DocumentedPresentationsDict['worksheets'][0]['cells']
								),
							self.DocumentedPresentationsDictsList
						)
					)

			#Flat all the presentations
			self.DocumentedConceptNotebookDict['worksheets']=[
				{
					'cells':map(
						lambda __DocumentedFlatPresentationsDict,__IndexInt:
						dict(__DocumentedFlatPresentationsDict,**{'prompt_number':__IndexInt}),
						DocumentedFlatPresentationsDictsList,
						xrange(len(DocumentedFlatPresentationsDictsList))
					)
				}
			]

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

			#Write
			self.write(
				self.DocumentedConceptNotebookDict,
				**{
					'FolderingPathVariable':self.DocumentingConceptFolderPathStr,
					'FilingKeyStr':'Concept'+self.GuidingBookStr+'.ipynb',
					'LoadingFormatStr':'json'
				}
			).close()

			#nbconvert
			self.NotebookedCodeDict=self.DocumentedConceptNotebookDict
			self.nbconvert(
				_FormatStr='Slide',
				**{
					'FolderingPathVariable':self.DocumentingConceptFolderPathStr,
					'NotebookingFileKeyStr':'Concept'+self.GuidingBookStr+'.ipynb'
				}
			)

			#Check
			if self.NbconvertingFormatStr=='Slide':
				#change the reveal.js directory
				self.load(**{
						'FilingKeyStr':self.FilingKeyStr.replace('.ipynb','.slides.html'),
						'LoadingFormatStr':'txt'
					})
				self.LoadedReadVariable=self.LoadedReadVariable.replace('reveal.js/','')
				self.write(self.LoadedReadVariable)

			#mv
			os.popen('mv '+self.FiledPathStr.replace('.ipynb','.slides.html')+' '+DocumentingOntologyFolderPathStr+self.__class__.NameStr+self.GuidingBookStr+'.html')
        def SwitchedFunction(*_LiargVariablesList, **_KwargVariablesDict):

            # debug
            """
			self.debug('We are in the SwitchedFunction !')
			"""

            # Alias
            InstanceVariable = _LiargVariablesList[0]

            # set at the class level
            SwitchedClass = InstanceVariable.__class__

            # debug
            """
			self.debug(
						[
							('self.',self,['SwitchedClassBoolKeyStr','SwitchedInstanceBoolKeyStr']),
							Representer.represent(InstanceVariable,**{'RepresentingAlineaIsBool':False})
						]
					)
			"""

            # set the SwitchedBool if it was not already
            if hasattr(InstanceVariable, self.SwitchedInstanceBoolKeyStr) == False:

                # debug
                """
				self.debug('The InstanceVariable has not the SwitchedBoolSuffixStr..so set it to False')
				"""

                # debug
                """
				self.debug('SwitchedClass is '+str(SwitchedClass))
				"""

                # set
                setattr(SwitchedClass, self.SwitchedInstanceBoolKeyStr, False)

                # set at the instance level
                InstanceVariable.__setattr__(self.SwitchedInstanceBoolKeyStr, False)

                # set also at the scale of

            elif getattr(InstanceVariable, self.SwitchedInstanceBoolKeyStr):

                # debug
                """
				self.debug('The Instance has already done this method')
				"""

                # Return
                return InstanceVariable

                # debug
            """
			self.debug(('self.',self,['SwitchedBoolSuffixStr']))
			"""

            # At the level of the class set the new triggering set function
            if hasattr(SwitchedClass, self.SwitchedClassBoolKeyStr) == False:

                # Definition the SwitchedDoerStr
                SwitchedDoerStr = Doer.getDoerStrWithDoStr(SwitchedDoStr)

                # debug
                """
				print('SwitchedDoerStr is ',SwitchedDoerStr)
				print(InstanceVariable.__class__.__mro__)
				print('')
				"""

                # Find the corresponding base class to reinit
                SwitchedDoerClass = SYS._filter(
                    lambda __Class: SwitchedDoerStr == SYS.getNameStrWithClassStr(__Class.__name__),
                    SwitchedClass.__mro__,
                )[0]

                # Definition the triggering function that will call the init one
                def triggerBefore(*_TriggeringVariablesList, **_TriggeringVariablesDict):

                    # Alias
                    TriggeredInstanceVariable = _TriggeringVariablesList[0]

                    # debug
                    """
					self.debug('Reinit with '+Representer.represent(
						TriggeredInstanceVariable.SettingKeyVariable,**{'RepresentingAlineaIsBool':False}
						)
					)
					"""

                    # Update with the DoneAttributeVariablesOrderedDict
                    map(
                        lambda __ItemTuple: TriggeredInstanceVariable.__setattr__(__ItemTuple[0], __ItemTuple[1]),
                        SwitchedDoerClass.DoneAttributeVariablesOrderedDict.items(),
                    )

                    # set the name

                TriggeredBeforeMethodStr = "triggerBeforeWith" + self.SwitchedBoolSuffixStr
                triggerBefore.__name__ = TriggeredBeforeMethodStr

                # debug
                """
				self.debug(
							[
								("SwitchedClass is "+str(SwitchedClass)),
								("TriggeredBeforeMethodStr is "+TriggeredBeforeMethodStr),
								("Get Method is "+str(getattr(
									SwitchedClass,
									TriggeredBeforeMethodStr)
								) if hasattr(SwitchedClass,
									TriggeredBeforeMethodStr) else "None")
							]
						)
				"""

                # Link the triggerBefore function
                setattr(
                    SwitchedClass,
                    TriggeredBeforeMethodStr,
                    Triggerer.TriggererClass(
                        **{
                            "TriggeringConditionVariable": [
                                ("SettingKeyVariable", (operator.eq, self.SwitchedInstanceBoolKeyStr)),
                                (self.SwitchedInstanceBoolKeyStr, (operator.eq, True)),
                                ("SettingValueVariable", (operator.eq, False)),
                            ],
                            "TriggeringHookStr": "Before",
                        }
                    )(triggerBefore),
                )

                # Call with a default instance this trigger function to be installed
                getattr(SwitchedClass(), TriggeredBeforeMethodStr)()

                # Say that it is ok
                setattr(SwitchedClass, self.SwitchedClassBoolKeyStr, True)

                # debug
            """
			self.debug(
						[
							#('InstanceVariable is '+SYS._str(InstanceVariable)),
							('_LiargVariablesList is '+str(_LiargVariablesList)),
							('_KwargVariablesDict is '+str(_KwargVariablesDict))
						]
					)
			"""

            # Call the SwitchingMethodFunction
            self.SwitchingMethodFunction(*_LiargVariablesList, **_KwargVariablesDict)

            # debug
            """
			self.debug(('self.',self,['SwitchedBoolSuffixStr']))
			"""

            # set True for the Bool after the call
            InstanceVariable.__setattr__(self.SwitchedInstanceBoolKeyStr, True)

            # debug
            """
			self.debug(('InstanceVariable.',InstanceVariable,[self.SwitchedBoolSuffixStr]))
			"""

            # Return self for the wrapped method call
            return InstanceVariable
예제 #24
0
	def do_scriptbook(self):

		#debug
		self.debug(
			[
				'We scriptbook here',
				('self.',self,[
					'FolderedDirKeyStrsList'
				])
			]
		)

		#Definition
		self.ScriptbookedFileKeyStrsList=SYS._filter(
				lambda __DirKeyStr:
				any(
					map(
						lambda __ExtensionStr:
						__DirKeyStr.endswith(
							self.GuidingBookStr+__ExtensionStr
						),
						['.py','.md','.tex']
				)),
				self.FolderedDirKeyStrsList
		)

		#debug
		'''
		self.debug(
			[
				('self.',self,[
						'ScriptbookedFileKeyStrsList'
					])
			]
		)
		'''
		
		#Definition
		ScriptbookedPageStrsList=map(
			lambda __ScriptbookerScriptbookFileKeyStr:
			Guider.GuidingSortStr.join(
				__ScriptbookerScriptbookFileKeyStr.split(
					Guider.GuidingSortStr)[1:]
				),
			self.ScriptbookedFileKeyStrsList
		)

		#set
		self.ScriptbookedSortDict=dict(
				zip(
						ScriptbookedPageStrsList,
						self.ScriptbookedFileKeyStrsList
					)
			)

		#debug
		'''
		self.debug(('self.',self,['ScriptbookedSortDict']))
		'''
		
		#Check
		if len(self.ScriptbookingGuideTuplesList)>0:

			#map
			ScriptbookedGuideTuplesList=map(
					lambda __ScriptbookingGuideTuple:
					list(__ScriptbookingGuideTuple)+[
						__ScriptbookingGuideTuple[1]+self.GuidingBookStr+dict(
						Guider.GuideFormatTuplesList
						)[
							__ScriptbookingGuideTuple[2]
						]
					],
					self.ScriptbookingGuideTuplesList
				)

			#groupby
			[
				self.ScriptbookedNewGuideTuplesList,
				self.ScriptbookedOldGuideTuplesList
			]=SYS.groupby(
				lambda __ScriptbookedGuideTuple:
				__ScriptbookedGuideTuple[3] not in self.ScriptbookedSortDict,
				ScriptbookedGuideTuplesList
			)

			#debug
			'''
			self.debug(
				[
					('self.',self,[
							'ScriptbookedNewGuideTuplesList'
						])
				]
			)
			'''
			
			#map a guide for the news
			map(
				lambda __ScriptbookedNewGuideTuple:
				self.guide(
					__ScriptbookedNewGuideTuple[0],
					__ScriptbookedNewGuideTuple[1],
					self.GuidingBookStr,
					__ScriptbookedNewGuideTuple[2]
				),
				self.ScriptbookedNewGuideTuplesList
			)

			#debug
			'''
			self.debug(
				[
					('self.',self,[
							'ScriptbookedOldGuideTuplesList',
							'ScriptbookedSortDict'
						])
				]
			)
			'''

			#check if we rewrite for the olds
			map(
				lambda __ScriptbookedOldGuideTuple:
				self.file(
					_ModeStr='c'
				) 
				if "#FrozenIsBool True" in self.file(
						self.ScriptbookedSortDict[
								__ScriptbookedOldGuideTuple[3]
							],
						_ModeStr='r',
						_FormatStr='txt'
					).FiledReadVariable
				else self.file(
						_ModeStr='c'
					).guide(
						__ScriptbookedOldGuideTuple[0],
						__ScriptbookedOldGuideTuple[1],
						self.GuidingBookStr,
						__ScriptbookedOldGuideTuple[2]
					),
				self.ScriptbookedOldGuideTuplesList
			)
예제 #25
0
	def do__class(self):

		#Definition the MethodsList
		ClassedFunctionsList=SYS._filter(
			lambda __ListedVariable:
				type(__ListedVariable).__name__=="function"
				if hasattr(__ListedVariable,'__name__')
				else False,
				self.DoClass.__dict__.values()
		)

		#debug
		'''
		print('l 66 Classer')
		print("ClassedFunctionsList is ",WatchedFunctionsList)
		print('Set all the mimick methods')
		print('')
		'''

		#/###################/#
		# Mimic all that you can find 
		#

		#Get all the hooking methods
		ClassedMimickFunctionsList=SYS._filter(
			lambda __ListedVariable:
			__ListedVariable.__name__.startswith(
					Mimicker.MimickingWrapPrefixStr
			)
			if hasattr(__ListedVariable,'__name__')
			else False,
			ClassedFunctionsList
		)

		#debug
		'''
		print('l 82 Classer')
		print("ClassedMimickFunctionsList is ",ClassedMimickFunctionsList)
		print('')
		'''

		#map
		map(	
				lambda __ClassedMimickFunction:
				self.mimic(
					Mimicker.MimickingWrapPrefixStr.join(
						__ClassedMimickFunction.__name__.split(
							Mimicker.MimickingWrapPrefixStr)[1:]
						)
				),
				ClassedMimickFunctionsList
			)

		#/###################/#
		# Set the watch methods 
		#

		#debug
		'''
		print('l 104 Classer')
		print('set the watch functions')
		print('self.ClassingWatchMethodStrsList is ',self.ClassingWatchMethodStrsList)
		print('self.DoClass.DoMethodStr is ',self.DoClass.DoMethodStr)
		print('')
		'''
		
		#map
		map(	
				lambda __ClassingWatchUnboundMethodStr:
				self.watch(
					True,
					**{'ObservingWrapMethodStr':__ClassingWatchUnboundMethodStr}
				),
				self.ClassingWatchMethodStrsList
			)

		#/###################/#
		# Set the switch methods 
		#

		#debug
		'''
		print('l 104 Classer')
		print('set the switch functions')
		print('self.ClassingSwitchMethodStrsList is ',self.ClassingSwitchMethodStrsList)
		print('self.DoClass.DoMethodStr is ',self.DoClass.DoMethodStr)
		print('')
		'''
		
		#map
		map(	
				lambda __ClassingSwitchUnboundMethodStr:
				self.switch(
					True,
					__ClassingSwitchUnboundMethodStr
				),
				self.ClassingSwitchMethodStrsList
			)

		#/###################/#
		# Check for overriden propertize_ methods 
		#

		#Debug
		'''
		print('Classer l 125')
		print('Check for overriden propertize_ methods ')
		print('self.DoClass.InspectMethodDict')
		print(self.DoClass.InspectMethodDict)
		print('')
		'''

		#filter
		ClassedPropertyNewMethodDict=dict(
			SYS._filter(
				lambda __MethodItemTuple:
				__MethodItemTuple[0].startswith(
						Propertiser.PropertyPrefixStr
					) and (
					SYS.getNewMethodBool(self.DoClass,__MethodItemTuple[0])
					#getattr(
					#	self.DoClass.__bases__[0],
					#	__MethodItemTuple[0]
					#)!=__MethodItemTuple[1]
					#if hasattr(self.DoClass.__bases__[0],
					#	__MethodItemTuple[0]
					#) else True
				),
				self.DoClass.InspectMethodDict.items()
			)
		)

		#Debug
		'''
		print('Classer l 147')
		print('self.DoClass is ')
		print(self.DoClass)
		print('ClassedPropertyNewMethodDict is')
		print(SYS.indent(ClassedPropertyNewMethodDict))
		print('')
		'''
		
		#map
		ClassedPropertyKeyStrsList=map(
				lambda __PropertizedKeyStr:
				SYS.deprefix(
					__PropertizedKeyStr,
					Propertiser.PropertyPrefixStr
				)[3:],
				ClassedPropertyNewMethodDict.keys()
			)

		#map reset the properties
		map(
				lambda __PropertyKeyStr:
				setattr(
						self.DoClass,
						__PropertyKeyStr,
						property(
								getattr(
									self.DoClass,
									Propertiser.PropertyPrefixStr+'get'+__PropertyKeyStr
								),
								getattr(
									self.DoClass,
									Propertiser.PropertyPrefixStr+'set'+__PropertyKeyStr
								),
								getattr(
									self.DoClass,
									Propertiser.PropertyPrefixStr+'del'+__PropertyKeyStr
								)
							)
					),
				ClassedPropertyKeyStrsList
			)

		#/###################/#
		# Set maybe a structure 
		#

		#Check
		if self.ClassingStructureVariable!=None:

			#Check
			if hasattr(
					self.ClassingStructureVariable,'items'
				):
				ClassedStructureVariable=self.ClassingStructureVariable.items()
			else:
				ClassedStructureVariable=self.ClassingStructureVariable


			#debug
			'''
			print('Classer l 241')
			print('We structure here')
			print('self.ClassingStructureVariable is ')
			print(self.ClassingStructureVariable)
			print('')
			'''

			#map add the sing plurals
			map(
				lambda __ItemTuple:
				SYS.addSingPlural(
					*__ItemTuple
				),
				ClassedStructureVariable
			)

			#Define a class
			class StructureClass(SYS.StructurerClass):pass
			StructureClass.__name__=SYS.getClassStrWithNameStr(self.DoClass.NameStr+'sStructurer')
			StructureClass.ManagingValueClass=self.DoClass

			#set
			setattr(
				self.Module,
				StructureClass.__name__,
				StructureClass
			)

			#dict
			ClassesDict=dict(
					map(
						lambda __ItemTuple:
						(__ItemTuple[1],StructureClass),
						ClassedStructureVariable
					)
				)

			#map
			if self.DoClass.TeamingClassesDict==None:
				self.DoClass.TeamingClassesDict=ClassesDict
			else:
				self.DoClass.TeamingClassesDict.update(
					ClassesDict
				)
예제 #26
0
	def do_clone(self):

		#filter
		self.ClonedItemTuplesList=SYS._filter(
				lambda __ItemTuple:
				__ItemTuple[0] not in self.CloningNotCopyKeyStringsList,
				self.__dict__.items()
			)

		"""
		#global
		global CloningIdStringsList

		#check
		if self.CloningResetBool:
			CloningIdStringsList=[]
			self.CloningIdsDict={}

		#if self.IdString in CloningIdStringsList:

		#return 

		#append
		#CloningIdStringsList.append(id(self))

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

		#debug
		self.ClonedValueTuplesList=[]
		for __ClonedItemTuple in self.ClonedItemTuplesList:

			print('__ClonedItemTuple[0] is ',__ClonedItemTuple[0])
			print('__ClonedItemTuple[1] is ',__ClonedItemTuple[1])
			print('')

			ClonedIdString=id(__ClonedItemTuple[1])
			if hasattr(
						__ClonedItemTuple[1],
						'clone'
					):

				print('IdString in CloningIdStringsList is ',ClonedIdString in CloningIdStringsList)
				print('')

				#Check
				if ClonedIdString in CloningIdStringsList:
	
					#
					self.ClonedValueTuplesList.append(self.CloningIdsDict[ClonedIdString])

				else:

					#append
					CloningIdStringsList.append(ClonedIdString)

					#set
					self.CloningIdsDict[ClonedIdString]=__ClonedItemTuple[1]

					#append
					self.ClonedValueTuplesList.append(
						__ClonedItemTuple[1].clone(
							self.CloningIdsDict,
							self.CloningNotCopyKeyStringsList
						)
					)

			else:

				self.ClonedValueTuplesList.append(
					getCopiedMutableVariableWithMutableVariable(__ClonedItemTuple[1],
						**{
							'CloningIdsDict':self.CloningIdsDict,
							'CloningNotCopyKeyStringsList':self.CloningNotCopyKeyStringsList
						})
				)

		'''
		#copy or clone
		self.ClonedValueTuplesList=map(
			lambda __ClonedValueTuple:
			__ClonedValueTuple.clone() if hasattr(
					__ClonedValueTuple,
					'clone'
				)
			else getCopiedMutableVariableWithMutableVariable(__ClonedValueTuple),
			SYS.unzip(self.ClonedItemTuplesList,[1])
		)
		'''
			
		#update
		self.CloningIdsDict[self.IdString]=self.ClonedCopyVariable
		

		#instance
		self.ClonedCopyVariable=self.__class__(
				**dict(	
				copy.deepcopy(
						self.ClonedItemTuplesList
						#zip(
						#	SYS.unzip(self.ClonedItemTuplesList,[0]),
						#	self.ClonedValueTuplesList
						#	)
				)
			)
		)
		"""	
		
		for __ClonedItemTuple in self.ClonedItemTuplesList:
			print(__ClonedItemTuple)
			copy.deepcopy(__ClonedItemTuple)

		#copy
		self.ClonedCopyVariable=copy.deepcopy(self)


		#return
		return self.ClonedCopyVariable
    def do_switch(self):

        # get
        self.SwitchingMethodFunction = getattr(self.DoClass, self.SwitchingMethodStr)

        # debug
        self.debug(("self.", self, ["SwitchingMethodFunction"]))

        # set the SwitchedFunctionStr this is the functing function..and we remove all the tagged Functer@
        self.SwitchedFunctionStr = self.SwitchingMethodFunction.__name__.split(Functer.FunctingDecorationStr)[-1]

        # debug
        """
		self.debug(('self.',self,['SwitchedFunctionStr']))
		"""

        # Check
        if self.SwitchedFunctionStr.startswith(Doer.DoingDoMethodStr):
            self.SwitchedFunctionStr = Doer.DoingDoMethodStr.join(
                self.SwitchedFunctionStr.split(Doer.DoingDoMethodStr)[1:]
            )

            # Definition
        SwitchedDoStr = self.SwitchedFunctionStr[0].upper() + self.SwitchedFunctionStr[1:]

        # Debug
        """
		print('SwitchedDoStr is ',SwitchedDoStr)
		print('')
		"""

        # Set
        self.SwitchedBoolSuffixStr = SwitchedDoStr + "Bool"
        self.SwitchedInstanceBoolKeyStr = "Switch" + self.SwitchedBoolSuffixStr

        # debug
        """
		self.debug(
			('self.',self,[
				'SwitchedInstanceBoolKeyStr'
			]))
		"""

        # Definition the SwitchedFunction
        def SwitchedFunction(*_LiargVariablesList, **_KwargVariablesDict):

            # debug
            """
			self.debug('We are in the SwitchedFunction !')
			"""

            # Alias
            InstanceVariable = _LiargVariablesList[0]

            # debug
            """
			self.debug(
						[
							('self.',self,['SwitchedInstanceBoolKeyStr']),
							Representer.represent(InstanceVariable,**{'RepresentingAlineaIsBool':False})
						]
					)
			"""

            if hasattr(InstanceVariable, self.SwitchedInstanceBoolKeyStr) == False:

                # set at the instance level
                InstanceVariable.__setattr__(self.SwitchedInstanceBoolKeyStr, False)

            elif getattr(InstanceVariable, self.SwitchedInstanceBoolKeyStr):

                # debug
                """
				self.debug('The Instance has already done this method')
				"""

                # Return
                return InstanceVariable

                # Call the SwitchingMethodFunction
            self.SwitchingMethodFunction(*_LiargVariablesList, **_KwargVariablesDict)

            # set True for the Bool after the call
            InstanceVariable.__setattr__(self.SwitchedInstanceBoolKeyStr, True)

            # debug
            """
			self.debug(('InstanceVariable.',InstanceVariable,[self.SwitchedBoolSuffixStr]))
			"""

            # Return self for the wrapped method call
            return InstanceVariable

            # Definition the SwitchedDoerStr

        SwitchedDoerStr = Doer.getDoerStrWithDoStr(SwitchedDoStr)

        # debug
        """
		print('SwitchedDoerStr is ',SwitchedDoerStr)
		print('')
		"""

        # Find the corresponding base class to reinit
        SwitchedDoerClass = SYS._filter(
            lambda __MroClass: SwitchedDoerStr == SYS.getNameStrWithClassStr(__MroClass.__name__), self.DoClass.__mro__
        )[0]

        # Definition the triggering function that will call the init one
        def triggerBefore(*_TriggeringVariablesList, **_TriggeringVariablesDict):

            # Alias
            TriggeredInstanceVariable = _TriggeringVariablesList[0]

            # debug
            """
			self.debug('Reinit with '+Representer.represent(
				TriggeredInstanceVariable.SettingKeyVariable,**{'RepresentingAlineaIsBool':False}
				)
			)
			"""

            # Update with the DoneAttributeVariablesOrderedDict
            map(
                lambda __ItemTuple: TriggeredInstanceVariable.__setattr__(__ItemTuple[0], __ItemTuple[1]),
                SwitchedDoerClass.DoneAttributeVariablesOrderedDict.items(),
            )

            # set the name

        TriggeredBeforeMethodStr = "triggerBeforeWith" + self.SwitchedBoolSuffixStr
        triggerBefore.__name__ = TriggeredBeforeMethodStr

        # debug
        """
		self.debug(
					[
						("SwitchedClass is "+str(SwitchedClass)),
						("TriggeredBeforeMethodStr is "+TriggeredBeforeMethodStr),
						("Get Method is "+str(getattr(
							SwitchedClass,
							TriggeredBeforeMethodStr)
						) if hasattr(SwitchedClass,
							TriggeredBeforeMethodStr) else "None")
					]
				)
		"""

        # Link the triggerBefore function
        setattr(
            self.DoClass,
            TriggeredBeforeMethodStr,
            Triggerer.TriggererClass(
                **{
                    "TriggeringConditionVariable": [
                        ("SettingKeyVariable", (operator.eq, self.SwitchedInstanceBoolKeyStr)),
                        (self.SwitchedInstanceBoolKeyStr, (operator.eq, True)),
                        ("SettingValueVariable", (operator.eq, False)),
                    ],
                    "TriggeringHookStr": "Before",
                }
            )(triggerBefore),
        )
		#Check
		if hasattr(DoClass,'DefaultAttributeItemTuplesList'):
			
			#Debug
			'''
			print('Doer l.383')
			print('DoClass.DefaultAttributeItemTuplesList is ',_Class.DefaultAttributeItemTuplesList)
			print('')
			'''

			#Check for doing and done keyStrs
			DoClass.DoneAttributeVariablesOrderedDict=collections.OrderedDict(
				SYS._filter(
				lambda __DefaultAttributeItemTuple:
				__DefaultAttributeItemTuple[0].startswith(DoneStr),
				DoClass.DefaultAttributeItemTuplesList
				)
			)
			DoClass.DoingAttributeVariablesOrderedDict=collections.OrderedDict(
				SYS._filter(
				lambda __DefaultAttributeItemTuple:
				__DefaultAttributeItemTuple[0].startswith(DoingStr),
				DoClass.DefaultAttributeItemTuplesList
				)
			)

			#Definition
			DoWrapMethodStr=DoingWrapPrefixStr+DoMethodStr

			#Debug
예제 #29
0
	def mapConnect(self,_TeamPrefixStr='Connect',_GetterVariable=None):

		#/################/#
		#  Check the level
		#

		#debug
		'''
		self.debug(
			[
				'We map connect here',
				'_TeamPrefixStr is '+_TeamPrefixStr
			]
		)
		'''

		#filter
		TeamTagStrsList=SYS._filter(
			lambda __KeyStr:
			__KeyStr.startswith(_TeamPrefixStr),
			self.TeamDict.keys()
		)

		#Check
		if len(TeamTagStrsList)==1:

			#get
			TeamTagStr=TeamTagStrsList[0]

			#debug
			'''
			self.debug(
				[
					'TeamTagStr is '+TeamTagStr,
				]
			)
			'''

			#/#################/#
			#  omes level
			#

			#Check
			if TeamTagStr.endswith('omes'):

				#map
				map(
					lambda __DeriveConnecter:
					__DeriveConnecter.mapConnect(
						_TeamPrefixStr,
						self
					),
					self.TeamDict[
						TeamTagStr
					].ManagementDict.values()
				)
					
			else:

				#/#################/#
				#  ions level
				#

				#setConnections
				self.setConnections(TeamTagStr,_GetterVariable)
예제 #30
0
	def mapCondition(self,_MapConditionVariable,_MapScanVariable,_DirectBool=False):

		#debug
		'''
		self.debug(
			[
				'We map condition here'
			]
		)
		'''

		#Check
		if _DirectBool==False:

			#filter
			ConditionList=SYS._filter(
				lambda __TestVariable:
				any(
					map(
						lambda __OrList:
						all(
							map(
								lambda __AndTuple:
								self.condition(
									__TestVariable,
									__AndTuple[0],
									__AndTuple[1]
								).ConditionedIsBool,
								__OrList
							)
						),
						_MapConditionVariable
					)
				),
				_MapScanVariable
			)

		else:

			#filter
			ConditionList=SYS._filter(
				lambda __TestVariable:
				any(
					map(
						lambda __OrList:
						all(
							map(
								lambda __AndTuple:
								__AndTuple[0](
									__TestVariable,
									__AndTuple[1]
								),
								__OrList
							)
						),
						_MapConditionVariable
					)
				),
				_MapScanVariable
			)

		#return
		return ConditionList