summaryrefslogtreecommitdiff
path: root/pysnmp/carrier/asyncore
diff options
context:
space:
mode:
authorelie <elie>2015-10-17 15:34:21 +0000
committerelie <elie>2015-10-17 15:34:21 +0000
commit7ebcb3d0c1ce6b7722bf7b06b4826d27c2fa487b (patch)
tree8cdd9f0b8d08d4af24ff7ade9ead79285c037105 /pysnmp/carrier/asyncore
parent71dd5565a4b2948237a87319b57c565e18605761 (diff)
downloadpysnmp-git-7ebcb3d0c1ce6b7722bf7b06b4826d27c2fa487b.tar.gz
multiple-statements-in-one-line linted out
Diffstat (limited to 'pysnmp/carrier/asyncore')
-rw-r--r--pysnmp/carrier/asyncore/dgram/base.py37
-rw-r--r--pysnmp/carrier/asyncore/dgram/udp.py3
-rw-r--r--pysnmp/carrier/asyncore/dgram/unix.py3
3 files changed, 27 insertions, 16 deletions
diff --git a/pysnmp/carrier/asyncore/dgram/base.py b/pysnmp/carrier/asyncore/dgram/base.py
index 0e139276..14ab8723 100644
--- a/pysnmp/carrier/asyncore/dgram/base.py
+++ b/pysnmp/carrier/asyncore/dgram/base.py
@@ -4,21 +4,22 @@ from pysnmp.carrier.asyncore.base import AbstractSocketTransport
from pysnmp.carrier import sockfix, sockmsg, error
from pysnmp import debug
-sockErrors = { # Ignore these socket errors
- errno.ESHUTDOWN: 1,
- errno.ENOTCONN: 1,
- errno.ECONNRESET: 0,
- errno.ECONNREFUSED: 0,
- errno.EAGAIN: 0,
- errno.EWOULDBLOCK: 0
- }
+# Ignore these socket errors
+sockErrors = {errno.ESHUTDOWN: True,
+ errno.ENOTCONN: True,
+ errno.ECONNRESET: False,
+ errno.ECONNREFUSED: False,
+ errno.EAGAIN: False,
+ errno.EWOULDBLOCK: False}
+
if hasattr(errno, 'EBADFD'):
# bad FD may happen upon FD closure on n-1 select() event
- sockErrors[errno.EBADFD] = 1
+ sockErrors[errno.EBADFD] = True
class DgramSocketTransport(AbstractSocketTransport):
sockType = socket.SOCK_DGRAM
- retryCount = 3; retryInterval = 1
+ retryCount = 3
+ retryInterval = 1
addressType = lambda x: x
def __init__(self, sock=None, sockMap=None):
self.__outQueue = []
@@ -112,8 +113,12 @@ class DgramSocketTransport(AbstractSocketTransport):
return ('0.0.0.0', 0)
# asyncore API
- def handle_connect(self): pass
- def writable(self): return self.__outQueue
+ def handle_connect(self):
+ pass
+
+ def writable(self):
+ return self.__outQueue
+
def handle_write(self):
outgoingMessage, transportAddress = self.__outQueue.pop(0)
debug.logger & debug.flagIO and debug.logger('handle_write: transportAddress %r -> %r outgoingMessage (%d octets) %s' % (transportAddress.getLocalAddress(), transportAddress, len(outgoingMessage), debug.hexdump(outgoingMessage)))
@@ -130,7 +135,9 @@ class DgramSocketTransport(AbstractSocketTransport):
else:
raise error.CarrierError('sendto() failed for %s: %s' % (transportAddress, sys.exc_info()[1]))
- def readable(self): return 1
+ def readable(self):
+ return 1
+
def handle_read(self):
try:
incomingMessage, transportAddress = self._recvfrom(
@@ -151,4 +158,6 @@ class DgramSocketTransport(AbstractSocketTransport):
return
else:
raise error.CarrierError('recvfrom() failed: %s' % (sys.exc_info()[1],))
- def handle_close(self): pass # no datagram connection
+
+ def handle_close(self):
+ pass # no datagram connection
diff --git a/pysnmp/carrier/asyncore/dgram/udp.py b/pysnmp/carrier/asyncore/dgram/udp.py
index c1cf2027..d35aab61 100644
--- a/pysnmp/carrier/asyncore/dgram/udp.py
+++ b/pysnmp/carrier/asyncore/dgram/udp.py
@@ -5,7 +5,8 @@ from pysnmp.carrier.asyncore.dgram.base import DgramSocketTransport
domainName = snmpUDPDomain = (1, 3, 6, 1, 6, 1, 1)
-class UdpTransportAddress(tuple, AbstractTransportAddress): pass
+class UdpTransportAddress(tuple, AbstractTransportAddress):
+ pass
class UdpSocketTransport(DgramSocketTransport):
sockFamily = AF_INET
diff --git a/pysnmp/carrier/asyncore/dgram/unix.py b/pysnmp/carrier/asyncore/dgram/unix.py
index de53d441..8e297934 100644
--- a/pysnmp/carrier/asyncore/dgram/unix.py
+++ b/pysnmp/carrier/asyncore/dgram/unix.py
@@ -12,7 +12,8 @@ domainName = snmpLocalDomain = (1, 3, 6, 1, 2, 1, 100, 1, 13)
random.seed()
-class UnixTransportAddress(str, AbstractTransportAddress): pass
+class UnixTransportAddress(str, AbstractTransportAddress):
+ pass
class UnixSocketTransport(DgramSocketTransport):
sockFamily = AF_UNIX