diff options
author | elie <elie> | 2015-10-17 15:34:21 +0000 |
---|---|---|
committer | elie <elie> | 2015-10-17 15:34:21 +0000 |
commit | 7ebcb3d0c1ce6b7722bf7b06b4826d27c2fa487b (patch) | |
tree | 8cdd9f0b8d08d4af24ff7ade9ead79285c037105 /pysnmp/carrier | |
parent | 71dd5565a4b2948237a87319b57c565e18605761 (diff) | |
download | pysnmp-git-7ebcb3d0c1ce6b7722bf7b06b4826d27c2fa487b.tar.gz |
multiple-statements-in-one-line linted out
Diffstat (limited to 'pysnmp/carrier')
-rw-r--r-- | pysnmp/carrier/asyncio/dgram/udp.py | 3 | ||||
-rw-r--r-- | pysnmp/carrier/asyncio/dgram/udp6.py | 3 | ||||
-rw-r--r-- | pysnmp/carrier/asyncore/dgram/base.py | 37 | ||||
-rw-r--r-- | pysnmp/carrier/asyncore/dgram/udp.py | 3 | ||||
-rw-r--r-- | pysnmp/carrier/asyncore/dgram/unix.py | 3 | ||||
-rw-r--r-- | pysnmp/carrier/base.py | 3 | ||||
-rw-r--r-- | pysnmp/carrier/error.py | 3 | ||||
-rw-r--r-- | pysnmp/carrier/twisted/dgram/udp.py | 3 | ||||
-rw-r--r-- | pysnmp/carrier/twisted/dgram/unix.py | 3 |
9 files changed, 39 insertions, 22 deletions
diff --git a/pysnmp/carrier/asyncio/dgram/udp.py b/pysnmp/carrier/asyncio/dgram/udp.py index 0470d1b2..b6d1c4c1 100644 --- a/pysnmp/carrier/asyncio/dgram/udp.py +++ b/pysnmp/carrier/asyncio/dgram/udp.py @@ -37,7 +37,8 @@ loop = asyncio.get_event_loop() domainName = snmpUDPDomain = (1, 3, 6, 1, 6, 1, 1) -class UdpTransportAddress(tuple, AbstractTransportAddress): pass +class UdpTransportAddress(tuple, AbstractTransportAddress): + pass class UdpAsyncioTransport(DgramAsyncioProtocol): sockFamily = socket.AF_INET diff --git a/pysnmp/carrier/asyncio/dgram/udp6.py b/pysnmp/carrier/asyncio/dgram/udp6.py index 63800112..7c92716f 100644 --- a/pysnmp/carrier/asyncio/dgram/udp6.py +++ b/pysnmp/carrier/asyncio/dgram/udp6.py @@ -10,7 +10,8 @@ loop = asyncio.get_event_loop() domainName = snmpUDP6Domain = (1, 3, 6, 1, 2, 1, 100, 1, 2) -class Udp6TransportAddress(tuple, AbstractTransportAddress): pass +class Udp6TransportAddress(tuple, AbstractTransportAddress): + pass class Udp6AsyncioTransport(DgramAsyncioProtocol): sockFamily = socket.has_ipv6 and socket.AF_INET6 or None 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 diff --git a/pysnmp/carrier/base.py b/pysnmp/carrier/base.py index 08273fb1..e7f09bc0 100644 --- a/pysnmp/carrier/base.py +++ b/pysnmp/carrier/base.py @@ -147,7 +147,8 @@ class AbstractTransportDispatcher: self.__timerResolution = timerResolution self.__timerDelta = timerResolution * 0.05 - def getTimerTicks(self): return self.__ticks + def getTimerTicks(self): + return self.__ticks def handleTimerTick(self, timeNow): if self.__nextTime == 0: # initial initialization diff --git a/pysnmp/carrier/error.py b/pysnmp/carrier/error.py index afae6e7d..c3c28d51 100644 --- a/pysnmp/carrier/error.py +++ b/pysnmp/carrier/error.py @@ -1,3 +1,4 @@ from pysnmp import error -class CarrierError(error.PySnmpError): pass +class CarrierError(error.PySnmpError): + pass diff --git a/pysnmp/carrier/twisted/dgram/udp.py b/pysnmp/carrier/twisted/dgram/udp.py index 7bf9b9c6..ef1c2e54 100644 --- a/pysnmp/carrier/twisted/dgram/udp.py +++ b/pysnmp/carrier/twisted/dgram/udp.py @@ -7,7 +7,8 @@ from pysnmp.carrier import error domainName = snmpUDPDomain = (1, 3, 6, 1, 6, 1, 1) -class UdpTransportAddress(tuple, AbstractTransportAddress): pass +class UdpTransportAddress(tuple, AbstractTransportAddress): + pass class UdpTwistedTransport(DgramTwistedTransport): addressType = UdpTransportAddress diff --git a/pysnmp/carrier/twisted/dgram/unix.py b/pysnmp/carrier/twisted/dgram/unix.py index 2e9f9db2..31324b74 100644 --- a/pysnmp/carrier/twisted/dgram/unix.py +++ b/pysnmp/carrier/twisted/dgram/unix.py @@ -7,7 +7,8 @@ from pysnmp.carrier import error domainName = snmpLocalDomain = (1, 3, 6, 1, 2, 1, 100, 1, 13) -class UnixTransportAddress(str, AbstractTransportAddress): pass +class UnixTransportAddress(str, AbstractTransportAddress): + pass class UnixTwistedTransport(DgramTwistedTransport): addressType = UnixTransportAddress |