当前位置: 首页>>代码示例>>Python>>正文


Python ShareYourSystem.getNameStrWithClassStr方法代码示例

本文整理汇总了Python中ShareYourSystem.getNameStrWithClassStr方法的典型用法代码示例。如果您正苦于以下问题:Python ShareYourSystem.getNameStrWithClassStr方法的具体用法?Python ShareYourSystem.getNameStrWithClassStr怎么用?Python ShareYourSystem.getNameStrWithClassStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShareYourSystem的用法示例。


在下文中一共展示了ShareYourSystem.getNameStrWithClassStr方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: default_init

# 需要导入模块: import ShareYourSystem [as 别名]
# 或者: from ShareYourSystem import getNameStrWithClassStr [as 别名]
	def default_init(self,**_KwargVariablesDict):

		#set the NameStr
		self.NameStr=SYS.getNameStrWithClassStr(self.__class__.__name__)

		#Map the update
		map(
				lambda __ItemTuple:
				self.__setattr__(__ItemTuple[0],__ItemTuple[1]) 
				#If we want to not set the items setted during hooks and that are not specified...
				if hasattr(self,__ItemTuple[0]) else None
				,_KwargVariablesDict.iteritems()
			)

		#call the base method
		object.__init__(self)
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:18,代码来源:__init__.py

示例2: getSwitch

# 需要导入模块: import ShareYourSystem [as 别名]
# 或者: from ShareYourSystem import getNameStrWithClassStr [as 别名]
def getSwitch(_InstanceVariable,_MethodVariable=None):

	#Check
	if _MethodVariable==None:
		SwitchItemTuplesList=_InstanceVariable.SwitchMethodDict.items()
	elif type(_MethodVariable) in [list,tuple]:
		SwitchItemTuplesList=map(
			lambda __MethodStr:
			(
				__MethodStr,
				_InstanceVariable.SwitchMethodDict[__MethodStr]
			),
			_MethodVariable
		)
	else:
		SwitchItemTuplesList=[
			(
				_MethodVariable,
				_InstanceVariable.SwitchMethodDict[_MethodVariable]
			)
		]
		

	#Debug
	'''
	print('getSwitch l 266')
	print('_MethodVariable is ')
	print(_MethodVariable)
	print('SwitchItemTuplesList is ')
	print(SwitchItemTuplesList)
	print('')
	'''

	#return 
	WatchKeyStrsList=SYS.flat(
		SYS.flat(
			map(
				lambda __SwitchItemTuple:
				map(
					lambda __ClassStr:
					map(
						lambda __HookStr:
						'Watch'+__HookStr+SYS.getUpperWordStr(
							__SwitchItemTuple[0]
							)+'With'+SYS.getNameStrWithClassStr(
							__ClassStr
						)+'Bool',
						['Before','After']
					),
					map(lambda __Class:__Class.__name__,__SwitchItemTuple[1])
				),
				SwitchItemTuplesList
			)
		)
	)

	#Debug
	'''
	print('getSwitch l 300')
	print('WatchKeyStrsList is ')
	print(WatchKeyStrsList)
	print('WatchKeyStrsList is ')
	print(WatchKeyStrsList)
	print('')
	'''

	#return
	return dict(
				zip(
					WatchKeyStrsList,
					map(
						lambda __WatchKeyStr:
						getattr(_InstanceVariable,__WatchKeyStr),
						WatchKeyStrsList
					)
				)
			)
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:79,代码来源:__init__.py

示例3: SwitchedFunction

# 需要导入模块: import ShareYourSystem [as 别名]
# 或者: from ShareYourSystem import getNameStrWithClassStr [as 别名]
        def SwitchedFunction(*_LiargVariablesList, **_KwargVariablesDict):

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

            # Alias
            InstanceVariable = _LiargVariablesList[0]

            # set at the class level
            SwitchedClass = InstanceVariable.__class__

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

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

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

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

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

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

                # set also at the scale of

            elif getattr(InstanceVariable, self.SwitchedInstanceBoolKeyStr):

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

                # Return
                return InstanceVariable

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

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

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

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

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

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

                    # Alias
                    TriggeredInstanceVariable = _TriggeringVariablesList[0]

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

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

                    # set the name

#.........这里部分代码省略.........
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:103,代码来源:__init__+copy+4.py

示例4: do_switch

# 需要导入模块: import ShareYourSystem [as 别名]
# 或者: from ShareYourSystem import getNameStrWithClassStr [as 别名]

#.........这里部分代码省略.........

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

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

            elif getattr(InstanceVariable, self.SwitchedInstanceBoolKeyStr):

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

                # Return
                return InstanceVariable

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

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

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

            # Return self for the wrapped method call
            return InstanceVariable

            # Definition the SwitchedDoerStr

        SwitchedDoerStr = Doer.getDoerStrWithDoStr(SwitchedDoStr)

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

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

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

            # Alias
            TriggeredInstanceVariable = _TriggeringVariablesList[0]

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

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

            # set the name

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

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

        # Link the triggerBefore function
        setattr(
            self.DoClass,
            TriggeredBeforeMethodStr,
            Triggerer.TriggererClass(
                **{
                    "TriggeringConditionVariable": [
                        ("SettingKeyVariable", (operator.eq, self.SwitchedInstanceBoolKeyStr)),
                        (self.SwitchedInstanceBoolKeyStr, (operator.eq, True)),
                        ("SettingValueVariable", (operator.eq, False)),
                    ],
                    "TriggeringHookStr": "Before",
                }
            )(triggerBefore),
        )
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:104,代码来源:__init__+copy+5.py

示例5: __call__

# 需要导入模块: import ShareYourSystem [as 别名]
# 或者: from ShareYourSystem import getNameStrWithClassStr [as 别名]
	def __call__(self,_Class):


		#/###################/#
		# Set the NameStr, Module, SelfClass...
		#

		#get
		self.Module=sys.modules[_Class.__module__]

		#debug
		'''
		print('Classor l.53 __call__ method')
		print('_Class is ',_Class)
		print('')
		'''

		#set in the class the classed Strs
		_Class.NameStr=SYS.getNameStrWithClassStr(_Class.__name__)

		#Give a Pointer to the Hooker
		setattr(_Class,'DeriveClassor',self)

		#set to the SYS the module
		if len(SYS.NameStrsList)==0:
			setattr(SYS,self.NameStr,sys.modules[self.__class__.__module__])
			setattr(SYS,self.__class__.__name__,self.__class__)
			SYS.NameStrsList.append(self.NameStr)
		setattr(SYS,_Class.NameStr,self.Module)
		setattr(SYS,_Class.__name__,_Class)
		SYS.NameStrsList.append(_Class.NameStr)

		#get the module and set it to the class
		_Class.Module=self.Module
		_Class.Module.LocalFolderPathStr=SYS.PythonlogyLocalFolderPathStr+self.Module.__name__.replace(
			'.','/')+'/'

		#set a pointer to itself
		_Class.SelfClass=_Class
		_Class.MroClassesList=_Class.__mro__
		_Class.MroClassesDict=dict(
			map(
				lambda __Class:
				(__Class.__name__,__Class),
				_Class.__mro__
			)
		)
		
		#Check
		if hasattr(_Class,'callAllMro')==False:
			setattr(
					_Class,
					callAllMro.__name__,
					callAllMro
				)
			setattr(
					_Class,
					setAllMro.__name__,
					setAllMro
				)
			setattr(
					_Class,
					mapSetAllMro.__name__,
					mapSetAllMro
				)
			setattr(
					_Class,
					getClass.__name__,
					getClass
				)
			
		#add in LocalModuleFolderPathStrAndModuleStrTuplesList
		global LocalModuleFolderPathStrAndModuleStrTuplesList
		LocalModuleFolderPathStrAndModuleStrTuplesList.append(
			(
				_Class.Module.LocalFolderPathStr,
				_Class.Module.__name__
			)
		)

		#/###################/#
		# Give ref to the concept module
		#

		#append
		ConceptModuleStr='.'.join(_Class.Module.__name__.split('.')[:-1])
		if hasattr(_Class,"ConceptModuleStr")==False or _Class.ConceptModuleStr!=ConceptModuleStr:

			#set
			_Class.ConceptModuleStr=ConceptModuleStr

			#append
			LocalModuleFolderPathStrAndModuleStrTuplesList.append(
					(
						SYS.PythonlogyLocalFolderPathStr+ConceptModuleStr.replace('.','/')+'/',
						ConceptModuleStr
					)
				)
			
		#/###################/#
#.........这里部分代码省略.........
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:103,代码来源:__init__.py


注:本文中的ShareYourSystem.getNameStrWithClassStr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。