Пример #1
0
	def mimic_set(self):
		""" """

		#debug
		'''
		self.debug(('self.',self,['SettingKeyVariable','SettingValueVariable']))
		'''

		#Check
		if type(self.SettingKeyVariable
			)==str:

			#Check
			if self.SettingKeyVariable.startswith(AttributionInstancePrefixStr):

				#debug
				'''
				self.debug('We are going to attribute to the instance')
				'''

				#Path
				self.attribute(
					SYS.deprefix(
						self.SettingKeyVariable,
						AttributionInstancePrefixStr
					),
					self.SettingValueVariable,
					_InstanceBool=True,
					_ClassBool=False
				)

				#Stop the setting
				return {'HookingIsBool':False}

			elif self.SettingKeyVariable.startswith(AttributionClassPrefixStr):

				#debug
				'''
				self.debug('We are going to attribute to the class')
				'''

				#Path
				self.attribute(
					SYS.deprefix(
						self.SettingKeyVariable,
						AttributionClassPrefixStr
					),
					self.SettingValueVariable,
					_InstanceBool=False,
					_ClassBool=True,
				)

				#Stop the setting
				return {'HookingIsBool':False}

			
		#Set and return 
		return BaseClass.set(self)
Пример #2
0
	def mimic_get(self):

		#Check
		if type(self.GettingKeyVariable)==str:

			#Check
			if self.GettingKeyVariable.startswith(ConnectGetSetPrefixStr):

				#debug
				'''
				self.debug(
						[
							'We get connect here',
							('self.',self,['GettingKeyVariable'])
						]
					)
				'''

				#connect
				self.connect(
						SYS.deprefix(
							self.GettingKeyVariable,
							ConnectGetSetPrefixStr
						)
					)

				#return
				return {'HookingIsBool':False}

		#set
		BaseClass.get(self)
	def mimic_set(self):

		#Definition
		OutputDict={'HookingIsBool':True}

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

		#Check
		if type(
			self.SettingKeyVariable
		)==str and self.SettingKeyVariable.startswith(TeamChildPrefixStr):

			#debug
			'''
			self.debug('We team here')
			'''
			
			#team
			self.team(
				SYS.deprefix(
					self.SettingKeyVariable,
					TeamChildPrefixStr
				),
				self.SettingValueVariable
			)

			#Stop the setting
			OutputDict["HookingIsBool"]=False 

		#Call the parent get method
		if OutputDict['HookingIsBool']:
			return BaseClass.set(self)
Пример #4
0
	def mimic_get(self):

		#get
		if type(self.GettingKeyVariable
			)==str:

			#Check
			if self.GettingKeyVariable.startswith(AttributionInstancePrefixStr):

				#debug
				'''
				self.debug('We are going to get into the instance')
				'''

				#get
				self.GettedValueVariable=self.__dict__[
					SYS.deprefix(
						self.GettingKeyVariable,
						AttributionInstancePrefixStr
					)
				]

				#Stop the setting
				return {'HookingIsBool':False}

			elif self.GettingKeyVariable.startswith(AttributionClassPrefixStr):

				#debug
				'''
				self.debug('We are going to get from the class')
				'''

				#Path
				self.GettedValueVariable=self.__class__.__dict__[
					SYS.deprefix(
						self.GettingKeyVariable,
						AttributionClassPrefixStr
					)
				]

				#Stop the setting
				return {'HookingIsBool':False}

		#return 
		return BaseClass.get(self)
	def mimic_get(self):

		#Definition
		OutputDict={'HookingIsBool':True}

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

		#Check
		if self.GettingKeyVariable==TeamParentManagerPrefixStr+'Manager':
			
			#alias
			self.GettedValueVariable=self.ManagementPointDeriveManager

			#Stop the setting
			OutputDict["HookingIsBool"]=False 

		#Check
		if self.GettingKeyVariable==Manager.ManagementParentTeamerPrefixStr+'Teamer':
			
			#alias
			if self.ManagementPointDeriveManager!=None:
				self.GettedValueVariable=self.ManagementPointDeriveManager.TeamPointDeriveTeamer
			else:
				self.GettedValueVariable=None

			#Stop the setting
			OutputDict["HookingIsBool"]=False 

		#Check
		elif type(
			self.GettingKeyVariable
		)==str and self.GettingKeyVariable.startswith(TeamChildPrefixStr):

			#debug
			'''
			self.debug('We team here')
			'''

			#team
			self.GettedValueVariable=self.team(
				SYS.deprefix(
					self.GettingKeyVariable,
					TeamChildPrefixStr
				)
			).TeamedValueVariable

			#Stop the setting
			OutputDict["HookingIsBool"]=False 

		#Call the parent get method
		if OutputDict['HookingIsBool']:
			return BaseClass.get(self)
Пример #6
0
    def mimic_get(self):

        # Check
        if type(self.GettingKeyVariable) == str:

            # Check
            if self.GettingKeyVariable.startswith(ProcessPrefixStr):

                # deprefix
                GetProcessBashStr = SYS.deprefix(self.GettingKeyVariable, ProcessPrefixStr)

                # process
                self.process(GetProcessBashStr)

                # set
                self.GettedValueVariable = self.ProcessedBashStr

                # stop
                return {"HookingIsBool": False}

                # Cal the base method
        BaseClass.get(self)
Пример #7
0
	def do_get(self):
		""" """

		#debug
		'''
		self.debug(
			[
				("self.",self,[
						'GettingKeyVariable',
						'NameStr',
						'GettingItemBool'
					]
				)
			]
		)
		'''
		
		#itemize first
		if self.GettingItemBool:

			#debug
			'''
			self.debug('first we itemize')
			'''

			#Check
			if self.GettingKeyVariable==GetMapStr:

				#set
				self.ItemizingMapGetVariable='GettedValueVariable'

			#itemize
			self.itemize(
					self.GettingKeyVariable
				)

			#Check
			#if self.GettingKeyVariable==GetMapStr:
			#
			#	#set
			#	self.GettingItemBool=False

		else:

			#set
			self.ItemizedValueMethod=None

			#set
			#self.GettingItemBool=True

		#/############################
		# Case of a method get 
		#

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

		#Check 
		if self.ItemizedValueMethod!=None:

			#debug
			'''
			self.debug(
				[
					'This is a method get',
					('self.',self,[
						'ItemizedValueMethod',
						'ItemizingMapGetVariable'
						]
					)
				]
			)
			'''

			#alias
			self.GettedValueVariable=self.ItemizedValueMethod

			#Stop the getting
			return {"HookingIsBool":False}
		

		#/############################
		# Case of a GetClass get
		#

		#Check
		if type(self.GettingKeyVariable)==GetClass:

			#Check
			if self.GettingKeyVariable.SelfVariable==None:
				self.GettingKeyVariable.SelfVariable=self

			#call
			self.GettedValueVariable=self.GettingKeyVariable()

			#Stop the getting
			return {"HookingIsBool":False}


		#/############################
		# Cases of a key str get 
		#

		#Check
		if type(self.GettingKeyVariable) in [str,unicode]:

			#debug
			'''
			self.debug(
					[	
						'This is a non method get',
						('self.',self,[
							'GettingKeyVariable',
							'GettingNewBool'
						])
					]
			)
			'''

			'''
			#/############################
			# Case of a delete in the instance __dict__ 
			#

			if self.GettingKeyVariable.startswith(GetDeletePrefixStr)

				#delete
				del self.__dict__[
					SYS.deprefix(
						self.GettingKeyVariable,
						GetDeletePrefixStr
					)
				]

				#Stop the getting
				return {"HookingIsBool":False}
			'''

			#/############################
			# Case of a direct str get 
			#

			if self.GettingKeyVariable.startswith(GetDirectPrefixStr):

				#debug
				'''
				self.debug('This is a direct get of a str variable')
				'''

				#set
				self.GettedValueVariable=SYS.deprefix(
					self.GettingKeyVariable,
					GetDirectPrefixStr
				)

				#Stop the getting
				return {"HookingIsBool":False}

			#/############################
			# Case of a call str get 
			#

			if self.GettingKeyVariable.startswith(GetCallPrefixStr):

				#get
				GettedMethod=self[
					SYS.deprefix(
						self.GettingKeyVariable,
						GetCallPrefixStr
					)
				]

				#debug
				'''
				self.debug(
					[
						'This is a call get of a str variable',
						'GettedMethod is '+SYS._str(GettedMethod)
					]
				)
				'''
				
				if type(GettedMethod)==types.MethodType:

					#set
					self.GettedValueVariable=GettedMethod()

				else:

					#set
					self.GettedValueVariable=GettedMethod(self)

				#Stop the getting
				return {"HookingIsBool":False}


			#/############################
			# Case of a #id: get of an instance thanks to its id 
			#

			elif self.GettingKeyVariable.startswith(GetIdPrefixStr):

				#deprefix
				GettedKeyStr=SYS.deprefix(
						self.GettingKeyVariable,
						GetIdPrefixStr
					)

				#debug
				'''
				self.debug(
					[
						'This is a id get ',
						'GettedKeyStr is '+GettedKeyStr
					]
				)
				'''

				#IdDict
				self.GettedValueVariable=SYS.IdDict[
					int(GettedKeyStr)
				]

				#Stop the getting
				return {"HookingIsBool":False}


			#/############################
			# Case of a #get: str get 
			#

			elif self.GettingKeyVariable.startswith(GetUndirectPrefixStr):

				#deprefix
				GettedKeyStr=SYS.deprefix(
						self.GettingKeyVariable,
						GetUndirectPrefixStr
					)

				#debug
				'''
				self.debug(
					[
						'This is a undirect of a str variable',
						'GettedKeyStr is '+GettedKeyStr
					]
				)
				'''

				#Check
				if GetUndirectPrefixStr in GettedKeyStr:

					#split
					GettedKeyStrsList=GettedKeyStr.split(GetUndirectPrefixStr)

					#define
					GettedRecursiveKeyStr=''.join(GettedKeyStrsList[:-1])+self[GettedKeyStrsList[-1]]

					#debug
					'''
					self.debug(
							[
								'This is a recursive undirect get',
								'GettedRecursiveKeyStr is '+GettedRecursiveKeyStr
							]
						)
					'''

					#set
					self.GettedValueVariable=self[
						GetUndirectPrefixStr+GettedRecursiveKeyStr
					]

				else:

					#debug
					'''
					self.debug(
							'This is one level undirect get'
						)
					'''

					#set
					self.GettedValueVariable=self[
						self[GettedKeyStr]
					]

				#Stop the getting
				return {"HookingIsBool":False}

			#/############################
			# Case of a get in the instance __dict__ 
			#

			#Get safely the Value
			elif self.GettingKeyVariable in self.__dict__:

				#debug
				'''
				self.debug(
					[
						'self.GettingKeyVariable exists in the __dict__',
						self.GettingKeyVariable
					]
				)
				'''
				
				#__getitem__ in the __dict__
				self.GettedValueVariable=self.__dict__[
					self.GettingKeyVariable
				]

				#Check
				if type(self.GettedValueVariable)==GetClass:

					#debug
					'''
					self.debug(
						[
							'Actually the getted value is a GetClass'
						]
					)
					'''
					
					#set
					self.GettedValueVariable.SelfVariable=self

					#call
					self.GettedValueVariable=self.GettedValueVariable()


				#debug
				'''
				self.debug(
							[
								'This is a Spe in Instance',
								('self.',self,['GettedValueVariable'])
							]
						)
				'''

				#Stop the getting
				return {"HookingIsBool":False}
			
			#/############################
			# Case of the __class__ get
			#

			#Check
			elif self.GettingKeyVariable=='__class__':

				#set
				self.GettedValueVariable=self.__class__

				#Stop the getting
				return {"HookingIsBool":False}

			#/############################
			# Case of a get in the instance __dict__ 
			#

			#Check
			elif self.GettingKeyVariable in self.__class__.__dict__:

				#debug
				'''
				self.debug(
						[
							'this is in a class __dict__',
							('self.',self,['GettingKeyVariable'])
						]
					)
				'''
				
				#get
				GettedClassValueVariable=self.__class__.__dict__[
					self.GettingKeyVariable
				]

				#/############################
				# Case of a get of a property
				#

				if type(GettedClassValueVariable)==property:

					#get by the reactive getattr
					self.GettedValueVariable=getattr(self,self.GettingKeyVariable)

				else:

					#__getitem__ in the __class__
					self.GettedValueVariable=GettedClassValueVariable

				#debug
				'''
				self.debug(
							[
								'This is in the __class__',
								('self.',self,['GettedValueVariable'])
							]
						)
				'''

				#Stop the getting
				return {"HookingIsBool":False}

			elif self.GettingNewBool:

				#debug
				'''
				self.debug(
						[
							'we are going to set a default value here',
							('self.',self,['GettingKeyVariable'])
						]
					)
				'''

				#get
				GettedValueType=SYS.getTypeClassWithTypeStr(
					SYS.getTypeStrWithKeyStr(
						self.GettingKeyVariable)
				)

				#debug
				'''
				self.debug(
					[
						'GettedValueType is '+str(GettedValueType),
						('self.',self,['GettingKeyVariable'])
					]
				)
				'''
				
				#Check
				if callable(GettedValueType):

					#debug
					self.debug(
						[
							'We call here',
							'GettedValueType is '+str(GettedValueType),
							('self.',self,['GettingKeyVariable'])
						]
					)
					
					#alias
					self.GettedValueVariable=GettedValueType()

					#set a default value
					self.__setattr__(
						self.GettingKeyVariable,
						self.GettedValueVariable
					)
					
					#add in the SettingValue
					try:
						self.GettedValueVariable.SetTagStr=self.GettingKeyVariable
						self.GettedValueVariable.SetDeriveSetter=self
					except:
						pass

				#Stop the getting
				return {"HookingIsBool":False}


		#/############################
		# Cases of a dict GetVariable get 
		#

		elif hasattr(self.GettingKeyVariable,'items'
			) and type(self.GettingKeyVariable)!=type:

			#debug
			'''
			self.debug(
				[
					'we get or set with an itemizable instance',
					('self.',self,['GettingKeyVariable'])
				]
			)
			'''
			
			#Init
			GettedReturnBool=False

			#Temp
			GettedTempGettingKeyVariable=self.GettingKeyVariable

			#Check
			if GetGrabStr in GettedTempGettingKeyVariable:

				#debug
				'''
				self.debug(
					[
						'we get with the GetGrabStr'
					]	
				)
				'''
				
				#get
				self.GettedValueVariable=self[
					GettedTempGettingKeyVariable[GetGrabStr]
				]

				#set
				GettedReturnBool=True	

			elif GetUndirectGrabStr in GettedTempGettingKeyVariable:

				#get
				GettedKeyStr=GettedTempGettingKeyVariable[GetUndirectGrabStr]

				#debug
				'''
				self.debug(
					[
						'we get with the GetUndirectGrabStr',
						('self.',self,['GettingKeyVariable']),
						'GettedKeyStr is '+GettedKeyStr
					]	
				)
				'''

				#get get
				self.GettedValueVariable=self[
					self[
							GettedKeyStr
						]
				]

				#set
				GettedReturnBool=True	


			#Check
			elif GetMapUndirectGrabStr in GettedTempGettingKeyVariable:

				#get
				GettedLiargVariablesList=GettedTempGettingKeyVariable[
					GetMapUndirectGrabStr
				]

				#debug
				'''
				self.debug(
					[
						'we get with the GetMapUndirectGrabStr',
						('self.',self,['GettingKeyVariable']),
						'GettedLiargVariablesList is '+SYS._str(GettedLiargVariablesList)
					]	
				)
				'''
				
				#get
				self.GettedValueVariable=self[
					SYS.deprefix(
						GetMapUndirectGrabStr,
						GetUndirectGrabPrefixStr
					)
				](
					*GettedLiargVariablesList
				).ItemizedMapValueVariablesList

				#set
				GettedReturnBool=True				

			#/##################/#
			# Case of a modification 
			#

			#Check
			if GetModifyGrabStr in GettedTempGettingKeyVariable:

				#debug
				'''
				self.debug(
						'We modify here '
					)
				'''

				#call 
				#self.GettedValueVariable=GettedTempGettingKeyVariable[
				#		GetModifyGrabStr
				#]()
				self.GettedValueVariable=self[
					GettedTempGettingKeyVariable[GetModifyGrabStr]
				]

			if GetSetGrabStr in GettedTempGettingKeyVariable:

				#debug
				'''
				self.debug(
						'We set here in the GettedValueVariable'
					)
				'''

				#get
				SetVariable=GettedTempGettingKeyVariable[GetSetGrabStr]

				#set
				self.GettedValueVariable[
					SetVariable[0]
				]=SetVariable[1]

			elif GetMapSetGrabStr in GettedTempGettingKeyVariable:

				#debug
				'''
				self.debug(
						'We map a set here in the GettedValueVariable'
					)
				'''

				#get
				SetVariable=GettedTempGettingKeyVariable[GetMapSetGrabStr]

				#Check
				if hasattr(SetVariable,'items'):
					SetVariablesList=SetVariable.items()
				else:
					SetVariablesList=SetVariable

				#set
				map(
						lambda __SetVariable:
						self.GettedValueVariable.__setitem__(
								__SetVariable[0],
								__SetVariable[1]
							),
						SetVariablesList
					)

			#Check
			if GettedReturnBool:

				#Stop the getting
				return {"HookingIsBool":False}

		#/############################
		# Cases of a direct get 
		#

		#elif hasattr(self.GettingKeyVariable,'MroClassesList'):
		if type(self.GettingKeyVariable)!=str:

			#debug
			'''
			self.debug('This is a direct get of a non str variable')
			'''

			#set
			self.GettedValueVariable=self.GettingKeyVariable

			#Stop the getting
			return {"HookingIsBool":False}

		#set
		self.GettedValueVariable=None

		#debug
		'''
		self.debug(
					[
						'Not found here so set it to None',
						('self.',self,['GettedValueVariable'])
					]
				)
		'''
		#Return an output dict
		return {"HookingIsBool":True}
	def do_set(self):
		""" """

		#debug
		'''
		self.debug(
			("self.",self,[
				'SettingKeyVariable',
				'SettingValueVariable'
			])
		)	
		'''
		
		#itemize first
		if self.SettingItemBool:

			#debug
			'''
			self.debug('first we itemize')
			'''

			#itemize
			self.itemize(
					self.SettingKeyVariable
				)

		else:

			#set
			self.ItemizedValueMethod=None

		#/############################
		# Case of a method get 
		#

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

		#Check 
		if self.ItemizedValueMethod!=None:

			#debug
			'''
			self.debug('we are going to call the method but first get it')
			'''

			#get
			SettedValueMethod=self[self.SettingKeyVariable]

			#debug
			'''
			self.debug('SettedValueMethod is '+str(SettedValueMethod))
			'''

			#define
			try:

				#get
				SettedLiargVariablesList=SettedValueMethod.im_func.BaseDoClass.Module.getLiargVariablesList(
					self.SettingValueVariable
				)

				'''
				self.debug(
						'SettedLiargVariablesList is '+str(SettedLiargVariablesList)
					)
				'''
				
				#get the method and put the value as arguments
				SettedValueMethod(*SettedLiargVariablesList)

			except:

				#debug
				'''
				self.debug('call the SettedValueMethod with self.SettingValueVariable directly')
				'''

				#direct
				#SettedValueMethod(*self.SettingValueVariable)
				SettedValueMethod(self.SettingValueVariable)

			#debug
			

			#Stop the setting
			return {"HookingIsBool":False}

		#/####################/#
		# Case of a non method  with set with a set key str 
		#

		elif type(self.SettingKeyVariable
				)==str:

			#/####################/#
			# Case of #each: set
			#

			#Check
			if self.SettingKeyVariable.startswith(
				SetEachPrefixStr
			):

				#get
				SettedGetVariable=self[
					SYS.deprefix(
						self.SettingKeyVariable,
						SetEachPrefixStr
					)
				]

				#Check
				if hasattr(SettedGetVariable,'values'):
					SettedGetVariablesList=SettedGetVariable.values()
				else:
					SettedGetVariablesList=SettedGetVariable

				#debug
				'''
				self.debug(
					[
						'SettedGetVariablesList is ',
						SYS._str(SettedGetVariablesList),
						('self.',self,['SettingValueVariable'])
					]
				)
				'''

				#map
				map(
						lambda __SettedGetVariable,__SettedValueVariable:
						__SettedGetVariable.set(
							*__SettedValueVariable
						)
						if type(__SettedValueVariable) in [
							list,tuple
						] and len(__SettedValueVariable)==2
						else
						__SettedGetVariable['#map@set'](
							__SettedValueVariable
						),
						SettedGetVariablesList,
						self.SettingValueVariable
					)

				#Return stop the setting
				return {'HookingIsBool':False}

			#/####################/#
			# Case of #all: set
			#

			#Check
			elif self.SettingKeyVariable.startswith(
				SetAllPrefixStr
			):

				#get
				SettedGetVariable=self[
					SYS.deprefix(
						self.SettingKeyVariable,
						SetAllPrefixStr
					)
				]

				#Check
				if hasattr(SettedGetVariable,'values'):
					SettedGetVariablesList=SettedGetVariable.values()
				else:
					SettedGetVariablesList=SettedGetVariable

				#debug
				'''
				self.debug(
					[
						'SettedGetVariablesList is ',
						SYS._str(SettedGetVariablesList),
						('self.',self,['SettingValueVariable'])
					]
				)
				'''

				#Check
				if type(self.SettingValueVariable) in [
							list,tuple
						] and len(self.SettingValueVariable)==2:

					#map
					map(
							lambda __SettedGetVariable:
							__SettedGetVariable.set(
								*self.SettingValueVariable
							),
							SettedGetVariablesList
						)

				else:

						
					#map
					map(
							lambda __SettedGetVariable:
							__SettedGetVariable['#map@set'](
								self.SettingValueVariable
							),
							SettedGetVariablesList
						)

				#Return stop the setting
				return {'HookingIsBool':False}

			#/####################/#
			# Case of a set in the __dict__
			#

			else:

				#/####################/#
				# Case of an instancing set
				#

				#Check
				if self.SettingTypeBool:

					#debug
					'''
					self.debug(
							[
								'we check if we have to set a default value here',
								('self.',self,[
									'SettingKeyVariable',
									'SettingValueVariable'
								])
							]
						)
					'''

					#get
					SettedValueType=SYS.getTypeClassWithTypeStr(
						SYS.getTypeStrWithKeyStr(
							self.SettingKeyVariable)
					)

					#Check
					if SettedValueType!=type(self.SettingValueVariable): 

						#debug
						'''
						self.debug(
							[
								'SettedValueType is '+str(SettedValueType)
							]
						)	
						'''

						#Check
						if SettedValueType!=None.__class__:

							#debug
							self.debug(
								[
									'we wrap the setting value',
									('self.',self,['SettingValueVariable'])
								]
							)

							#alias
							'''
							try:
							'''

							#map set
							self.SettingValueVariable=SettedValueType(
								)['#map@set'](
								self.SettingValueVariable
							)

							'''
							except:

								#debug
								self.debug(
										[
											'set failed because the suffix str indicates a different type from the value',
											'SettedValueType is '+str(SettedValueType),
											'type(self.SettingValueVariable) is '+str(
												type(self.SettingValueVariable))
										]
									)
							'''

				#debug
				'''
				self.debug(
					[
						'we just set in the __dict__',
						('self.',self,[
								'SettingKeyVariable',
								'SettingValueVariable'
							])
					]
				)
				'''

				#map
				'''
				if type(self.SettingKeyVariable)==SYS.MapListClass:

					#map
					map(
							lambda __MappedVariable:
							self.__setitem__(
								*__MappedVariable
							),
							self.SettingKeyVariable
						)

					#Return an output dict
					return {"HookingIsBool":False}
				else:
				'''

				#__setitem__ in the __dict__, this is an utility set
				self.__dict__[
					self.SettingKeyVariable
				]=self.SettingValueVariable

				#add in the SettingValue
				try:
					self.SettingValueVariable.SetTagStr=self.SettingKeyVariable
					#self.SettingValueVariable.SetDeriveSetter=self
				except:
					pass

				#Return
				return {'HookingIsBool':False}

		#/####################/#
		# Case of a non method  with set with a set dict
		#

		elif hasattr(self.SettingKeyVariable,'items'):

			#debug
			self.debug(
					[
						'SettingKeyVariable has items...',
						('self.',self,['SettingKeyVariable'])
					]
				)

			try:

				#debug
				self.debug(
						'We set with a SetKeyVariable'
					)

				#set
				self.set(
					self.SettingKeyVariable['SetKeyVariable'],
					self.SettingValueVariable
				)

				#delete
				del self.SettingKeyVariable['SetKeyVariable']

			except:

				#debug
				self.debug(
						'We set with a SetKeyVariable'
					)

				#set
				self.set(
					self.SettingKeyVariable['SetKeyVariable'],
					SYS.update(
						self.SettingKeyVariable,
						self.SettingValueVariable
					)
				)

				#delete
				del self.SettingKeyVariable['SetKeyVariable']

			#Return
			return {'HookingIsBool':False}
	def mimic_set(self):

		#Check
		if self.SettingKeyVariable in [
											PyplotPlotKeyStr,
											PyplotScatterKeyStr,
											PyplotBarKeyStr
										]:

			#/####################/#
			# first maybe pyplot if it was not already
			# 

			#debug
			'''
			self.debug(
					[
						'we maybe pyplot first',
					]
				)
			'''

			#pyplot
			self.pyplot()

			#/####################/#
			# Then add in the plot
			# 

			#debug
			'''
			self.debug(
					[
						'before plot',
						('self.',self,[
							#'PyplotedParentFigureDerivePyploterVariable',
							'SettingValueVariable'
						])
					]
				)
			'''

			#init
			PyplotPlotArgumentDict=Setter.ArgumentDict(
					self.SettingValueVariable,
					self.PyplotedParentFigureDerivePyploterVariable
				)

			#debug
			'''
			self.debug(
					[
						'We plot here',
						'PyplotPlotArgumentDict is',
						SYS._str(PyplotPlotArgumentDict)
					]
				)
			'''

			#plot
			self.PyplotedLinesList.append(
				self.PyplotedAxesVariable.plot(
					*PyplotPlotArgumentDict['LiargVariablesList'],
					**PyplotPlotArgumentDict['KwargVariablesDict']
				)[0]
			)

			#debug
			'''
			self.debug(
				[
					('self.',self,['PyplotedLinesList']),
					#str(self.PyplotedLinesList[0][0]),
				]
			)
			'''

			#return 
			return {'HookingIsBool':False}

		elif self.SettingKeyVariable==PyplotAxesKeyStr:

			#debug
			'''
			self.debug(
					[
						'before axes',
						('self.',self,[
							#'PyplotedParentFigureDerivePyploterVariable',
							'PyplotedAxesVariable'
						])
					]
				)
			'''

			#map
			ArgumentTuplesList=map(
					lambda __ItemTuple:
					(
						__ItemTuple[0],
						Setter.ArgumentDict(
								__ItemTuple[1],
								self.PyplotedParentFigureDerivePyploterVariable
							)
					),
					SYS.SetList(
						self.SettingValueVariable
					)
				)

			#debug
			'''
			self.debug(
					[
						'We axe here',
						'ArgumentTuplesList is ',
						SYS._str(ArgumentTuplesList),
					]
				)
			'''

			#map
			map(
					lambda __ArgumentTuple:
					SYS.get(
						self.PyplotedAxesVariable,
						__ArgumentTuple[0]
					)()
					if len(__ArgumentTuple[1]['LiargVariablesList']
						)==0 and __ArgumentTuple[1]['KwargVariablesDict']==None
					else(
						SYS.get(
							self.PyplotedAxesVariable,
							__ArgumentTuple[0]
						)(**__ArgumentTuple[1]['KwargVariablesDict'])
						if len(__ArgumentTuple[1]['LiargVariablesList']
						)==0
						else(
							SYS.get(
								self.PyplotedAxesVariable,
								__ArgumentTuple[0]
							)(
								*__ArgumentTuple[1]['LiargVariablesList'],
								**__ArgumentTuple[1]['KwargVariablesDict']
							) 
							if __ArgumentTuple[1]['KwargVariablesDict']!=None
							else
							SYS.get(
								self.PyplotedAxesVariable,
								__ArgumentTuple[0]
							)(
								*__ArgumentTuple[1]['LiargVariablesList']
							)
						)
					),
					ArgumentTuplesList
				)

			#return 
			return {'HookingIsBool':False}

		elif type(self.SettingKeyVariable)==str and self.SettingKeyVariable.startswith(
			PyplotMpld3KeyStr):

			#deprefix
			ToolTipKeyStr=SYS.deprefix(
					self.SettingKeyVariable,
					PyplotMpld3KeyStr
				)

			#debug
			'''
			self.debug(
					[
						'before plugins',
						('self.',self,['PyplotedParentFigureDerivePyploterVariable'])
					]
				)
			'''

			#init
			PyplotPluginArgumentDict=Setter.ArgumentDict(
					self.SettingValueVariable,
					self.PyplotedParentFigureDerivePyploterVariable
				)

			#debug
			'''
			self.debug(
					[
						'We plugin here',
						'PyplotPluginArgumentDict is ',
						SYS._str(PyplotPluginArgumentDict)
					]
				)
			'''

			#plugin
			from mpld3 import plugins
			self.PyplotTooltipVariablesList=map(
				lambda __PyplotCartoonVariable:
				getattr(
					plugins,
					ToolTipKeyStr
				)(
					*[
						__PyplotCartoonVariable
					]+PyplotPluginArgumentDict['LiargVariablesList'],
					**PyplotPluginArgumentDict['KwargVariablesDict']
				),
				self.PyplotedLinesList
			)

			#debug
			'''
			self.debug(
					[
						('self.',self,['PyplotTooltipVariablesList'])
					]
				)
			'''
			
			#connect
			map(
				lambda __PyplotTooltipVariable:
				plugins.connect(
					self.PyplotedFigureVariable,
					__PyplotTooltipVariable
				),
				self.PyplotTooltipVariablesList
			)

			#return 
			return {'HookingIsBool':False}
				#we set a Chart

		#call the base method
		BaseClass.set(self)
Пример #10
0
	def recordTrace(self):
		
		#/###################/#
		# Traces level
		#

		#debug
		"""
		self.debug(
				[
					'This is the Traces level',
					'First get the array to trace',
					('self.',self,[
						'RecordingKeyVariable'
					])
				]
			)
		"""
		
		#get
		RecordedTopDeriveRecorderVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

		#/##################/#
		# First get the array to trace
		#

		#get
		if type(self.RecordingKeyVariable)==None.__class__:

			#Check
			if RecordPrefixStr!="" and self.ManagementTagStr.startswith(RecordPrefixStr):

				#debug
				'''
				self.debug(
					[
						('self.',self,['ManagementTagStr']),
						'RecordedTopDeriveRecorderVariable is '+str(RecordedTopDeriveRecorderVariable)
					]
				)
				'''
				
				#get
				self.RecordedTraceFloatsArray=getattr(
					RecordedTopDeriveRecorderVariable,
					SYS.deprefix(
						self.ManagementTagStr,
						RecordPrefixStr
					)
				)

		elif type(self.RecordingKeyVariable).__name__!='ndarray':
	
			#get
			self.RecordedTraceFloatsArray=RecordedTopDeriveRecorderVariable[
				self.RecordingKeyVariable
			]

		else:

			#alias
			self.RecordedTraceFloatsArray=self.RecordingKeyVariable

			#alias
			if self.RecordKeyStr=="":
				self.RecordKeyStr=str(self.RecordingKeyVariable)

		#debug
		'''
		self.debug(
			[
				'We have getted the RecordedTraceFloatsArray',
				('self.',self,['RecordedTraceFloatsArray']),
				'Now set the init'
			]
		)
		'''

		#Check
		if type(self.RecordedTraceFloatsArray)!=None.__class__:

			#/##################/#
			# Prepare initial conditions
			# with the Matrixer

			#Check
			if type(self.RecordingInitFloatsArray)==None.__class__:

				#debug
				'''
				self.debug(
					[
						'We prepare the initial conditions',
						'len(self.RecordedTraceFloatsArray) is ',
						str(len(self.RecordedTraceFloatsArray)),
						('self.',self,[
								'NumscipyingStdFloat',
								'NumscipyingMeanFloat',
								'RecordedTraceFloatsArray'
							])
					]
				)
				'''
				
				#Check
				if self.RecordingInitStdVariable!=None:
			
					#set
					self.NumscipyingStdFloat=self.RecordingInitStdVariable

				elif RecordedTopDeriveRecorderVariable.RecordingInitStdVariable!=None:

					#set
					self.NumscipyingStdFloat=RecordedTopDeriveRecorderVariable.RecordingInitStdVariable

				#Check
				if self.RecordingInitMeanVariable!=None:
			
					#set
					self.NumscipyingMeanFloat=self.RecordingInitMeanVariable

				elif RecordedTopDeriveRecorderVariable.RecordingInitMeanVariable!=None:

					#set
					self.NumscipyingMeanFloat=RecordedTopDeriveRecorderVariable.RecordingInitMeanVariable



				#matrix
				self.RecordedInitFloatsArray=self.numscipy(
						_SizeTuple=(len(self.RecordedTraceFloatsArray),1),
						_StatBool=False
					).NumscipiedValueFloatsArray[:,0]

			else:

				#debug
				'''
				self.debug(
					[
						"we init with a fix array",
						('self.',self,[
								'RecordingInitFloatsArray'
							])
					]
				)
				'''
				
				#alias
				self.RecordedInitFloatsArray = self.RecordingInitFloatsArray

			#debug
			'''
Пример #11
0
	def mimic_set(self):

		#Definition
		OutputDict={'HookingIsBool':True}

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

		#Check
		if type(
			self.SettingKeyVariable
		)==str:

			#Check
			if self.SettingKeyVariable.startswith(
				ManagementDirectChildPrefixStr
			):

				#debug
				'''
				self.debug(
					[
						'We manage here without instancing',
						('self.',self,['SettingKeyVariable'])
					]
				)
				'''
		
				#manage
				self.manage(
					SYS.deprefix(
						self.SettingKeyVariable,
						ManagementDirectChildPrefixStr
					),
					self.SettingValueVariable,
					_WrapBool=False
				)
				self.ManagingWrapBool=True

				#Stop the setting
				return {'HookingIsBool':False}

			elif self.SettingKeyVariable.startswith(
				ManagementChildPrefixStr
			):

				#debug
				'''
				self.debug('We manage here')
				'''

				#manage
				self.manage(
					SYS.deprefix(
						self.SettingKeyVariable,
						ManagementChildPrefixStr
					),
					self.SettingValueVariable
				)	

				#Stop the setting
				return {'HookingIsBool':False}


		#debug
		'''
		self.debug(
				[
					'Call the base set method',
					'BaseClass is '+str(BaseClass),
					('self.',self,['SettingKeyVariable'])
				]
			)
		'''
		
		#return 
		return BaseClass.set(self)
	def mimic_get(self):

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

		#Check
		if type(self.GettingKeyVariable)==str:

			#Check
			if self.GettingKeyVariable.startswith(
				PointToStr
			):

				#debug
				'''
				self.debug(
						'we point here'
					)
				'''

				#point
				self.point(
						SYS.deprefix(
							self.GettingKeyVariable,
							PointToStr
						)
					)

				#alias
				self.GettedValueVariable=self.PointedToVariable

				#return
				return {'HookingIsBool':False}

			elif self.GettingKeyVariable.startswith(
					PointBackStr
				):

				#debug
				'''
				self.debug(
						'we back point here'
					)
				'''

				#point
				self.point(
						SYS.deprefix(
							self.GettingKeyVariable,
							PointBackStr
						),
						_BackBool=True
					)

				#alias
				self.GettedValueVariable=self.PointedToVariable

				#return
				return {'HookingIsBool':False}

			elif self.GettingKeyVariable.startswith(
					PointPrefixStr
				):

				#debug
				'''
				self.debug(
						'we get the encapsulate variable'
					)
				'''

				#deprefix
				PointGetKeyStr=SYS.deprefix(
					self.GettingKeyVariable,
					PointPrefixStr
				)

				#get
				self.GettedValueVariable=self[PointGetKeyStr]['PointToVariable']

				#return
				return {'HookingIsBool':False}

		#call the base method
		return BaseClass.get(self)
	def mimic_set(self):

		#Check
		if type(self.SettingKeyVariable)==str:

			#Check
			if self.SettingKeyVariable.startswith(ConnectGetSetPrefixStr):

				if type(
					self.SettingValueVariable
				)==list and SYS.getIsTuplesListBool(self.SettingValueVariable
				)==False and len(self.SettingValueVariable)==2:

					#debug
					'''
					self.debug(
							[
								'We set connect here',
								('self.',self,['SettingKeyVariable'])
							]
						)
					'''

					#connect
					self.connect(
							SYS.deprefix(
								self.SettingKeyVariable,
								ConnectGetSetPrefixStr
							),
							self.SettingValueVariable[0],
							self.SettingValueVariable[1]
						)

					#return
					return {'HookingIsBool':False}

				else:

					#debug
					'''
					self.debug(
							[
								'We set connect back here',
								('self.',self,['SettingKeyVariable'])
							]
						)
					'''

					#connect
					self.connect(
							SYS.deprefix(
								self.SettingKeyVariable,
								ConnectGetSetPrefixStr
							),
							self.SettingValueVariable
						) 

					#return
					return {'HookingIsBool':False}

		#set
		BaseClass.set(self)
Пример #14
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
				)
	def mimic_set(self):

		#Check
		if type(self.SettingKeyVariable)==str and self.SettingKeyVariable.startswith(
				ParentMutePrefixStr
			): 

			#deprefix
			MuteGetKeyStr=SYS.deprefix(
				self.SettingKeyVariable,
				ParentMutePrefixStr
			)

			#get
			MuteGetValueVariable=self[MuteGetKeyStr]

			#init
			#MuteSetValueVariable=self.SettingValueVariable()['#map@set'](
			#	MuteGetValueVariable.__dict__
			#)
			MuteSetValueVariable=self.SettingValueVariable()
			MuteSetValueVariable.__dict__=MuteGetValueVariable.__dict__

			#debug
			'''
			self.debug(
				[
					'We are going to mute...',
					'MuteGetKeyStr is '+str(MuteGetKeyStr),
					'MuteGetValueVariable.TeamTagStr is '+str(MuteGetValueVariable.TeamTagStr),
					'MuteGetValueVariable.ManagementTagStr is '+str(MuteGetValueVariable.ManagementTagStr),
					('self.',self,['SettingValueVariable']),
					'MuteSetValueVariable is ',
					SYS._str(MuteSetValueVariable)
				]
			)
			'''

			#Check
			if MuteGetValueVariable.ParentDeriveTeamerVariable.TeamedOnceBool:

				#debug
				'''
				self.debug(
						'We team again'
					)
				'''

				#del
				del MuteGetValueVariable.ParentDeriveTeamerVariable.TeamDict[
					MuteGetValueVariable.TeamTagStr
				]

				#team again
				MuteGetValueVariable.ParentDeriveTeamerVariable.team(
						MuteGetValueVariable.TeamTagStr,
						MuteSetValueVariable
					)

				#return
				return {'HookingIsBool':False}

			else:

				#debug
				'''
				self.debug(
						'We manage again'
					)
				'''

				#del
				del MuteGetValueVariable.ParentDeriveTeamerVariable.ManagementDict[
					MuteGetValueVariable.ManagementTagStr
				]

				#manage again
				MuteGetValueVariable.ParentDeriveTeamerVariable.manage(
						MuteGetValueVariable.ManagementTagStr,
						MuteSetValueVariable
					)

				#return
				return {'HookingIsBool':False}

		#Call the base method
		BaseClass.set(self)
Пример #16
0
	def do_trace(self):
		
		#/##################/#
		# Find the parent recorder
		#

		#debug
		'''
		self.debug(
			[
				'We trace here',
				'Networker.NetworkInTeamKeyStr in self.TeamDict is ',
				str(Networker.NetworkInTeamKeyStr in self.TeamDict),
				#('self.',self,['NetworkDeriveNetworkerVariable']),
				'self.TeamDict.keys() is ',
				str(self.TeamDict.keys()),
				'Networker.NetworkInTeamKeyStr is ',
				Networker.NetworkInTeamKeyStr
			]
		)
		'''

		"""
		#Check
		if Networker.NetworkInTeamKeyStr in self.TeamDict:

			#debug
			'''
			self.debug(
				[
					'self.TeamDict[Networker.NetworkInTeamKeyStr].ManagementDict.keys() is ',
					str(self.TeamDict[Networker.NetworkInTeamKeyStr].ManagementDict.keys())
				]
			)
			'''

			#get
			self.TraceDeriveRecorderVariable=self.TeamDict[
				Networker.NetworkInTeamKeyStr
			].ManagementDict[Pointer.PointManagementPrefixStr+'Recorder'].PointToVariable

			#debug
			'''
			self.debug(
				[
					'Ok we have setted the TraceDeriveRecorderVariable',
					('self.',self,['TraceDeriveRecorderVariable'])
				]
			)
			'''
		"""

		#debug
		'''
		self.debug(
			[
				'We set the TraceDeriveRecorderVariable
				('self.',self,['ParentDeriveTeamerVariable'])
			]
		)
		'''

		#get
		self.TraceDeriveRecorderVariable=self.ParentDeriveTeamerVariable.ParentDeriveTeamerVariable

		#/##################/#
		# First get the array to trace
		#

		#debug
		'''
		self.debug(
			[
				'We trace here',
				('self.',self,['TracingKeyVariable'])
			]
		)	
		'''

		#get
		if type(self.TracingKeyVariable)==None.__class__:

			#Check
			if self.ManagementTagStr.startswith(TracerPrefixStr):

				#get
				self.TracedValueFloatsArray=getattr(
					self.TraceDeriveRecorderVariable,
					SYS.deprefix(
						self.ManagementTagStr,
						TracerPrefixStr
					)
				)

		elif type(self.TracingKeyVariable).__name__!='ndarray':
	
			#get
			self.TracedValueFloatsArray=self.TraceDeriveRecorderVariable[
				self.TracingKeyVariable
			]


		else:

			#alias
			self.TracedValueFloatsArray=self.TracingKeyVariable


		#alias
		if self.TraceKeyStr=="":
			self.TraceKeyStr=str(self.TracingKeyVariable)

		#debug
		'''
		self.debug(
			[
				'We have setted the TracedValueFloatsArray'
			]
		)
		'''

		#Check
		if type(self.TracedValueFloatsArray)!=None.__class__:

			#/##################/#
			# Prepare initial conditions
			# with the Matrixer

			#debug
			'''
			self.debug(
				[
					'We prepare the initial conditions',
					'len(self.TracedValueFloatsArray) is ',
					str(len(self.TracedValueFloatsArray))
				]
			)
			'''

			#matrix
			self.TracedInitFloatsArray=self.matrix(
					_SizeTuple=(len(self.TracedValueFloatsArray),1)
				).MatrixedRandomFloatsArray[:,0]

			#debug
			'''
Пример #17
0
	def mimic_set(self):

		#debug
		self.debug(
			('self.',self,[
					'SettingKeyVariable',
					'SettingValueVariable'
				]))

		
		#Definition
		OutputDict={'HookingIsBool':True}

		#Check
		if self.SettingKeyVariable!="":

			#Init
			SettingKeyVariable=""

			#Check
			#if (self.SettingKeyVariable[0].isalpha() or self.SettingKeyVariable[:2]=="__"
			#	) and self.SettingKeyVariable[0].lower()==self.SettingKeyVariable[0]:
			if type(self.SettingValueVariable)==ApplyDictClass:

				#set
				SettingKeyVariable=self.SettingKeyVariable

			#Check
			if type(
				self.SettingKeyVariable
				)==str and self.SettingKeyVariable.startswith(
					ApplySetPrefixStr
				):

				#debug
				self.debug(
					'We do an apply here with a deprefix settingkeyvariable'
				)

				#set
				SettingKeyVariable=SYS.deprefix(
							self.SettingKeyVariable,
							ApplySetPrefixStr
						)

			#Check
			if SettingKeyVariable!="":

				#debug
				self.debug('We do an apply with '+SettingKeyVariable)

				#apply
				self.apply(
						SettingKeyVariable,
						self.SettingValueVariable
					)

				#Return
				OutputDict['HookingIsBool']=False
				#<Hook>return OutputDict

		if OutputDict['HookingIsBool']:
			BaseClass.set(self)
Пример #18
0
	def mimic_set(self):
		""" """

		#debug
		'''
		self.debug(
			('self.',self,[
					'SettingKeyVariable',
					'SettingValueVariable'
				]))
		'''

		#Definition
		OutputDict={'HookingIsBool':True}

		#Deep set
		if type(
			self.SettingKeyVariable
		)==str and self.SettingKeyVariable.startswith(
					PathPrefixStr
				):

			#deprefix
			SetKeyVariable=SYS.deprefix(self.SettingKeyVariable,PathPrefixStr)

			#Check
			if PathPrefixStr not in SetKeyVariable:

				#set
				self.set(
					SetKeyVariable,
					self.SettingValueVariable
				)

				#stop the set
				return {'HookingIsBool':False}

			#debug
			'''
			self.debug('We are going to path')
			'''

			#Path
			self.path(self.SettingKeyVariable)

			#debug
			'''
			self.debug(('self.',self,[
										"PathedGetKeyStr",
										"PathedChildKeyStr",
										"PathedGetValueVariable"
									]
								))
			'''

			#set
			#Direct update in the Child or go deeper with the ChildPathStr
			if self.SettingKeyVariable[-1]==PathPrefixStr: 
				
				#debug
				'''
				self.debug('this is a special set inside the pathed variable')
				'''

				#Check
				if self.PathedGetValueVariable!=None:

					#Case where it is an object to set inside
					if 'PatherClass' in map(
										lambda __Class:
										__Class.__name__,
										type(self.PathedGetValueVariable).__mro__
										):

						#debug
						'''
						self.debug(('self.',self,[
													'PathedGetKeyStr',
													'SettingKeyVariable',
													'SettingValueVariable',
													'PathedGetValueVariable'
												]))
						'''

						#Modify directly the PathedGetValueVariable with self.SettingValueVariable
						self.PathedGetValueVariable.__setitem__(
																self.SettingValueVariable[0],
																self.SettingValueVariable[1]
															)


					#Case where it is a set at the level of self of an already setted thing
					else:

						#set to the corresponding point
						self[self.PathedGetKeyStr]=self.SettingValueVariable

				else:

					#debug
					'''
					self.debug(
							[
								'set with setWithPathVariableAndKeyVariable',
								("self.",self,[
												'SettingValueVariable',
												'PathedChildKeyStr'])
							]
					)
					'''

					#Call the setWithPathVariableAndKeyVariable
					setWithPathVariableAndKeyVariable(
						self.PathedGetValueVariable,
						self.PathedChildKeyStr,
						self.SettingValueVariable
					)

			#Case where it is a set at the level of self of new setted thing
			else:

				#debug
				'''
				self.debug(
					[
						'we setitem here',
						('self.',self,['PathedKeyStrsList'])
					]
				)
				'''
				
				#Check
				if self.PathedGetKeyStr!="" and len(
					self.PathedKeyStrsList
				)==2:

					#debug
					'''
					self.debug('we setitem at this level')
					'''

					#set
					self[self.PathedGetKeyStr]=self.SettingValueVariable
				else:

					#define
					ChildSettingKeyStr=PathPrefixStr+PathPrefixStr.join(
						self.PathedKeyStrsList[2:]
					)

					#debug
					'''
					self.debug(
						[
							'we setitem further',
							'ChildSettingKeyStr is '+ChildSettingKeyStr
						]
					)
					'''

					#set
					self.PathedGetValueVariable[
						ChildSettingKeyStr
					]=self.SettingValueVariable

			#Stop the setting
			OutputDict["HookingIsBool"]=False

		#Call the parent get method
		if OutputDict['HookingIsBool']:
			return BaseClass.set(self)
		else:
			return OutputDict
Пример #19
0
	def do(self,_Class):

		#set
		self.DoClass=_Class
		
		#debug
		'''
		print("Doer l.337 : self.DoClass is ",self.DoClass)
		print('')
		'''

		#alias
		DoClass=self.DoClass

		#Definition
		DoerStr=DoClass.NameStr
		DoStr=DoerStrToDoStrOrderedDict[DoerStr]
		DoMethodStr=DoStr[0].lower()+DoStr[1:] if DoStr[0]!='_' else '_'+DoStr[1].lower()+DoStr[2:]
		DoneStr=DoStrToDoneStrOrderedDict[DoStr]
		DoingStr=DoneStrToDoingStrOrderedDict[DoneStr]
		LocalVariablesDict=vars()

		#debug
		'''
		print('Doer l.275 : DoerStr is '+DoerStr)
		print('DoStr is '+DoStr)
		print('DoMethodStr is '+DoMethodStr)
		print('DoingStr is '+DoingStr)
		print('DoneStr is '+DoneStr)
		print('')
		'''
		
		#set 
		map(
				lambda __KeyStr:
				setattr(DoClass,__KeyStr,LocalVariablesDict[__KeyStr]),
				['DoerStr','DoStr','DoneStr','DoingStr','DoMethodStr']
			)
		
		#set a lists that will contain the tempory setting items during a call of the <do> method in the instance
		#DoClass.DoHistoryOrderedDict=collections.OrderedDict()

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

			#Check for doing and done keyStrs
			DoClass.DoneAttributeVariablesOrderedDict=collections.OrderedDict(
				SYS._filter(
				lambda __DefaultAttributeItemTuple:
				__DefaultAttributeItemTuple[0].startswith(DoneStr),
				DoClass.DefaultAttributeVariablesOrderedDict.items()
				)
			)
			DoClass.DoingAttributeVariablesOrderedDict=collections.OrderedDict(
				SYS._filter(
				lambda __DefaultAttributeItemTuple:
				__DefaultAttributeItemTuple[0].startswith(DoingStr),
				DoClass.DefaultAttributeVariablesOrderedDict.items()
				)
			)
			DoClass.DoingDeprefixAttributeStrsList=map(
					lambda __KeyStr:
					DoingAttributePrefixStr+SYS.deprefix(__KeyStr,DoingStr),
					DoClass.DoingAttributeVariablesOrderedDict.keys()
				)

			#Definition
			DoWrapMethodStr=DoingWrapPrefixStr+DoMethodStr

			#Debug
			'''
			print('Doer l.401')
			print('DoClass.DoneAttributeVariablesOrderedDict is ',DoClass.DoneAttributeVariablesOrderedDict)
			print('DoClass.DoingAttributeVariablesOrderedDict is ',DoClass.DoingAttributeVariablesOrderedDict)
			print('DoWrapMethodStr is ',DoWrapMethodStr)
			print('')
			'''
			
			#Check 
			if hasattr(DoClass,DoWrapMethodStr):

				#Debug
				'''
				print('There is a DoWrapMethod here already')
				print('')
				'''

				#Get
				DoWrapMethod=getattr(
						DoClass,
						DoWrapMethodStr
					)
			else:

				#Debug
				'''
				print('There is no DoWrapMethod here')
				print('')
				'''

				#Definition of a default function
				DoWrapMethod = DefaultDoFunction

				#set
				setattr(DoClass,DoWrapMethodStr,DoWrapMethod)


			#debug
			'''
			print('DoWrapMethod is '+str(DoWrapMethod))
			print('')
			'''

			#Link
			"""
			DoingMethodKeyStr='init'+DoClass.NameStr
			setattr(
					DoClass,
					DoingMethodKeyStr,
					initDo
				)
			"""

			#/#################/#
			# Define the shape of the args
			#

			#Definition of the ExecStr that will define the function
			DoDecorationMethodStr=DoingDecorationPrefixStr+DoingDecorationTagStr+DoingDecorationSuffixStr+DoMethodStr
			DoExecStr="def "+DoDecorationMethodStr+"(_InstanceVariable,"
			DoExecStr+=",".join(
				map(
					lambda __DoingDeprefixAttributeStr:
					#DoingAttributePrefixStr+__KeyStr+"=None",
					__DoingDeprefixAttributeStr+"=None",
					#DoClass.DoingAttributeVariablesOrderedDict.keys()
					DoClass.DoingDeprefixAttributeStrsList
				)
			)
			DoExecStr+="," if DoExecStr[-1]!="," else ""
			DoExecStr+="*_LiargVariablesList,"
			DoExecStr+="**_KwargVariablesDict):\n\t"

			#/#################/#
			# Set the doing variables
			#

			#Debug part
			#DoExecStr+='\n\tprint("In '+DoDecorationMethodStr+' with '+DoWrapMethod.__name__+' ") '
			'''
			DoExecStr+="\n\t#Debug"
			DoExecStr+=('\n\t'+';\n\t'.join(
									map(
										lambda __KeyStr:
										'print("In DoerFunction, '+DoingAttributePrefixStr+__KeyStr+' is ",'+DoingAttributePrefixStr+__KeyStr+')',
										_Class.DoingAttributeVariablesOrderedDict.keys()
									)
								)+";") if len(_Class.DoingAttributeVariablesOrderedDict.keys())>0 else ''
			DoExecStr+='\n\tprint("_LiargVariablesList is ",_LiargVariablesList);'
			DoExecStr+='\n\tprint("_KwargVariablesDict is ",_KwargVariablesDict);\n\t'
			'''

			#join
			DoExecStr+=("\n"+";\n".join(
				map(
					lambda __KeyStr,__DoingDeprefixAttributeStr:
					"\n".join(
						[
							#"\tif type("+DoingAttributePrefixStr+__KeyStr+")!=None.__class__:",
							#"\t\t_InstanceVariable."+__KeyStr+"="+DoingAttributePrefixStr+__KeyStr,
							"\tif type("+__DoingDeprefixAttributeStr+")!=None.__class__:",
							"\t\t_InstanceVariable."+__KeyStr+"="+__DoingDeprefixAttributeStr,
						]
					),
					DoClass.DoingAttributeVariablesOrderedDict.keys(),
					DoClass.DoingDeprefixAttributeStrsList
				)
			)+";\n") if len(
				DoClass.DoingAttributeVariablesOrderedDict.keys()
			)>0 else ''

			#Give to the class this part (it can serve after for imitating methods...)
			DoExecStrKeyStr='Do'+DoClass.NameStr+'ExecStr'
			setattr(DoClass,DoExecStrKeyStr,DoExecStr)
			
			#Call the initDo method
			DoExecStr+="\n" if DoExecStr[-1]!="\n" else ""
			DoExecStr+="\n\t#return\n\t"
			
			#Check
			setattr(DoClass,'DoingGetBool',self.DoingGetBool)
			if self.DoingGetBool==False:

				#Return the _InstanceVariable if it is not a getter object
				DoExecStr+="do(_InstanceVariable,"
				DoExecStr+="*_LiargVariablesList,"
				DoExecStr+="**dict(_KwargVariablesDict,**{'DoDecorationMethodStr':'"+DoDecorationMethodStr+"','DoClassStr':'"+DoClass.__name__+"'}))\n\t"
				DoExecStr+="return _InstanceVariable\n"
			else:

				#Return the output of the do method
				DoExecStr+="return do(_InstanceVariable,"
				DoExecStr+="*_LiargVariablesList,"
				DoExecStr+="**dict(_KwargVariablesDict,**{'DoDecorationMethodStr':'"+DoDecorationMethodStr+"','DoClassStr':'"+DoClass.__name__+"'}))\n"

			#Debug
			'''
			print('Doer l 546')
			print('DoExecStr is ')
			print(DoExecStr)
			print('')
			'''
			
			#exec
			six.exec_(DoExecStr)

			#set
			#locals(
			#	)[DoDecorationMethodStr].DoWrapMethod=DoWrapMethod


			#Debug
			'''
			print('l. 907 Doer')
			print('DoClass is ',DoClass)
			print('DoDecorationMethodStr is ',DoDecorationMethodStr)
			print('DoWrapMethod is ',DoWrapMethod)
			print("locals()[DoDecorationMethodStr] is ",locals()[DoDecorationMethodStr])
			print('')
			'''
			
			#set with the specific name
			self.setMethod(DoDecorationMethodStr,locals()[DoDecorationMethodStr])

			#set with the DoMethodStr shortcut
			self.setMethod(DoMethodStr,locals()[DoDecorationMethodStr])

			#set a pointer to the fundamental class
			locals()[DoDecorationMethodStr].BaseDoClass=DoClass

			#/####################/#
			# Set maybe if not already the setDo methods
			#

			#Check
			if hasattr(DoClass,'setDo')==False:

				#Debug
				'''
				print('Doer l 602')
				print('DoClass is')
				print(DoClass)
				print('')
				'''
				
				#map
				map(
					lambda __SetUnboundMethod:
					#set with the DoMethodStr shortcut
					self.setMethod(
								__SetUnboundMethod.__name__,
								__SetUnboundMethod
							),
					[
						getDo,getDoing,getDone,
						setDo,setDoing,setDone,
						callDo
					]
				)

			#/####################/#
			# Give a list of all the mro Doer and the do possible
			#

			#set a DoMethodStrsList
			if hasattr(DoClass.__bases__[0],'MroDoerClassesList'):
				DoClass.MroDoerClassesList=DoClass.__bases__[0
				].MroDoerClassesList+[DoClass]
			else:
				DoClass.MroDoerClassesList=[DoClass]

			#set a DoMethodStrsList
			if hasattr(DoClass.__bases__[0],'DoMethodStrsList'):
				DoClass.DoMethodStrsList=DoClass.__bases__[0
				].DoMethodStrsList+[DoMethodStr]
			else:
				DoClass.DoMethodStrsList=[DoMethodStr]


		#Check
		DoClass.DoUnitsInt=-1

		#Add to the KeyStrsList
		DoClass.KeyStrsList+=[
								'DoerStr',
								'DoStr',
								'DoneStr',
								'DoingStr',
								'DoneAttributeVariablesOrderedDict',
								'DoingAttributeVariablesOrderedDict',
								'DoingDeprefixAttributeStrsList',
								'DoMethodStr',
								'DoHistoryOrderedDict',
								DoExecStrKeyStr,
								'DoingGetBool',
								'DoTempAttributeItemTuplesList',
								'DoTempNotAttributeItemTupleItemsList',
								'DoMethodStrsList',
								'MroDoerClassesList',
								'DoUnitsInt'
						]
Пример #20
0
	def do_set(self):
		""" """

		#debug
		'''
		self.debug(
			("self.",self,[
				'SettingKeyVariable',
				'SettingValueVariable'
			])
		)	
		'''

		#itemize first
		if self.SettingItemBool:

			#debug
			'''
			self.debug('first we itemize')
			'''

			#itemize
			self.itemize(
					self.SettingKeyVariable
				)

		else:

			#set
			self.ItemizedValueMethod=None

		#/############################
		# Case of a method get 
		#

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

		#Check 
		if self.ItemizedValueMethod!=None:

			#debug
			'''
			self.debug(
				[
					'we are going to call the method but first get it',
					('self.',self,['ItemizedValueMethod'])
				]
			)	
			'''

			#/####################/#
			# Get the method and init the liarg and kwarg
			#

			#get
			SettedValueMethod=self[self.SettingKeyVariable]

			#alias
			SettedLiargVariable=self.SettingValueVariable
			SettedKwargVariable=None

			#/####################/#
			# Check for an argument dict
			#

			#debug
			'''
			self.debug(
					[
						'SettedValueMethod is '+SYS._str(SettedValueMethod),
						'Before calling the itemized method, we adapt the liarg',
						('self.',self,['SettingValueVariable'])
					]
				)
			'''

			#Check
			if hasattr(
					self.SettingValueVariable,'items'
				):

				#Check
				if any(
					map(
						lambda __KeyStr:
						__KeyStr in self.SettingValueVariable,
						[
							SetLiargGrabStr,
							SetMapLiargGetGrabStr,
							SetLiargGetGrabStr,
							SetKwargGrabStr,
							SetMapKwargGetKeyGrabStr,
							SetMapKwargGetKeyValueGrabStr
						]
					)
				):

					#debug
					'''
					self.debug(
							[
								'It is an argument dict'
							]
						)
					'''

					#get
					[SettedLiargVariable,SettedKwargVariable]=map(
						lambda __KeyStr:
						ArgumentDict(
							self.SettingValueVariable,
							self
						)[__KeyStr],
						['LiargVariablesList','KwargVariablesDict']
					)

					#debug
					'''
					self.debug(
							[
								'SettedLiargVariable is '+SYS._str(SettedLiargVariable),
								'SettedKwargVariable is '+SYS._str(SettedKwargVariable),
							]
						)
					'''

				#/#################/#
				# Set a map lambda
				#

				elif SetLiargLambdaGrabStr in self.SettingValueVariable:

					#debug
					'''
					self.debug(
						[
							'we set a value with a SetLiargLambdaGrabStr inside',
							('self.',self,['SettingValueVariable'])
						]
					)
					'''

					#temp
					SettedLambdaValueVariable=self.SettingValueVariable
					SettedLambdaKeyVariable=self.SettingKeyVariable

					#getMap
					SettedMapLambdaList=self.getMapLambdaList(
						SettedLambdaValueVariable
					)

					#debug
					'''
					self.debug(
						[
							'SettedMapLambdaList is',
							str(SettedMapLambdaList)
						]
					)
					'''
					
					#map map set
					map(
						lambda __SettedVariable:
						self.mapSet(__SettedVariable),
						SettedMapLambdaList
					)

					#Stop the setting
					return {"HookingIsBool":False}
				
			#set
			SettedIsBool=False

			#define
			if hasattr(SettedValueMethod,'im_func'):

				#Check
				if hasattr(SettedValueMethod.im_func,'BaseDoClass'):

					#debug
					'''
					self.debug(
							[
								"hasattr(SettedValueMethod.im_func.BaseDoClass.Module,'getLiargVariablesList') is",
								str(hasattr(SettedValueMethod.im_func.BaseDoClass.Module,'getLiargVariablesList'))
							]
						)
					'''

					#Check
					if hasattr(
						SettedValueMethod.im_func.BaseDoClass.Module,
						'getLiargVariablesList'
					):
					
						#set
						SettedIsBool=True

						#get
						SettedLiargVariablesList=SettedValueMethod.im_func.BaseDoClass.Module.getLiargVariablesList(
							SettedLiargVariable
						)

						#debug
						'''
						self.debug(
								'SettedLiargVariablesList is '+str(SettedLiargVariablesList)
							)
						'''
						
						if SettedKwargVariable!=None:

							#get the method and put the value as arguments
							SettedValueMethod(*SettedLiargVariablesList,**SettedKwargVariable)

						else:

							#get the method and put the value as arguments
							SettedValueMethod(*SettedLiargVariablesList)

						#Stop the setting
						return {"HookingIsBool":False}

			if SettedIsBool==False:

				#debug
				'''
				self.debug(
					[
						'call the SettedValueMethod with self.SettingValueVariable directly',
						'SettedLiargVariable is '+SYS._str(SettedLiargVariable)
					]
				)
				'''
				
				#Check
				if hasattr(SettedLiargVariable,'items'):
					SettedLiargVariable=SettedLiargVariable.items()
				elif type(SettedLiargVariable)!=list:
					SettedLiargVariable=[SettedLiargVariable]

				#Check
				if SettedKwargVariable!=None:

					#direct
					#SettedValueMethod(*self.SettingValueVariable)
					SettedValueMethod(*SettedLiargVariable,**SettedKwargVariable)

				else:

					#direct
					#SettedValueMethod(*self.SettingValueVariable)
					SettedValueMethod(*SettedLiargVariable)
			
				#Stop the setting
				return {"HookingIsBool":False}

		#/####################/#
		# Case of a non method  with set with a set key str 
		#

		elif type(
			self.SettingKeyVariable
				) in [str,unicode]:

			#cast
			self.SettingKeyVariable=str(self.SettingKeyVariable)

			#/####################/#
			# Case of #bound: set
			#

			#Check
			if self.SettingKeyVariable.startswith(
				SetBoundPrefixStr
			):

				#deprefix
				SettedMethodStr=SYS.deprefix(
						self.SettingKeyVariable,
						SetBoundPrefixStr
					)

				#debug
				'''
				self.debug(
					[
						'We bound here',
						'SettedMethodStr is '+SettedMethodStr
					]
				)
				'''

				#bound
				setattr(
					self.__class__,
					SettedMethodStr,
					self.SettingValueVariable
				)

				#call
				self.SettingValueVariable(self)

				#stop the setting
				return {'HookingIsBool':False}

			#/####################/#
			# Case of #untype: set
			#

			#Check
			elif self.SettingKeyVariable.startswith(
				SetUntypePrefixStr
			):

				#set
				self.SettingTypeBool=False

				#get
				SettedEachGetVariable=self.set(
					SYS.deprefix(
						self.SettingKeyVariable,
						SetUntypePrefixStr
					),
					self.SettingValueVariable
				)

				#reset
				self.SettingTypeBool=True

				#Return stop the setting
				return {'HookingIsBool':False}

			#/####################/#
			# Case of #each: set
			#

			#Check
			elif self.SettingKeyVariable.startswith(
				SetEachPrefixStr
			):

				#temp
				SettedTempLiargSettingValueVariable=self.SettingValueVariable

				#get
				SettedEachGetVariable=self[
					SYS.deprefix(
						self.SettingKeyVariable,
						SetEachPrefixStr
					)
				]

				#debug
				'''
				self.debug(
					[
						'We each here',
						('self.',self,['SettingKeyVariable']),
						'SettedEachGetVariable is '+str(SettedEachGetVariable)
					]
				)
				'''
				
				#Check
				if hasattr(SettedEachGetVariable,'values'):
					SettedEachGetVariablesList=SettedEachGetVariable.values()
				else:
					SettedEachGetVariablesList=SettedEachGetVariable

				#debug
				'''
				self.debug(
					[
						'SettedEachGetVariablesList is ',
						SYS._str(SettedEachGetVariablesList),
						'SettedTempLiargSettingValueVariable is ',
						SYS._str(SettedTempLiargSettingValueVariable)
					]
				)
				'''
				
				#map
				map(
						lambda __SettedGetVariable,__SettedValueVariable:
						__SettedGetVariable[SetMapStr](
							SYS.SetList(__SettedValueVariable)
						),
						SettedEachGetVariablesList,
						SettedTempLiargSettingValueVariable
					)

				#Return stop the setting
				return {'HookingIsBool':False}

			#/####################/#
			# Case of #all: set
			#

			#Check
			elif self.SettingKeyVariable.startswith(
				SetAllPrefixStr
			):

				#get
				SettedGetVariable=self[
					SYS.deprefix(
						self.SettingKeyVariable,
						SetAllPrefixStr
					)
				]

				#Check
				if hasattr(SettedGetVariable,'values'):
					SettedGetVariablesList=SettedGetVariable.values()
				else:
					SettedGetVariablesList=SettedGetVariable

				#debug
				'''
				self.debug(
					[
						'SettedGetVariablesList is ',
						SYS._str(SettedGetVariablesList),
						('self.',self,['SettingValueVariable'])
					]
				)
				'''

				#Check
				if type(self.SettingValueVariable) in [
							list,tuple
						] and len(self.SettingValueVariable)==2:

					#map
					map(
							lambda __SettedGetVariable:
							__SettedGetVariable.set(
								*self.SettingValueVariable
							),
							SettedGetVariablesList
						)

				else:

						
					#map
					map(
							lambda __SettedGetVariable:
							__SettedGetVariable[SetMapStr](
								self.SettingValueVariable
							),
							SettedGetVariablesList
						)

				#Return stop the setting
				return {'HookingIsBool':False}

			#/####################/#
			# Case of #copy: set
			#

			#Check
			elif self.SettingKeyVariable.startswith(
				SetCopyPrefixStr
			):

				#deprefix
				GetKeyStr=SYS.deprefix(
						self.SettingKeyVariable,
						SetCopyPrefixStr
					)

				#debug
				'''
				self.debug(
					[
						'We copy set here',
						'GetKeyStr is ',
						GetKeyStr
					]
				)
				'''

				#set
				self[GetKeyStr]=copy.copy(self.SettingValueVariable)

				#Return stop the setting
				return {'HookingIsBool':False}

			#Check
			elif self.SettingKeyVariable.startswith(
				SetDeepCopyPrefixStr
			):

				#deprefix
				GetKeyStr=SYS.deprefix(
						self.SettingKeyVariable,
						SetDeepCopyPrefixStr
					)

				#debug
				'''
				self.debug(
					[
						'We deepcopy set here',
						'GetKeyStr is ',
						GetKeyStr
					]
				)
				'''

				#set
				self[GetKeyStr]=copy.deepcopy(self.SettingValueVariable)

				#Return stop the setting
				return {'HookingIsBool':False}

			#/####################/#
			# Case of a set in the __dict__
			#

			else:

				#/####################/#
				# Case of a set with a #get in the value
				#

				if type(
					self.SettingValueVariable
				)==str and self.SettingValueVariable.startswith(SetUndirectPrefixStr):

					#deprefix
					SettedKeyStr=SYS.deprefix(
							self.SettingValueVariable,
							SetUndirectPrefixStr
						)

					#debug
					'''
					self.debug(
						[
							'This is a undirect of a str variable',
							'SettedKeyStr is '+SettedKeyStr
						]
					)
					'''

					#Check
					if SetUndirectPrefixStr in SettedKeyStr:

						#split
						SettedKeyStrsList=SettedKeyStr.split(SetUndirectPrefixStr)

						#define
						SettedRecursiveKeyStr=''.join(
							SettedKeyStrsList[:-1])+self[SettedKeyStrsList[-1]]

						#debug
						'''
						self.debug(
								[
									'This is a recursive undirect set',
									'SettedRecursiveKeyStr is '+SettedRecursiveKeyStr
								]
							)
						'''

						#set
						self[
							self.SettingKeyVariable
						]=SetUndirectPrefixStr+SettedRecursiveKeyStr

					else:

						#debug
						'''
						self.debug(
								'This is one level undirect set'
							)
						'''

						#set
						self[
							self.SettingKeyVariable
						]=self[SettedKeyStr]

					#Stop the getting
					return {"HookingIsBool":False}

				#/####################/#
				# Case of a set with a set dict
				#

				#Check
				elif hasattr(
						self.SettingValueVariable,'items'
					):

					#debug
					'''
					self.debug(
							[
								'Check for a set value dict',
								('self.',self,['SettingValueVariable'])
							]
						)
					'''

					if SetValueGrabStr in self.SettingValueVariable:

						#debug
						'''
						self.debug(
							[
								'we set a value with a SetValueGrabStr inside',
								('self.',self,['SettingValueVariable'])
							]
						)
						'''

						#set
						self[self.SettingKeyVariable]=self.SettingValueVariable[SetValueGrabStr]

						#Return
						return {'HookingIsBool':False}

					elif SetMapValueGetGrabStr in self.SettingValueVariable:

						#debug
						'''
						self.debug(
							[
								'we set a value with a map SetMapValueGetGrabStr inside',
								('self.',self,['SettingValueVariable'])
							]
						)
						'''

						#set
						self[self.SettingKeyVariable]=self[
							SYS.deprefix(
								SetMapValueGetGrabStr,
								SetValueGrabPrefixStr
							)
						](
							*self.SettingValueVariable[SetMapValueGetGrabStr]
						).ItemizedMapValueVariablesList
						

						#Return
						return {'HookingIsBool':False}

					#Check
					elif SetValueGetGrabStr in self.SettingValueVariable:

						#Get 
						SettedGrabValueVariable=self[
							self.SettingValueVariable[SetValueGetGrabStr]
						]

						#debug
						'''
						self.debug(
							[
								'we set a value with a SetValueGetGrabStr inside',
								('self.',self,['SettingValueVariable']),
								'SettedGrabValueVariable is '+SYS._str(
									SettedGrabValueVariable)
							]
						)
						'''

						#set
						self[
							self.SettingKeyVariable
						]=SettedGrabValueVariable

						#Return
						return {'HookingIsBool':False}

					elif SetValueLambdaGrabStr in self.SettingValueVariable:

						#debug
						'''
						self.debug(
							[
								'This is a lambda map set',
								('self.',self,['SettingValueVariable'])
							]
						)
						'''

						#temp
						SettedTempKeyVariable=self.SettingKeyVariable
						SettedTempValueVariable=self.SettingValueVariable
						
						#getMap
						SettedReplaceValueVariablesList=self.getMapLambdaList(
							SettedTempValueVariable
						)

						#set
						self[SettedTempKeyVariable]=SettedReplaceValueVariablesList

						#Return
						return {'HookingIsBool':False}


				#/####################/#
				# Case of an instancing set
				#

				#Check
				if self.SettingTypeBool:

					#debug
					'''
					self.debug(
							[
								'we check if we have to set a default value here',
								('self.',self,[
									'SettingKeyVariable',
									'SettingValueVariable'
								])
							]
						)
					'''

					#get
					SettedValueType=SYS.getTypeClassWithTypeStr(
						SYS.getTypeStrWithKeyStr(
							self.SettingKeyVariable)
					)

					#type
					SettedSettingValueVariableType=type(self.SettingValueVariable)

					#cast
					if SettedSettingValueVariableType==unicode:
						self.SettingValueVariable=str(self.SettingValueVariable)
						SettedSettingValueVariableType=str
						
					#Check
					if SettedValueType!=SettedSettingValueVariableType:

						#debug
						'''
						self.debug(
								[
									'Check that the type is not a lst and a numpy array'
								]
							)
						'''
						
						#Check
						if set([
							SettedValueType.__name__,
							SettedSettingValueVariableType.__name__
						])!=SetListTypesSet:

							#debug
							'''
							self.debug(
								[
									'SettedValueType is '+str(SettedValueType),
									('self.',self,['SettingKeyVariable'])
								]
							)	
							'''

							#Check
							if SettedValueType!=None.__class__:

								#debug
								'''
								self.debug(
									[
										'we wrap the setting value',
										('self.',self,['SettingValueVariable'])
									]
								)
								'''
								
								#alias
								'''
								try:
								'''

								#map set
								self[self.SettingKeyVariable]=SettedValueType(
									).mapSet(
									self.SettingValueVariable
								)
								#self[self.SettingKeyVariable]=SettedValueType(
								#	)[SetMapStr](
								#	self.SettingValueVariable
								#)
								#self.SettingValueVariable=SettedValueType(
								#	)[SetMapValueGetGrabStr](
								#	self.SettingValueVariable
								#)

								'''
								except:

									#debug
									self.debug(
											[
												'set failed because the suffix str indicates a different type from the value',
												'SettedValueType is '+str(SettedValueType),
												'type(self.SettingValueVariable) is '+str(
													type(self.SettingValueVariable))
											]
										)
								'''

								#debug
								'''
								self.debug(
									'Ok we have instanced'
								)
								'''

								#Return
								return {'HookingIsBool':False}

				#/####################/#
				# Check that it is not a property
				#

				#Check
				if hasattr(self.__class__,self.SettingKeyVariable):

					#get
					SettedPropertyValueVariable=getattr(self.__class__,self.SettingKeyVariable)
					
					#Check
					if type(SettedPropertyValueVariable)==property:

						#debug
						'''
						self.debug('It is a property set')
						'''

						#set the property
						setattr(
								self,
								self.SettingKeyVariable,
								self.SettingValueVariable
							)

						#Return
						return {'HookingIsBool':False}


				#/####################/#
				# Set in the __dict__ ... finally 
				# 

				#debug
				'''
				self.debug(
					[
						'we just maybe set in the __dict__',
						('self.',self,[
								'SettingKeyVariable',
								'SettingValueVariable'
							])
					]
				)
				'''
				
				#__setitem__ in the __dict__, this is an utility set
				self.__dict__[
					self.SettingKeyVariable
				]=self.SettingValueVariable

				#/####################/#
				# GIve maybe some things to the setted value 
				# 

				#add in the SettingValue
				try:
					self.SettingValueVariable.SetTagStr=self.SettingKeyVariable
					self.SettingValueVariable.SetDeriveSetter=self
				except:
					pass

				#Return
				return {'HookingIsBool':False}

		#/####################/#
		# Case of a non method set with a set dict in the Key Variable
		#

		elif hasattr(self.SettingKeyVariable,'items'):

			#get
			SettedGetKeyVariable=self[self.SettingKeyVariable]

			#debug
			'''
			self.debug(
					[
						'SettingKeyVariable has items...',
						('self.',self,['SettingKeyVariable']),
						'SettedGetKeyVariable is '+SYS._str(SettedGetKeyVariable)
					]
				)
			'''

			#set
			self.set(
				SettedGetKeyVariable,
				self.SettingValueVariable
			)

			#Return
			return {'HookingIsBool':False}


		#/####################/#
		# Case of a function set
		#

		elif callable(self.SettingKeyVariable):

			#/####################/#
			# Case of a non method with a set dict in the Value Variable
			#

			#debug
			'''
			self.debug(
					[
						'The key is callable',
						('self.',self,[
							'SettingValueVariable',
							'PathDerivePather'
						]),
						'map get the values to have the liargvariables list'
					]
				)
			'''
			
			#Set 
			SettedTempKeyVariable=self.SettingKeyVariable
			SettedLiargVariable=self.SettingValueVariable
			SettedKwargVariable=None

			#/####################/#
			# Check for an argument dict
			#

			#Check
			if hasattr(
					SettedLiargVariable,'items'
				): 

				#Check
				if any(
					map(
						lambda __KeyStr:
						__KeyStr in SettedLiargVariable,
						[
							SetLiargGrabStr,
							SetMapLiargGetGrabStr,
							SetLiargGetGrabStr,
							SetKwargGrabStr,
							SetMapKwargGetKeyGrabStr,
							SetMapKwargGetKeyValueGrabStr
						]
					)
				):

					#debug
					self.debug(
							[
								'It is a argument dict'
							]
						)

					#get
					[SettedLiargVariable,SettedKwargVariable]=map(
						lambda __KeyStr:
						ArgumentDict(
							SettedLiargVariable,
							self
						)[__KeyStr],
						['LiargVariablesList','KwargVariablesDict']
					)

					#debug
					'''
					self.debug(
							[
								'SettedLiargVariable is '+SYS._str(SettedLiargVariable),
								'SettedKwargVariable is '+SYS._str(SettedKwargVariable),
							]
						)
					'''

				else:

					#/###################/
					# It is a get dict
					#

					#call a set to active the #value get
					self.set(
							'TempSetVariable',
							SettedLiargVariable
						)

					#debug
					'''
					self.debug(
							[
								'This is a get dict ',
								'self.TempSetVariable is '+SYS._str(self.TempSetVariable),
								('self.',self,['SettingValueVariable'])
							]
						)
					'''

					#get
					SettedLiargVariable=self.TempSetVariable if type(
						self.TempSetVariable)==list else [self.TempSetVariable]

					#delete
					del self.__dict__['TempSetVariable']

					#reupdate
					self.SettingKeyVariable=SettedTempKeyVariable

			#Check
			if type(SettedLiargVariable)!=list:

				#get
				SettedLiargVariablesList=[SettedLiargVariable]
			else:

				#alias
				SettedLiargVariablesList=SettedLiargVariable

			#debug
			'''
			self.debug(
				[
					'we call here',
					('self.',self,['SettingKeyVariable']),
					'SettedLiargVariablesList is '+SYS._str(SettedLiargVariablesList)
				]
			)
			'''

			#call
			if SettedLiargVariable!=None and SettedKwargVariable!=None:

				self.SettingKeyVariable(
						*SettedLiargVariablesList,
						**SettedKwargVariable
					)
			else:

				self.SettingKeyVariable(
						*SettedLiargVariablesList	
					)

			#debug
			'''
			self.debug(
					'self.SettingKeyVariable.__self__ is '+SYS._str(
						self.SettingKeyVariable.__self__
					)
				)
			'''

			#Return
			return {'HookingIsBool':False}
	def mimic_set(self):

		#Check
		if self.SettingKeyVariable in [
											FigurePlotKeyStr,
											FigureScatterKeyStr,
											FigureBarKeyStr
										]:

			#debug
			'''
			self.debug(
					[
						'before plot',
						('self.',self,[
							#'ViewDeriveControllerVariable',
							'SettingValueVariable'
						])
					]
				)
			'''

			#init
			FigurePlotArgumentDict=Setter.ArgumentDict(
					self.SettingValueVariable,
					self.ViewDeriveControllerVariable
				)

			#debug
			'''
			self.debug(
					[
						'We plot here',
						'FigurePlotArgumentDict is',
						SYS._str(FigurePlotArgumentDict)
					]
				)
			'''

			#plot
			self.FigureCartoonVariablesList.append(
				self.FiguredAxesVariable.plot(
					*FigurePlotArgumentDict['LiargVariablesList'],
					**FigurePlotArgumentDict['KwargVariablesDict']
				)[0]
			)

			#debug
			'''
			self.debug(
				[
					('self.',self,['FigureCartoonVariablesList']),
					#str(self.FigureCartoonVariablesList[0][0]),
				]
			)
			'''

			#return 
			return {'HookingIsBool':False}

		elif self.SettingKeyVariable==FigureAxesKeyStr:

			#debug
			'''
			self.debug(
					[
						'before axes',
						('self.',self,[
							#'ViewDeriveControllerVariable',
							'FiguredAxesVariable'
						])
					]
				)
			'''

			#map
			ArgumentTuplesList=map(
					lambda __ItemTuple:
					(
						__ItemTuple[0],
						Setter.ArgumentDict(
								__ItemTuple[1],
								self.ViewDeriveControllerVariable
							)
					),
					SYS.SetList(
						self.SettingValueVariable
					)
				)

			#debug
			'''
			self.debug(
					[
						'We axe here',
						'ArgumentTuplesList is ',
						SYS._str(ArgumentTuplesList),
					]
				)
			'''

			#map
			map(
					lambda __ArgumentTuple:
					SYS.get(
						self.FiguredAxesVariable,
						__ArgumentTuple[0]
					)()
					if len(__ArgumentTuple[1]['LiargVariablesList']
						)==0 and __ArgumentTuple[1]['KwargVariablesDict']==None
					else(
						SYS.get(
							self.FiguredAxesVariable,
							__ArgumentTuple[0]
						)(**__ArgumentTuple[1]['KwargVariablesDict'])
						if len(__ArgumentTuple[1]['LiargVariablesList']
						)==0
						else(
							SYS.get(
								self.FiguredAxesVariable,
								__ArgumentTuple[0]
							)(
								*__ArgumentTuple[1]['LiargVariablesList'],
								**__ArgumentTuple[1]['KwargVariablesDict']
							) 
							if __ArgumentTuple[1]['KwargVariablesDict']!=None
							else
							SYS.get(
								self.FiguredAxesVariable,
								__ArgumentTuple[0]
							)(
								*__ArgumentTuple[1]['LiargVariablesList']
							)
						)
					),
					ArgumentTuplesList
				)

			#return 
			return {'HookingIsBool':False}

		elif type(self.SettingKeyVariable)==str and self.SettingKeyVariable.startswith(
			FigureMpld3KeyStr):

			#deprefix
			ToolTipKeyStr=SYS.deprefix(
					self.SettingKeyVariable,
					FigureMpld3KeyStr
				)

			#debug
			'''
			self.debug(
					[
						'before plugins',
						('self.',self,['ViewDeriveControllerVariable'])
					]
				)
			'''

			#init
			FigurePluginArgumentDict=Setter.ArgumentDict(
					self.SettingValueVariable,
					self.ViewDeriveControllerVariable
				)

			#debug
			'''
			self.debug(
					[
						'We plugin here',
						'FigurePluginArgumentDict is ',
						SYS._str(FigurePluginArgumentDict)
					]
				)
			'''

			#plugin
			from mpld3 import plugins
			self.FigureTooltipVariablesList=map(
				lambda __FigureCartoonVariable:
				getattr(
					plugins,
					ToolTipKeyStr
				)(
					*[
						__FigureCartoonVariable
					]+FigurePluginArgumentDict['LiargVariablesList'],
					**FigurePluginArgumentDict['KwargVariablesDict']
				),
				self.FigureCartoonVariablesList
			)

			#debug
			'''
			self.debug(
					[
						('self.',self,['FigureTooltipVariablesList'])
					]
				)
			'''
			
			#connect
			map(
				lambda __FigureTooltipVariable:
				plugins.connect(
					self.FigurePyplotVariable,
					__FigureTooltipVariable
				),
				self.FigureTooltipVariablesList
			)

			#return 
			return {'HookingIsBool':False}

		#call the base method
		BaseClass.set(self)
Пример #22
0
	def do_apply(self):
		""" """

		#debug
		self.debug(
					('self.',self,[
									'ApplyingMethodVariable',
									'ApplyingArgVariable'
								])
		)
	
		#Check
		if type(self.ApplyingArgVariable)!=SYS.ApplyDictClass:

			#Check
			if self.ApplyingMethodVariable in [
				'get','__getitem__','execute'
			]:

				#Check
				if type(self.ApplyingArgVariable)!=list:
					self.ApplyingArgVariable=[self.ApplyingArgVariable]

			#init
			self.ApplyingArgVariable=SYS.ApplyDictClass(
					{
						'LiargVariablesList':self.ApplyingArgVariable
					}
				)

		#Check
		if type(self.ApplyingMethodVariable)!=str:

			#Check
			if type(self.ApplyingMethodVariable)==SYS.ApplyDictClass:

				#apply
				self.apply(
						self.ApplyingMethodVariable['MethodStr'],
						self.ApplyingMethodVariable
					)

				#return
				return

			elif hasattr(self.ApplyingMethodVariable,'items'):

				#map 
				map(
						lambda __ItemTuple:
						self.apply(
							__ItemTuple[0],
							__ItemTuple[1]
						),
						self.ApplyingMethodVariable.items()
					)

				#return
				return

			elif type(self.ApplyingMethodVariable)==list:

				#debug
				self.debug(
						[
							'we do a map top map',
							('self.',self,[
									'ApplyingMethodVariable',
									'ApplyingArgVariable'
								])
						]
					)

				#map
				self.AppliedMapVariablesList=map(
						lambda __MethodVariable,__ArgVariable:
						self.apply(
							__MethodVariable,
							__ArgVariable
						),
						self.ApplyingMethodVariable,
						self.ApplyingArgVariable['LiargVariablesList']
					)

				#return
				return 

		else:

			#Check
			if self.ApplyingMethodVariable.startswith(ApplyMapPrefixStr):

				#Set
				ApplyArgVariable=self.ApplyingArgVariable['LiargVariablesList']

				#Check
				if hasattr(ApplyArgVariable,'items'):
					ApplyArgVariable=ApplyArgVariable.items()

				#apply a map to map
				self.apply(
						[
							SYS.deprefix(
								self.ApplyingMethodVariable,
								ApplyMapPrefixStr
							)
						]*len(self.ApplyingArgVariable),
						ApplyArgVariable
					)

				#return 
				return 

			else:

				#set
				self.AppliedMethod=getattr(
					self,
					self.ApplyingMethodVariable
				)

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

				#Check
				if self.AppliedMethod!=None:

					#debug
					self.debug(
								[
									'AppliedMethod is good, We are going to apply',
									('self.',self,[
										'AppliedMethod',
										'ApplyingArgVariable'
									])
								]
							)
					
					#Check
					if len(self.ApplyingArgVariable['KwargVariablesDict'])>0:

						#debug
						'''
						self.debug('We apply with a KwargVariablesDict')
						'''

						#Call the AppliedMethod
						self.AppliedOutputVariable=self.AppliedMethod(
							*self.ApplyingArgVariable['LiargVariablesList'],
							**self.ApplyingArgVariable['KwargVariablesDict']
						) 
					else:

						#debug
						'''
						self.debug('We apply without a KwargVariablesDict')
						'''
						
						#Call
						self.AppliedOutputVariable=self.AppliedMethod(
							*self.ApplyingArgVariable['LiargVariablesList']
						)
	def mimic_set(self):

		#debug
		'''
		self.debug(
				('self.',self,[
						'SettingKeyVariable',
						'SettingValueVariable'
					])
			)
		'''

		#Check
		if type(self.SettingKeyVariable)==str:

			#Check
			if self.SettingKeyVariable.startswith(
				CommandPrefixStr
			):

				#debug
				'''
				self.debug(
						'We command here'
					)
				'''

				#deprefix
				CommandGetKeyStr=SYS.deprefix(
					self.SettingKeyVariable,
					CommandPrefixStr
				)
				
				#Check
				if CommandGetKeyStr.startswith(CommandWalkStr):

					#debug
					'''
					self.debug(
							'We command-walk here'
						)
					'''

					#command
					self.command(
						SYS.deprefix(
							CommandGetKeyStr,
							CommandWalkStr
						),
						self.SettingValueVariable,
						_AfterWalkRigidBool=True
					)

					#stop the setting
					return {'HookingIsBool':False}

				elif CommandGetKeyStr.startswith(CommandSelfStr+CommandWalkStr):

					#debug
					'''
					self.debug(
							'We command-self-walk here'
						)
					'''

					#command
					self.command(
						SYS.deprefix(
							CommandGetKeyStr,
							CommandSelfStr+CommandWalkStr
						),
						self.SettingValueVariable,
						_AfterWalkRigidBool=True,
						_SelfBool=True
					)

					#stop the setting
					return {'HookingIsBool':False}

				else:

					#command
					self.command(
						CommandGetKeyStr,
						self.SettingValueVariable
					)

					#stop the setting
					return {'HookingIsBool':False}

			#Check
			elif self.SettingKeyVariable.startswith(
				CommandWalkStr
			):

				#debug
				'''
				self.debug(
						'We walk-command here'
					)
				'''

				CommandGetKeyStr=SYS.deprefix(
						self.SettingKeyVariable,
						CommandWalkStr
					)

				#Check
				if CommandGetKeyStr.startswith(CommandPrefixStr):

					#command
					self.command(
						SYS.deprefix(
							CommandGetKeyStr,
							CommandPrefixStr
						),
						self.SettingValueVariable,
						_BeforeWalkRigidBool=True
					)

					#stop the setting
					return {'HookingIsBool':False}

				elif CommandGetKeyStr.startswith(CommandSelfStr):

					#command
					self.command(
						SYS.deprefix(
							CommandGetKeyStr,
							CommandSelfStr+CommandPrefixStr
						),
						self.SettingValueVariable,
						_BeforeWalkRigidBool=True,
						_AfterSelfRigidBool=True
					)

					#stop the setting
					return {'HookingIsBool':False}

			#Check
			elif self.SettingKeyVariable.startswith(
				CommandSelfStr+CommandWalkStr+CommandPrefixStr
			):

				#command
				self.command(
					SYS.deprefix(
						self.SettingKeyVariable,
						CommandSelfStr+CommandWalkStr+CommandPrefixStr
					),
					self.SettingValueVariable,
					_BeforeWalkRigidBool=True,
					_BeforeSelfRigidBool=True
				)

				#stop the setting
				return {'HookingIsBool':False}

		#debug
		'''
		self.debug(
				[
					'Call the base set method',
					'BaseClass is '+str(BaseClass),
					('self.',self,['SettingKeyVariable'])
				]
			)
		'''
		
		#Call the base method
		BaseClass.set(self)
Пример #24
0
	def mimic_set(self):

		#Check
		if type(self.SettingValueVariable
			)==str:

			#/####################/#
			# Case of a call of an execution str
			#

			#Check
			if self.SettingValueVariable.startswith(ExecutionPrefixStr):

				#debug
				'''
				self.debug('we execute here')
				'''

				#deprefix
				ExecutedStr="ExecutedVariable="+SYS.deprefix(
							self.SettingValueVariable,
							ExecutionPrefixStr
						)

				#debug
				'''
				self.debug('ExecutedStr is '+ExecutedStr)
				'''

				#execute
				self.execute(
					ExecutedStr
				)

				#alias
				self[self.SettingKeyVariable]=self.ExecutedLocalsDict['ExecutedVariable']

				#stop the getting
				return {'HookingIsBool':False}

		#/####################/#
		# Case of a call of a method of a child object
		#

		#Check
		if type(
				self.SettingKeyVariable
			)==str:

			#Check
			if ExecutionDotStr in self.SettingKeyVariable:

				#debug
				'''
				self.debug('we get an attribute of the SettingKeyVariable')
				'''

				#previous
				GetKeyStr,AttributeStr=SYS.previous(
							self.SettingKeyVariable,
							ExecutionDotStr
						)

				#debug
				'''
				self.debug(
						[
							'GetKeyStr is '+GetKeyStr,
							'AttributeStr is '+AttributeStr
						]
					)
				'''
				
				#get
				GetValueVariable=self[GetKeyStr]

				#get the get
				AttributeValueVariable=getattr(
						GetValueVariable,
						AttributeStr	
					)

				#debug
				'''
				self.debug(
						[
							'GetValueVariable is '+SYS._str(GetValueVariable),
							'AttributeValueVariable is '+SYS._str(AttributeValueVariable),
							('self.',self,['SettingValueVariable'])
						]
					)
				'''
				
				#call
				if callable(AttributeValueVariable):

					#debug
					'''
					self.debug(
						[
							'we set call',
							('self.',self,['SettingValueVariable']),
							'AttributeValueVariable is ',
							str(AttributeValueVariable)
						]
					)
					'''

					#Check
					if type(self.SettingValueVariable)==list and len(
						self.SettingValueVariable)>0 and hasattr(self.SettingValueVariable[0],'items'
						) and Setter.SetValueLambdaGrabStr in self.SettingValueVariable[0]:

							#get
							ExecutedMapLambdaList=self.getMapLambdaList(
								self.SettingValueVariable[0]
							)

							#debug
							self.debug(
								[
									'ExecutedMapLambdaList is ',
									SYS._str(ExecutedMapLambdaList)
								]
							)

							#set
							self[AttributeValueVariable]=[ExecutedMapLambdaList]

					else:
					
						#set
						self[AttributeValueVariable]=self.SettingValueVariable

						#get the method and call it
						#AttributeValueVariable(*LiargValueVariable)

				else:

					#alias
					AttributeValueVariable=LiargValueVariable

				#stop the setting
				return {'HookingIsBool':False}

		#Call the parent method
		BaseClass.set(self)
Пример #25
0
	def __init__(self,_ArgumentDict=None,_GetterVariable=None):

		#call the base method
		collections.OrderedDict.__init__(self)

		#debug
		'''
		_GetterVariable.debug(
			[
				'_ArgumentDict is ',
				SYS._str(_ArgumentDict)
			]
		)
		'''

		#init
		self['LiargVariablesList']=[]
		self['KwargVariablesDict']=None
		"""
		self['ArgumentDictBool']=any(
			map(
				lambda __KeyStr:
				__KeyStr in _ArgumentDict,
				[
					SetLiargGrabStr,
					SetMapLiargGetGrabStr,
					SetLiargGetGrabStr,
					SetKwargGrabStr,
					SetMapKwargGetKeyGrabStr,
					SetMapKwargGetKeyValueGrabStr
				]
			)
		)
		"""

		#Check
		if hasattr(_ArgumentDict,'items'):

			#/###################/#
			# Check for #liarg
			#

			if SetLiargGrabStr in _ArgumentDict:

				#debug
				'''
				_GetterVariable.debug(
					[
						'we itemize with a value with a SetValueGrabStr inside',
						'SettedTempLiargSettingValueVariable is '+SYS._str(
							SettedTempLiargSettingValueVariable)
					]
				)
				'''

				#set
				self['LiargVariablesList']=_ArgumentDict[
					SetLiargGrabStr
				]

			elif SetMapLiargGetGrabStr in _ArgumentDict:

				#debug
				'''
				_GetterVariable.debug(
					[
						'we set a value with a SetMapLiargGetGrabStr inside'
					]
				)
				'''
				
				#set
				self['LiargVariablesList']=_GetterVariable[
					SYS.deprefix(
						SetMapLiargGetGrabStr,
						SetLiargGrabPrefixStr
					)
				](
					*_ArgumentDict[SetMapLiargGetGrabStr]
				).ItemizedMapValueVariablesList

				#debug
				'''
				_GetterVariable.debug(
					[
						"self['LiargVariablesList'] is ",
						SYS._str(self['LiargVariablesList'])
					]
				)	
				'''
				
			#Check
			elif SetLiargGetGrabStr in _ArgumentDict:

				#debug
				_GetterVariable.debug(
					[
						'we set a value with a SetLiargGetGrabStr inside',
						'_ArgumentDict[SetLiargGetGrabStr] is ',
						_ArgumentDict[SetLiargGetGrabStr]
					]
				)
				
				#Get 
				self['LiargVariablesList']=_GetterVariable[
					_ArgumentDict[SetLiargGetGrabStr]
				]

				#debug
				_GetterVariable.debug(
					[
						'we set a value with a SetLiargGetGrabStr inside',
						'self[\'LiargVariablesList\'] is ',
						str(self['LiargVariablesList'])
					]
				)

			#/###################/#
			# Check for #kwarg
			#

			#Check
			if SetKwargGrabStr in _ArgumentDict:

				#debug
				'''
				_GetterVariable.debug(
						[
							'There is a #kwarg here'
						]
					)
				'''

				#get
				self['KwargVariablesDict']=_ArgumentDict[
					SetKwargGrabStr
				]

			elif SetMapKwargGetKeyGrabStr in _ArgumentDict:

				#debug
				'''
				_GetterVariable.debug(
					[
						'we set a value with a map SetMapKwargGetKeyGrabStr inside',
					]
				)
				'''

				#get get the keys
				SettedKeyVariablesList=_GetterVariable[
					Getter.GetMapStr
				](
					*_ArgumentDict[SetMapKwargGetKeyGrabStr].keys()
				).ItemizedMapValueVariablesList

				#get the values
				SettedValueVariablesList=_ArgumentDict[
					SetMapKwargGetKeyGrabStr
				].values()

				#set
				self['KwargVariablesDict']=dict(
					zip(
						SettedKeyVariablesList,
						SettedValueVariablesList
					)
				)
				
			elif SetMapKwargGetValueGrabStr in _ArgumentDict:

				#debug
				'''
				_GetterVariable.debug(
					[
						'we set a value with a map SetMapKwargGetValueGrabStr inside',
					]
				)
				'''

				#get get the keys
				SettedKeyVariablesList=_ArgumentDict[
					SetMapKwargGetValueGrabStr
				].keys()

				#get the values
				SettedValueVariablesList=_GetterVariable[
					Getter.GetMapStr
				](
					*_ArgumentDict[
					SetMapKwargGetValueGrabStr
				].values()
				).ItemizedMapValueVariablesList

				#set
				self['KwargVariablesDict']=dict(
					zip(
						SettedKeyVariablesList,
						SettedValueVariablesList
					)
				)

			elif SetMapKwargGetKeyValueGrabStr in _ArgumentDict:

				#debug
				'''
				_GetterVariable.debug(
					[
						'we set a value with a map SetMapKwargGetKeyValueGrabStr inside',
					]
				)
				'''

				#get get the keys
				SettedKeyVariablesList=_GetterVariable[
					Getter.GetMapStr
				](
					*_ArgumentDict[
						SetMapKwargGetKeyValueGrabStr
					].keys()
				).ItemizedMapValueVariablesList

				#get the values
				SettedValueVariablesList=_GetterVariable[
					Getter.GetMapStr
				](
					*_ArgumentDict[
						SetMapKwargGetKeyValueGrabStr
					].values()
				).ItemizedMapValueVariablesList

				#set
				self['KwargVariablesDict']=dict(
					zip(
						SettedKeyVariablesList,
						SettedValueVariablesList
					)
				)

		else:

			#Check
			if _ArgumentDict!="Noarg":

				#append
				self['LiargVariablesList'].append(_ArgumentDict)
Пример #26
0
	def mimic_get(self):

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

		#Check
		if type(self.GettingKeyVariable
			)==str:

			#Check
			if self.GettingKeyVariable.startswith(ExecutionPrefixStr):

				#deprefix
				ExecutedStr="ExecutedVariable="+SYS.deprefix(
							self.GettingKeyVariable,
							ExecutionPrefixStr
						)

				#debug
				'''
				self.debug('ExecutedStr is '+ExecutedStr)
				'''

				#execute
				self.execute(
						ExecutedStr
					)

				#alias
				self.GettedValueVariable=self.ExecutedLocalsDict['ExecutedVariable']

				#stop the getting
				return {'HookingIsBool':False}

			elif self.GettingKeyVariable.startswith(
					Getter.GetDirectPrefixStr
				)==False and ExecutionDotStr in self.GettingKeyVariable:

				#debug
				'''
				self.debug(
					[
						'we get an attribute of the GettingKeyVariable',
						[('self.',self,['GettingKeyVariable'])]
					]
				)
				'''
				
				#previous
				GetKeyStr,AttributeStr=SYS.previous(
							self.GettingKeyVariable,
							ExecutionDotStr
						)

				#debug
				'''
				self.debug(
					[
						'GetKeyStr is '+GetKeyStr,
						'AttributeStr is '+AttributeStr,
						'self is '+SYS._str(self)
					]
				)
				'''
				
				#get
				GetValueVariable=self[GetKeyStr]

				#debug
				'''
				self.debug(
					[
						'GetValueVariable is '+SYS._str(GetValueVariable)
					]
				)
				'''

				#get the get
				AttributeValueVariable=getattr(
						GetValueVariable,
						AttributeStr	
					)

				#debug
				'''
				self.debug(
						[
							('self.',self,['GettingKeyVariable']),
							'GetValueVariable is '+SYS._str(GetValueVariable),
							'AttributeValueVariable is '+SYS._str(AttributeValueVariable)
						]
					)
				'''

				#call
				if callable(AttributeValueVariable):

					#get the method and call it
					self.GettedValueVariable=AttributeValueVariable()

				else:

					#alias
					self.GettedValueVariable=AttributeValueVariable

				#stop the setting
				return {'HookingIsBool':False}


		#call the base method
		BaseClass.get(self)
	def mimic_set(self):

		#Check
		if self.SettingKeyVariable in [
											FigurePlotKeyStr,
											FigureScatterKeyStr,
											FigureBarKeyStr
										]:

			#debug
			'''
			self.debug(
					[
						'before plot',
						('self.',self,[
							#'ViewDeriveControllerVariable',
							'SettingValueVariable'
						])
					]
				)
			'''

			#init
			FigurePlotArgumentDict=Setter.ArgumentDict(
					self.SettingValueVariable,
					self.ViewDeriveControllerVariable
				)

			#debug
			'''
			self.debug(
					[
						'We plot here',
						'FigurePlotArgumentDict is',
						SYS._str(FigurePlotArgumentDict)
					]
				)
			'''

			#plot
			self.FigureCartoonVariablesList.append(
				self.FiguredAxesVariable.plot(
					*FigurePlotArgumentDict['LiargVariablesList'],
					**FigurePlotArgumentDict['KwargVariablesDict']
				)[0]
			)

			#debug
			'''
			self.debug(
				[
					('self.',self,['FigureCartoonVariablesList']),
					#str(self.FigureCartoonVariablesList[0][0]),
				]
			)
			'''

			#return 
			return {'HookingIsBool':False}

		elif self.SettingKeyVariable==FigureAxesKeyStr:

			#debug
			'''
			self.debug(
					[
						'before axes',
						('self.',self,[
							#'ViewDeriveControllerVariable',
							'FiguredAxesVariable'
						])
					]
				)
			'''

			#map
			ArgumentTuplesList=map(
					lambda __ItemTuple:
					(
						__ItemTuple[0],
						Setter.ArgumentDict(
								__ItemTuple[1],
								self.ViewDeriveControllerVariable
							)
					),
					SYS.SetList(
						self.SettingValueVariable
					)
				)

			
			#/#################/#
			# Special case for the legend
			#

			#dict
			ArgumentDict=dict(ArgumentTuplesList)
			if 'legend' in ArgumentDict:

				"""
				#Check
				if '#kwarg' not in ArgumentDict['legend']:
					ArgumentDict['legend']['#kwarg']={}

				#add
				ArgumentDict['legend']['#kwarg']['handles']=SYS.flat(
						map(
							lambda __Figurer:
							__Figurer.FigureCartoonVariablesList,
							self.TeamDict['Plots'].ManagementDict.values()
						)
					)
				"""

				#legend
				self.FiguredAxesVariable.legend()

				#link
				#ArgumentTuplesList[SYS.unzip(ArgumentTuplesList,[0]).index('legend')]=(
				#	'legend',
				#	ArgumentDict['legend']
				#)

				#remove
				del ArgumentTuplesList[SYS.unzip(ArgumentTuplesList,[0]).index('legend')]

			#debug
			self.debug(
					[
						'We axe here',
						'ArgumentTuplesList is ',
						SYS._str(ArgumentTuplesList)
					]
				)
			
			#map
			map(
					lambda __ArgumentTuple:
					getattr(
						self.FiguredAxesVariable,
						__ArgumentTuple[0]
					)()
					if len(__ArgumentTuple[1]['LiargVariablesList']
						)==0 and __ArgumentTuple[1]['KwargVariablesDict']==None
					else(
						getattr(
							self.FiguredAxesVariable,
							__ArgumentTuple[0],
							**__ArgumentTuple[1]['KwargVariablesDict']
						)()
						if len(__ArgumentTuple[1]['LiargVariablesList']
						)==0
						else(
							getattr(
								self.FiguredAxesVariable,
								__ArgumentTuple[0]
							)(
								*__ArgumentTuple[1]['LiargVariablesList'],
								**__ArgumentTuple[1]['KwargVariablesDict']
							) 
							if __ArgumentTuple[1]['KwargVariablesDict']!=None
							else
							getattr(
								self.FiguredAxesVariable,
								__ArgumentTuple[0]
							)(
								*__ArgumentTuple[1]['LiargVariablesList']
							)
						)
					),
					ArgumentTuplesList
				)

			#return 
			return {'HookingIsBool':False}

		elif type(self.SettingKeyVariable)==str and self.SettingKeyVariable.startswith(
			FigureMpld3KeyStr):

			#deprefix
			ToolTipKeyStr=SYS.deprefix(
					self.SettingKeyVariable,
					FigureMpld3KeyStr
				)

			#debug
			'''
			self.debug(
					[
						'before plugins',
						('self.',self,['ViewDeriveControllerVariable'])
					]
				)
			'''

			#init
			FigurePluginArgumentDict=Setter.ArgumentDict(
					self.SettingValueVariable,
					self.ViewDeriveControllerVariable
				)

			#debug
			'''
			self.debug(
					[
						'We plugin here',
						'FigurePluginArgumentDict is ',
						SYS._str(FigurePluginArgumentDict)
					]
				)
			'''

			#plugin
			from mpld3 import plugins
			self.FigureTooltipVariablesList=map(
				lambda __FigureCartoonVariable:
				getattr(
					plugins,
					ToolTipKeyStr
				)(
					*[
						__FigureCartoonVariable
					]+FigurePluginArgumentDict['LiargVariablesList'],
					**FigurePluginArgumentDict['KwargVariablesDict']
				),
				self.FigureCartoonVariablesList
			)

			#debug
			'''
			self.debug(
					[
						('self.',self,['FigureTooltipVariablesList'])
					]
				)
			'''
			
			#connect
			map(
				lambda __FigureTooltipVariable:
				plugins.connect(
					self.FigurePyplotVariable,
					__FigureTooltipVariable
				),
				self.FigureTooltipVariablesList
			)

			#return 
			return {'HookingIsBool':False}

		#call the base method
		BaseClass.set(self)
Пример #28
0
	def do_itemize(self):

		#reset
		self.setDone(SYS.ItemizerClass)

		#debug
		'''
		self.debug(
				[
					'We itemize here',
					('self.',self,['ItemizingKeyVariable'])
				]
			)
		'''

		#Check
		if type(self.ItemizingKeyVariable) in SYS.StrTypesList:

			#set
			self.ItemizedKeyStr=self.ItemizingKeyVariable

			#Check
			if self.ItemizingKeyVariable.startswith(ItemMapPrefixStr):

				#debug
				'''
				self.debug(
						'It is going to be a map'
					)
				'''

				#deprefix
				ItemizedMapMethodStr=SYS.deprefix(
						self.ItemizingKeyVariable,
						ItemMapPrefixStr
					)

				#get
				ItemizedMapMethod=getattr(
						self,
						ItemizedMapMethodStr
					)

				#set
				ItemizedMapBool=True

				#Check
				ItemizedGetMethod=getattr
				if self.ItemizingMapGetVariable==None:
					ItemizedGetMethod=SYS.getNone
				if type(self.ItemizingMapGetVariable)==list:
					ItemizedGetMethod=SYS.pick
				
				#define
				#def MapMethod(_MapList):
				def MapMethod(*_MapLiargVariablesList):

					#debug
					'''
					self.debug(
						[
							'_MapLiargVariablesList is '+SYS._str(_MapLiargVariablesList),
							#'ItemizedMapMethodStr is '+ItemizedMapMethodStr,
							#'ItemizedMapMethod is '+str(ItemizedMapMethod),
							#'ItemizedMapMethod.im_func is '+str(ItemizedMapMethod.im_func)
						]
					)
					'''

					#get
					ItemizedMapClass=ItemizedMapMethod.im_func.BaseDoClass

					#get
					ItemizedMapList=ItemizedMapClass.Module.getMapList(
						_MapLiargVariablesList
					)

					#debug
					"""
					for __ElementVariable in ItemizedMapList:

						#Debug
						print('ItemizedMapList is l 119')
						print(ItemizedMapList)
						print('__ElementVariable is ')
						print(__ElementVariable)
						print('ItemizedGetMethod is ')
						print(ItemizedGetMethod)
						print('')

						#get
						GetVariable=ItemizedGetMethod(
							ItemizedMapMethod(
									*__ElementVariable 
								),
							self.ItemizingMapGetVariable
						)

						#Debug
						print('GetVariable is ')
						print(GetVariable)
						print('')				
					"""
					
					#Debug
					'''
					self.debug(
						[
							'ItemizedMapMethod is '+SYS._str(ItemizedMapMethod),
							#'self.ItemizedMapMethod.__name__ is '+self.ItemizedMapMethod.__name__,
							#'self.__class__.InspectInspectDict[self.ItemizedMapMethod.__name__] is ',
							#SYS._str(self.__class__.InspectInspectDict[self.ItemizedMapMethod.__name__])
							#'ItemizedMapClass is '+str(ItemizedMapClass),
							'ItemizedMapList is '+SYS._str(ItemizedMapList)
						]
					)
					'''
					
					#return
					self.ItemizedMapValueVariablesList=map(
						lambda __ElementVariable:
						ItemizedMapClass.getMapValueVariable(
							ItemizedMapMethod(
									*__ElementVariable 
								)
						),
						ItemizedMapList
					)

					#return self
					return self

				#alias
				self.ItemizedValueMethod=MapMethod

				#return 
				return

		#try
		try:

			#debug
			'''
			self.debug(
				[
					'We find in the InspectMethodDict',
					'self.__class__.InspectMethodDict is ',
					SYS._str(self.__class__.InspectMethodDict)
				]
			)
			'''
			
			#get
			ItemizedValueUnboundMethod=self.__class__.InspectMethodDict[
				self.ItemizingKeyVariable
			]

			#set
			self.ItemizedMethodStr=self.ItemizingKeyVariable

			#alias
			self.ItemizedValueMethod=getattr(
				self,
				self.ItemizedMethodStr
			)

		except:

			#debug
			'''
			self.debug(
					[
						'This is not a method call directly',
					]
				)
			'''

			#alias
			self.ItemizedValueVariable=self.ItemizingValueVariable
	def mimic_set(self):

		#debug
		'''
		self.debug(
				('self.',self,[
						'SettingKeyVariable',
						'SettingValueVariable',
					])
			)
		'''

		#Check
		if type(self.SettingKeyVariable)==str:

			#Check
			if self.SettingKeyVariable.startswith(PointToStr):

				#debug
				'''
				self.debug(
						'we point just here'
					)
				'''

				#point
				self.point(
						SYS.deprefix(
							self.SettingKeyVariable,
							PointToStr
						),
						self.SettingValueVariable
					)

				#return
				return {'HookingIsBool':False}

			elif self.SettingKeyVariable.startswith(PointBackStr):

				#debug
				'''
				self.debug(
						'we point back here'
					)
				'''
				
				#point
				self.point(
						SYS.deprefix(
							self.SettingKeyVariable,
							PointBackStr
						),
						self.SettingValueVariable[0],
						_BackSetKeyVariable=self.SettingValueVariable[1],
						_BackBool=True
					)

				#return
				return {'HookingIsBool':False}

			'''
			elif self.SettingKeyVariable.startswith(PointPrefixStr):

				#debug
				self.debug(
						'we set in the encapsulate'
					)

				#set
				SettedValueVariable=self[
						self.SettingKeyVariable
					]

				#alias
				SettedValueVariable=self.SettingValueVariable
					

				#return
				return {'HookingIsBool':False}
			'''

		#debug
		'''
		self.debug(
				[
					'Call the base set method',
					'BaseClass is '+str(BaseClass),
					('self.',self,['SettingKeyVariable'])
				]
			)
		'''

		#call the base method
		return BaseClass.set(self)
Пример #30
0
	def mimic_get(self):

		#Definition
		OutputDict={'HookingIsBool':True}

		#debug
		'''
		self.debug(
			('self.',self,['GettingKeyVariable'])
		)
		'''
		
		#Check
		if self.GettingKeyVariable==ManagementChildPrefixStr:

			#debug
			'''
			self.debug('We get all the children teams')
			'''

			#return
			self.GettedValueVariable=self.ManagementDict

			#Stop the getting
			return {'HookingIsBool':False}

		elif type(
			self.GettingKeyVariable
		)==str:

			#Check
			if self.GettingKeyVariable.startswith(
				ManagementChildPrefixStr
			):

				#deprefix
				GetKeyStr=SYS.deprefix(
						self.GettingKeyVariable,
						ManagementChildPrefixStr
					)

				#Check
				if GetKeyStr[0]!='.':

					#debug
					'''
					self.debug(
						[
							'We manage here',
							"SYS.deprefix(self.GettingKeyVariable,ManagementChildPrefixStr) is",
							SYS.deprefix(self.GettingKeyVariable,ManagementChildPrefixStr)
						]
					)
					'''

					#manage
					self.GettedValueVariable=self.manage(
						SYS.deprefix(self.GettingKeyVariable,ManagementChildPrefixStr)
					).ManagedValueVariable

					#debug
					'''
					self.debug(
						[
							'Ok we have managed',
							('self.',self,['GettedValueVariable'])
						]
					)
					'''

					#Stop the getting
					return {'HookingIsBool':False}

				#Check
				else:

					#debug
					'''
					self.debug(
						[
							'We team here',
							('self.',self,['GettingKeyVariable'])
						]
					)
					'''

					#team
					self.GettedValueVariable=getattr(
						self.ManagementDict,
						GetKeyStr[1:]
					)()

					#Stop the setting
					return {'HookingIsBool':False}

		#Call the parent get method
		return BaseClass.get(self)