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


Python Dictionary.__updateAttr__方法代码示例

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


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

示例1: Class

# 需要导入模块: from Dictionary import Dictionary [as 别名]
# 或者: from Dictionary.Dictionary import __updateAttr__ [as 别名]

#.........这里部分代码省略.........
    def __addSpecialMethod__(self, aFileName):
        if self.method.has_key("%sStaticMethod"%self.name):
            return
        theId = self.hT.itsId.__get__()
        self.method.update({"%sStaticMethod"%self.name:theId})
        self.hT.itsId.__next__()
        self.hT.__registerSpecialMethod__("%sStaticMethod"%self.name,
                                          theId,
                                          self.Id,
                                          aFileName)
        self.SpecialBehaviorId = theId
    
    def __setStaticField__(self,
                           aId,
                           aValue,
                           aFrameLineNo,
                           aCurrentLasti,
                           aParentTimestamp,
                           aDepth):
        theThreadId = self.hT.__getThreadId__(thread.get_ident())
        theCurrentTimestamp = self.hT.__convertTimestamp__(time.time())
        if not self.hT.itsProbe.has_key((aCurrentLasti, self.SpecialBehaviorId)):
            theProbeId = self.hT.__registerProbe__(aCurrentLasti,
                                              self.SpecialBehaviorId,
                                              aFrameLineNo)
        else:
            theProbeId = hT.itsProbe[(aCurrentLasti,aTheSpecialBehaviorId)]
        self.hT.itsPacker.reset()
        self.hT.itsPacker.pack_int(self.hT.itsEvents['set'])
        self.hT.itsPacker.pack_int(self.hT.itsObjects['classAttribute'])
        self.hT.itsPacker.pack_int(aId)
        theDataType = self.hT.__getDataType__(aValue)
        self.hT.itsPacker.pack_int(theDataType)
        thePackValue = self.hT.__packValue__(theDataType, aValue)
        self.hT.itsPacker.pack_int(theProbeId)
        self.hT.itsPacker.pack_hyper(aParentTimestamp)        
        self.hT.itsPacker.pack_int(aDepth)
        self.hT.itsPacker.pack_hyper(theCurrentTimestamp)
        self.hT.itsPacker.pack_int(theThreadId)
        if self.hT.FLAG_DEBUGG:
            print self.hT.itsEvents['set'],
            print self.hT.itsObjects['classAttribute'],
            print Id,
            print theDataType,
            print thePackValue,
            print theProbeId,
            print aParentTimestamp,
            print aCurrentDepth,
            print theCurrentTimestamp,
            print theThreadId
            raw_input()
        try:
            self.hT.itsSocket.sendall(self.hT.itsPacker.get_buffer())
            pass
        except:
            print 'TOD está durmiendo :-(', 'set static field'   
    
    def __register_set_StaticField__(self, 
                                     aLocals, 
                                     aFrameLineNo,
                                     aParentTimestamp,
                                     aDepth,
                                     aFileName):
        theLower = 0
        theUpper = len(self.code.co_code)
        theCode = self.code.co_code   
        while theLower < theUpper:
            theOp = ord(theCode[theLower])
            theNameOp = dis.opname[theOp]      
            theLower = theLower + 1
            if theOp >= dis.HAVE_ARGUMENT:
                theValue = ord(theCode[theLower])
                theValue += ord(theCode[theLower+1])*256
                if theNameOp == 'STORE_NAME':
                    #print self.code.co_names[theValue]
                    #registro el atributo estático
                    theStaticFieldName = self.code.co_names[theValue]                    
                    self.staticField.__updateStaticField__(
                                                    {theStaticFieldName:aLocals[theStaticFieldName]}, 
                                                    self.Id)
                    #creamos un metodo artificial para almacenar
                    #la definición de los atributos de clase
                    self.__addSpecialMethod__(aFileName)
                    #set para el atributo estático
                    if not re.search(self.hT.itsMethodPattern,theStaticFieldName):
                        if not inspect.isfunction(aLocals[theStaticFieldName]):
                            self.__setStaticField__(
                                                self.staticField[theStaticFieldName], 
                                                aLocals[theStaticFieldName],
                                                aFrameLineNo,
                                                theLower,
                                                aParentTimestamp,
                                                aDepth)
                theLower = theLower + 2
    
    def __addStaticField__(self, aLocals):
        self.staticField.__updateStaticField__(aLocals, self.Id)
    
    def __addAttribute__(self, aName, aObjectId):
        self.attributes.__updateAttr__({aName:-1}, aObjectId)       
开发者ID:awhawks,项目名称:stiq,代码行数:104,代码来源:objectClass.py


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