本文整理匯總了Python中Dictionary.Dictionary.has_key方法的典型用法代碼示例。如果您正苦於以下問題:Python Dictionary.has_key方法的具體用法?Python Dictionary.has_key怎麽用?Python Dictionary.has_key使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dictionary.Dictionary
的用法示例。
在下文中一共展示了Dictionary.has_key方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Class
# 需要導入模塊: from Dictionary import Dictionary [as 別名]
# 或者: from Dictionary.Dictionary import has_key [as 別名]
class Class(object):
def __init__(self, aHt, aClassId, aCode, aLnotab):
self.hT = aHt
self.staticField = Dictionary(self.hT)
self.attributes = Dictionary(self.hT)
self.method = Dictionary(self.hT)
self.lnotab = aLnotab
self.code = aCode
self.name = aCode.co_name
self.Id = aClassId
self.SpecialBehaviorId = -1
def __getId__(self):
return self.Id
def __getLnotab__(self):
return self.lnotab
def __addMethod__(self, aCode, aLocals):
for theKey,theValue in aLocals.iteritems():
if inspect.isfunction(theValue):
if not (theKey == '__module__'):
theId = self.hT.itsId.__get__()
self.method.update({theKey:theId})
self.hT.itsId.__next__()
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
#.........這裏部分代碼省略.........