예제 #1
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 do_point(self):

		#debug
		'''
		self.debug(
			[
				'we point here',
				('self.',self,[
								'PointingToGetVariable',
								'PointingToSetKeyVariable'
							])
			]
		)
		'''

		#Check
		if self.PointingToGetVariable!=None:

			#/###################/#
			# First point TO like a classic set
			#

			#debug
			self.debug(
				[
					'First we get the target',
					('self.',self,['PointingToGetVariable'])
				]
			)

			#get
			PointedToVariable=self[
				self.PointingToGetVariable
			]

			#debug
			'''
			self.debug(
				[
					'PointedToVariable is '+SYS._str(
						PointedToVariable
					),
					'If it is None, maybe we have to parent first'
				]
			)
			'''

			#Check
			"""
			if PointedToVariable==None:

				#parent
				self['?^']

				#debug
				self.debug(
						[
							'We have parented',
							('self.',self,['ParentedTotalPathStr']),
							'So we can get again'
						]
					)

				#get
				PointedToVariable=self[
					self.PointingToGetVariable
				]
			"""

			#debug
			'''
			self.debug(
				[
					'PointedToVariable is '+SYS._str(
						PointedToVariable
					),
					'Now we check the set key str'
				]
			)
			'''

			#/####################/#
			# Check for the SetKeyVariable
			#

			#Check
			if self.PointingToSetKeyVariable in [None,""]:

				#debug
				'''
				self.debug(
						[
							"self.PointingToSetKeyVariable in [None,""]...",
							"so we use the PointingGetVariable to name the pointer"
						]
					)
				'''

				#str
				PointedToSetKeyVariable=str(
						self.PointingToGetVariable
					).replace('/','_')

				#debug
				self.debug(
						[
							'PointedToSetKeyVariable is '+PointedToSetKeyVariable
						]
					)

				#Check
				if self.PointingManagementBool:

					#debug
					self.debug(
							[
								'We put that in the Management dict'
							]
						)

					#add
					PointedToSetKeyVariable=Manager.ManagementChildPrefixStr+PointedToSetKeyVariable

			else:

				#set direct
				PointedToSetKeyVariable=self.PointingToSetKeyVariable

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

			#Check
			if type(PointedToSetKeyVariable)==str and PointedToSetKeyVariable.endswith(
				Pather.PathPrefixStr)==False:

				#debug
				'''
				self.debug('It is a direct path')
				'''
				
				if self.PointingEncapsulationBool==False:

					#set
					self.set(
							PointedToSetKeyVariable,
							PointedToVariable
						)
				else:

					pass



			else:

				#debug
				'''
				self.debug(
					[
						'It is an encapsulate path',
						'PointedToSetKeyVariable is ',
						str(PointedToSetKeyVariable),
						'Check if it is with a str or a variable'
					]
				)
				'''

				#/###############/#
				# Case where it is just a default encapsulator
				#

				#Check
				if type(PointedToSetKeyVariable)==str:

					#previous
					PointedPreviousSetTagStr,PointedKeyStr=SYS.previous(
						PointedToSetKeyVariable
					)

					#debug
					self.debug(
						[
							'PointedPreviousSetTagStr is ',
							PointedPreviousSetTagStr,
							'PointedKeyStr is ',
							PointedKeyStr
						]
					)

					#Check
					if self.PointingManagementBool:

						#debug
						self.debug(
								[
									'We put that in the Management dict'
								]
							)

						#add
						PointedPreviousSetTagStr=Manager.ManagementChildPrefixStr+PointedPreviousSetTagStr

					#get
					PointedGettedValueVariable=self[
						PointedPreviousSetTagStr
					]

					#Check
					if PointedKeyStr!="":

						#debug
						self.debug(
								'We just set normally'
							)

						#point
						PointedGettedValueVariable.set(
								PointedKeyStr,
								PointedToVariable
							)

					else:

						#debug
						self.debug(
								'We set the PointToVariable and PointFromVariable'
							)

						#point
						PointedGettedValueVariable.set(
								'PointToVariable',
								PointedToVariable
							)

						#point
						PointedGettedValueVariable.set(
								'PointFromVariable',
								self
							)



			#debug
			'''
			self.debug(
						[
							'After getting',
							('locals()["',locals(),[
											'PointedToVariable',
											],']
										)
						]
					)
			'''

			#/###################/#
			# Maybe do a back point
			#

			#Check
			if self.PointingBackBool:

				#debug
				'''
				self.debug(
						[
							'We point back',
							('self.',self,['PointingBackSetKeyVariable'])
						]
					)
				'''

				#Check
				if self.PointingBackSetKeyVariable==None:
					
					#debug
					'''
					self.debug(
						'PointedToSetKeyVariable is '+str(PointedToSetKeyVariable)
					)
					'''

					#/###################/#
					# Case where the PointedToSetKeyVariable is derived from a pathsetstr
					#

					#split
					PointedKeyStrsList=PointedToSetKeyVariable.split('_')
					if len(PointedKeyStrsList)>1:

						#remove the last
						PointedKeyStrsList=PointedKeyStrsList[1:]

						#reverse
						PointedKeyStrsList.reverse()

						#join
						PointedBackSetKeyVariable='_'.join(PointedKeyStrsList)

					#/###################/#
					# else just take the id and put a prefix
					#

					else:

						#set default
						PointedBackSetKeyVariable=str(self.PrintIdInt)

					#add
					PointedBackSetKeyVariable=PointBackPrefixStr+PointedBackSetKeyVariable+self.NameStr

				else:

					#just alias
					PointedBackSetKeyVariable=self.PointingBackSetKeyVariable

				#debug
				self.debug(
						[
							'we set the back',
							'PointedBackSetKeyVariable is '+SYS._str(
								PointedBackSetKeyVariable
							),
							'PointedToVariable is '+SYS._str(
								PointedToVariable
							)
						]
					)

				#set
				PointedToVariable.point(
						self,
						PointedBackSetKeyVariable,
						_BackBool=False
					)

			#alias
			self.PointedToVariable=PointedToVariable
예제 #3
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)