fix issues raising pylint warnings
+ small bug fixes Change-Id: Ib63bf13ad06446d3ec3b8cd0b16f9426cef9e3f4
This commit is contained in:
parent
039ece9549
commit
d9cc85c1df
@ -517,7 +517,7 @@ class SecopClient(ProxyClient):
|
||||
raise ConnectionError('connection closed before reply')
|
||||
action, _, data = entry[2] # pylint: disable=unpacking-non-sequence
|
||||
if action.startswith(ERRORPREFIX):
|
||||
errcls = self.error_map(data[0] + "Error")
|
||||
errcls = self.error_map(data[0])
|
||||
raise errcls(data[1])
|
||||
return entry[2] # reply
|
||||
|
||||
|
@ -194,7 +194,7 @@ class FloatRange(DataType):
|
||||
try:
|
||||
value = float(value)
|
||||
except Exception:
|
||||
raise BadValueError('Can not __call__ %r to float' % value)
|
||||
raise BadValueError('Can not convert %r to float' % value)
|
||||
# map +/-infty to +/-max possible number
|
||||
value = clamp(-sys.float_info.max, value, sys.float_info.max)
|
||||
|
||||
|
@ -143,7 +143,7 @@ EXCEPTIONS = dict(
|
||||
NoSuchCommand=NoSuchCommandError,
|
||||
CommandFailed=CommandFailedError,
|
||||
CommandRunning=CommandRunningError,
|
||||
Readonly=ReadOnlyError,
|
||||
ReadOnly=ReadOnlyError,
|
||||
BadValue=BadValueError,
|
||||
CommunicationFailed=CommunicationFailedError,
|
||||
HardwareError=HardwareError,
|
||||
|
@ -149,9 +149,6 @@ class Parameter(Accessible):
|
||||
handler = Property(
|
||||
'[internal] overload the standard read and write functions', ValueType(),
|
||||
export=False, default=None, settable=False)
|
||||
persistent = Property(
|
||||
'[internal] persistent setting', BoolType(),
|
||||
export=False, default=False)
|
||||
initwrite = Property(
|
||||
'''[internal] write this parameter on initialization
|
||||
|
||||
|
@ -134,7 +134,7 @@ class HasProperties(HasDescriptors):
|
||||
propertyValues = None
|
||||
|
||||
def __init__(self):
|
||||
super(HasProperties, self).__init__()
|
||||
super().__init__()
|
||||
# store property values in the instance, keep descriptors on the class
|
||||
self.propertyValues = {}
|
||||
# pre-init
|
||||
@ -168,9 +168,9 @@ class HasProperties(HasDescriptors):
|
||||
if pn in getattr(base, 'propertyDict', {}):
|
||||
if callable(value):
|
||||
raise ProgrammingError('method %s.%s collides with property of %s' %
|
||||
(cls.__name__, pn, base.__name__))
|
||||
(cls.__name__, pn, base.__name__)) from None
|
||||
raise ProgrammingError('can not set property %s.%s to %r' %
|
||||
(cls.__name__, pn, value))
|
||||
(cls.__name__, pn, value)) from None
|
||||
cls.propertyDict[pn] = po
|
||||
|
||||
def checkProperties(self):
|
||||
@ -181,7 +181,7 @@ class HasProperties(HasDescriptors):
|
||||
self.propertyValues[pn] = po.datatype(self.propertyValues[pn])
|
||||
except (KeyError, BadValueError):
|
||||
name = getattr(self, 'name', self.__class__.__name__)
|
||||
raise ConfigError('%s.%s needs a value of type %r!' % (name, pn, po.datatype))
|
||||
raise ConfigError('%s.%s needs a value of type %r!' % (name, pn, po.datatype)) from None
|
||||
for pn, po in self.propertyDict.items():
|
||||
if pn.startswith('min'):
|
||||
maxname = 'max' + pn[3:]
|
||||
|
@ -26,6 +26,7 @@ import socketserver
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import errno
|
||||
|
||||
from secop.datatypes import BoolType, StringType
|
||||
from secop.errors import SECoPError
|
||||
@ -192,9 +193,9 @@ class TCPServer(socketserver.ThreadingTCPServer):
|
||||
self, ('0.0.0.0', port), TCPRequestHandler, bind_and_activate=True)
|
||||
break
|
||||
except OSError as e:
|
||||
if e.args[0] == 98: # address already in use
|
||||
if e.args[0] == errno.EADDRINUSE: # address already in use
|
||||
# this may happen despite of allow_reuse_address
|
||||
time.sleep(0.3 * (1 << ntry))
|
||||
time.sleep(0.3 * (1 << ntry)) # max accumulated sleep time: 0.3 * 31 = 9.3 sec
|
||||
else:
|
||||
self.log.error('could not initialize TCP Server: %r' % e)
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user