summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2014-06-17 15:19:53 +0000
committerelie <elie>2014-06-17 15:19:53 +0000
commitd703289a12f1d6cdf15af88fcfe2d43ef8012bd9 (patch)
tree7278b1f6a5ad3f4d6ade56c8c6ecd56d1461298d
parentdad702f69446abcbcf32584743beb47f4583e0cd (diff)
downloadpysnmp-d703289a12f1d6cdf15af88fcfe2d43ef8012bd9.tar.gz
pylint'ed
-rw-r--r--pysnmp/carrier/asynsock/dgram/udp6.py2
-rw-r--r--pysnmp/carrier/asynsock/dgram/unix.py2
-rw-r--r--pysnmp/carrier/base.py6
-rw-r--r--pysnmp/carrier/twisted/base.py1
-rw-r--r--pysnmp/entity/observer.py3
-rw-r--r--pysnmp/entity/rfc3413/cmdgen.py2
-rw-r--r--pysnmp/entity/rfc3413/ntforg.py28
-rw-r--r--pysnmp/entity/rfc3413/twisted/cmdgen.py7
-rw-r--r--pysnmp/entity/rfc3413/twisted/ntforg.py4
-rw-r--r--pysnmp/proto/secmod/rfc3826/priv/aes.py1
-rw-r--r--pysnmp/smi/mibs/TRANSPORT-ADDRESS-MIB.py2
11 files changed, 27 insertions, 31 deletions
diff --git a/pysnmp/carrier/asynsock/dgram/udp6.py b/pysnmp/carrier/asynsock/dgram/udp6.py
index 7bba239..c34037d 100644
--- a/pysnmp/carrier/asynsock/dgram/udp6.py
+++ b/pysnmp/carrier/asynsock/dgram/udp6.py
@@ -1,7 +1,7 @@
# Implements asyncore-based UDP6 transport domain
try:
from socket import AF_INET6
-except:
+except ImportError:
AF_INET6 = None
from pysnmp.carrier.asynsock.dgram.base import DgramSocketTransport
diff --git a/pysnmp/carrier/asynsock/dgram/unix.py b/pysnmp/carrier/asynsock/dgram/unix.py
index 50d08aa..d488f2d 100644
--- a/pysnmp/carrier/asynsock/dgram/unix.py
+++ b/pysnmp/carrier/asynsock/dgram/unix.py
@@ -36,7 +36,7 @@ class UnixSocketTransport(DgramSocketTransport):
DgramSocketTransport.closeTransport(self)
try:
os.remove(self.__iface)
- except:
+ except OSError:
pass
UnixTransport = UnixSocketTransport
diff --git a/pysnmp/carrier/base.py b/pysnmp/carrier/base.py
index d3d9a6e..448b74d 100644
--- a/pysnmp/carrier/base.py
+++ b/pysnmp/carrier/base.py
@@ -60,7 +60,7 @@ class AbstractTransportDispatcher:
def registerRoutingCbFun(self, routingCbFun):
if self.__routingCbFun:
- raise error.CarrierError(
+ raise error.CarrierError(
'Data routing callback already registered'
)
self.__routingCbFun = routingCbFun
@@ -71,7 +71,7 @@ class AbstractTransportDispatcher:
def registerRecvCbFun(self, recvCb, recvId=None):
if recvId in self.__recvCallables:
- raise error.CarrierError(
+ raise error.CarrierError(
'Receive callback %r already registered' % (recvId is None and '<default>' or recvId,)
)
self.__recvCallables[recvId] = recvCb
@@ -189,7 +189,7 @@ class AbstractTransport:
def registerCbFun(self, cbFun):
if self._cbFun:
raise error.CarrierError(
- 'Callback function %s already registered at %s' % (self.__cbFun, self)
+ 'Callback function %s already registered at %s' % (self._cbFun, self)
)
self._cbFun = cbFun
diff --git a/pysnmp/carrier/twisted/base.py b/pysnmp/carrier/twisted/base.py
index c0afeaa..b302446 100644
--- a/pysnmp/carrier/twisted/base.py
+++ b/pysnmp/carrier/twisted/base.py
@@ -12,6 +12,5 @@ from pysnmp.carrier.base import AbstractTransport
class AbstractTwistedTransport(AbstractTransport):
protoTransportDispatcher = TwistedDispatcher
- """Base Twisted Transport, to be used with TwistedDispatcher"""
def __init__(self):
self._writeQ = []
diff --git a/pysnmp/entity/observer.py b/pysnmp/entity/observer.py
index 153817c..f04d611 100644
--- a/pysnmp/entity/observer.py
+++ b/pysnmp/entity/observer.py
@@ -13,6 +13,7 @@
# to exist to functions that are at the same or deeper level of invocation
# relative to execution point specified.
#
+from pysnmp import error
class MetaObserver:
def __init__(self):
@@ -52,7 +53,7 @@ class MetaObserver:
for execpoint in execpoints:
del self.__execpoints[execpoint]
else:
- self._execpoints.clear()
+ self.__execpoints.clear()
def getExecutionContext(self, execpoint):
return self.__execpoints[execpoint]
diff --git a/pysnmp/entity/rfc3413/cmdgen.py b/pysnmp/entity/rfc3413/cmdgen.py
index ec639f7..2ef85f2 100644
--- a/pysnmp/entity/rfc3413/cmdgen.py
+++ b/pysnmp/entity/rfc3413/cmdgen.py
@@ -254,7 +254,7 @@ class CommandGenerator:
0
)
- debug.logger & debug.flagApp and debug.logger('sendPdu: sendPduHandle %s, timeout %d*10 ms/%d ticks, retry %d of %d' % (sendPduHandle, timeout, timeoutInTicks, retries, retryCount))
+ debug.logger & debug.flagApp and debug.logger('sendPdu: sendPduHandle %s, timeout %d*10 ms/%d ticks, retry 0 of %d' % (sendPduHandle, timeout, timeoutInTicks, retryCount))
return sendRequestHandle
diff --git a/pysnmp/entity/rfc3413/ntforg.py b/pysnmp/entity/rfc3413/ntforg.py
index afa3807..98e92c8 100644
--- a/pysnmp/entity/rfc3413/ntforg.py
+++ b/pysnmp/entity/rfc3413/ntforg.py
@@ -242,14 +242,14 @@ class NotificationOriginator:
errorIndication,
pdu,
cbCtx):
- cbFun, cbCtx = cbCtx
- cbFun(snmpEngine,
- sendRequestHandle,
- errorIndication,
- pdu and v2c.apiPDU.getErrorStatus(pdu) or 0,
- pdu and v2c.apiPDU.getErrorIndex(pdu, muteErrors=True) or 0,
- pdu and v2c.apiPDU.getVarBinds(pdu) or (),
- cbCtx)
+ cbFun, cbCtx = cbCtx
+ cbFun(snmpEngine,
+ sendRequestHandle,
+ errorIndication,
+ pdu and v2c.apiPDU.getErrorStatus(pdu) or 0,
+ pdu and v2c.apiPDU.getErrorIndex(pdu, muteErrors=True) or 0,
+ pdu and v2c.apiPDU.getVarBinds(pdu) or (),
+ cbCtx)
def sendVarBinds(self,
snmpEngine,
@@ -381,13 +381,11 @@ class NotificationOriginator:
not self.__pendingNotifications[sendRequestHandle]:
if sendRequestHandle in self.__pendingNotifications:
del self.__pendingNotifications[sendRequestHandle]
- self._handleResponse(
- sendRequestHandle,
- statusInformation['errorIndication'],
- 0, 0, (),
- cbFun,
- cbCtx
- )
+ cbFun(snmpEngine,
+ sendRequestHandle,
+ statusInformation['errorIndication'],
+ None,
+ cbCtx)
return sendRequestHandle
debug.logger & debug.flagApp and debug.logger('sendVarBinds: sendRequestHandle %s, timeout %d' % (sendRequestHandle, timeout))
diff --git a/pysnmp/entity/rfc3413/twisted/cmdgen.py b/pysnmp/entity/rfc3413/twisted/cmdgen.py
index d57a824..71f6c50 100644
--- a/pysnmp/entity/rfc3413/twisted/cmdgen.py
+++ b/pysnmp/entity/rfc3413/twisted/cmdgen.py
@@ -1,8 +1,7 @@
from twisted.internet import defer
from pysnmp.entity.rfc3413 import cmdgen
-from pyasn1.compat.octets import null
-def _cbFun(snmpEngine, sendRequestHandle, errorIndication,
+def __cbFun(snmpEngine, sendRequestHandle, errorIndication,
errorStatus, errorIndex, varBinds, cbCtx):
df = cbCtx['df']
df.callback(
@@ -26,7 +25,7 @@ class AbstractCommandGenerator:
contextEngineId,
contextName,
varBinds,
- _cbFun,
+ __cbFun,
{ 'df': df } # anonymous dictionary used for cbCtx
)
return df
@@ -65,7 +64,7 @@ class AbstractBulkCommandGenerator:
contextEngineId,
contextName,
varBinds,
- _cbFun,
+ __cbFun,
{ 'df': df } # anonymous dictionary used for cbCtx
)
return df
diff --git a/pysnmp/entity/rfc3413/twisted/ntforg.py b/pysnmp/entity/rfc3413/twisted/ntforg.py
index d527663..cc796b6 100644
--- a/pysnmp/entity/rfc3413/twisted/ntforg.py
+++ b/pysnmp/entity/rfc3413/twisted/ntforg.py
@@ -2,7 +2,7 @@ from twisted.internet import defer
from pysnmp.entity.rfc3413 import ntforg
from pyasn1.compat.octets import null
-def _cbFun(snmpEngine, metaSendPduHandle, errorIndication,
+def __cbFun(snmpEngine, sendRequestHandle, errorIndication,
errorStatus, errorIndex, varBinds, cbCtx):
cbCtx.callback(
(snmpEngine, errorIndication, errorStatus, errorIndex, varBinds)
@@ -30,7 +30,7 @@ class NotificationOriginator:
notificationName,
instanceIndex,
additionalVarBinds,
- _cbFun,
+ __cbFun,
df
)
return df
diff --git a/pysnmp/proto/secmod/rfc3826/priv/aes.py b/pysnmp/proto/secmod/rfc3826/priv/aes.py
index a669138..1e9f91d 100644
--- a/pysnmp/proto/secmod/rfc3826/priv/aes.py
+++ b/pysnmp/proto/secmod/rfc3826/priv/aes.py
@@ -3,7 +3,6 @@ from pyasn1.type import univ
from pysnmp.proto.secmod.rfc3414.priv import base
from pysnmp.proto.secmod.rfc3414.auth import hmacmd5, hmacsha
from pysnmp.proto.secmod.rfc3414 import localkey
-from pyasn1.type import univ
from pysnmp.proto import errind, error
try:
diff --git a/pysnmp/smi/mibs/TRANSPORT-ADDRESS-MIB.py b/pysnmp/smi/mibs/TRANSPORT-ADDRESS-MIB.py
index 9e96625..e4ece3d 100644
--- a/pysnmp/smi/mibs/TRANSPORT-ADDRESS-MIB.py
+++ b/pysnmp/smi/mibs/TRANSPORT-ADDRESS-MIB.py
@@ -54,7 +54,7 @@ else:
raise socket.error(
'Invalid IPv6 address: "%s"' % (ip_string,)
)
- return '\x00' * 16;
+ return '\x00' * 16
elif spaces > 3:
raise socket.error(
'Invalid IPv6 address: "%s"' % (ip_string,)