summaryrefslogtreecommitdiff
path: root/examples/v1arch
diff options
context:
space:
mode:
authorelie <elie>2011-01-20 17:11:43 +0000
committerelie <elie>2011-01-20 17:11:43 +0000
commit2d34d4d970b975180de2e14c1ecc18c2db9838df (patch)
treebfd65788a72f82129484058f160969285f9661be /examples/v1arch
parente661d69e4866c44faa98a52f106711968bf4946f (diff)
downloadpysnmp-git-2d34d4d970b975180de2e14c1ecc18c2db9838df.tar.gz
all dict.has_key() & dict.get() invocations replaced with modern syntax
(this breaks compatibility with Python 2.1 and older).
Diffstat (limited to 'examples/v1arch')
-rw-r--r--examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py4
-rw-r--r--examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py b/examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py
index 6c55aa45..9b3f992c 100644
--- a/examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py
+++ b/examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py
@@ -33,7 +33,7 @@ for mibVar in mibInstr:
def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg):
while wholeMsg:
msgVer = api.decodeMessageVersion(wholeMsg)
- if api.protoModules.has_key(msgVer):
+ if msgVer in api.protoModules:
pMod = api.protoModules[msgVer]
else:
print 'Unsupported SNMP version %s' % msgVer
@@ -66,7 +66,7 @@ def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg):
)
elif reqPDU.isSameTypeWith(pMod.GetRequestPDU()):
for oid, val in pMod.apiPDU.getVarBinds(reqPDU):
- if mibInstrIdx.has_key(oid):
+ if oid in mibInstrIdx:
varBinds.append((oid, mibInstrIdx[oid](msgVer)))
else:
# No such instance
diff --git a/examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py b/examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py
index 0287200e..a38c14cd 100644
--- a/examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py
+++ b/examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py
@@ -7,7 +7,7 @@ from pysnmp.proto import api
def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg):
while wholeMsg:
msgVer = int(api.decodeMessageVersion(wholeMsg))
- if api.protoModules.has_key(msgVer):
+ if msgVer in api.protoModules:
pMod = api.protoModules[msgVer]
else:
print 'Unsupported SNMP version %s' % msgVer