本文整理匯總了Python中Dictionary.Dictionary.__updateStaticField__方法的典型用法代碼示例。如果您正苦於以下問題:Python Dictionary.__updateStaticField__方法的具體用法?Python Dictionary.__updateStaticField__怎麽用?Python Dictionary.__updateStaticField__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dictionary.Dictionary
的用法示例。
在下文中一共展示了Dictionary.__updateStaticField__方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Class
# 需要導入模塊: from Dictionary import Dictionary [as 別名]
# 或者: from Dictionary.Dictionary import __updateStaticField__ [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)