further fixes of py3 issues
complaints by pylint are mainly related to - remove object from base list in class definitions - unnecessary else/elif after return/raise Change-Id: I13d15449149cc8bba0562338d0c9c42e97163bdf Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21325 Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
parent
70a9c42a7a
commit
c1164568ae
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# pylint: disable=invalid-name
|
||||
# -*- coding: utf-8 -*-
|
||||
# *****************************************************************************
|
||||
#
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# pylint: disable=invalid-name
|
||||
# -*- coding: utf-8 -*-
|
||||
# *****************************************************************************
|
||||
#
|
||||
@ -21,7 +22,6 @@
|
||||
#
|
||||
# *****************************************************************************
|
||||
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
from os import path
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# pylint: disable=invalid-name
|
||||
# -*- coding: utf-8 -*-
|
||||
# *****************************************************************************
|
||||
#
|
||||
@ -22,7 +23,6 @@
|
||||
#
|
||||
# *****************************************************************************
|
||||
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
from os import path
|
||||
|
@ -74,7 +74,7 @@ def getClientOpts(cfgfile):
|
||||
return dict(item for item in parser.items('client'))
|
||||
|
||||
|
||||
class ClientConsole(object):
|
||||
class ClientConsole:
|
||||
|
||||
def __init__(self, cfgname, basepath):
|
||||
self.namespace = NameSpace()
|
||||
@ -99,7 +99,7 @@ class ClientConsole(object):
|
||||
help(arg)
|
||||
|
||||
|
||||
class TCPConnection(object):
|
||||
class TCPConnection:
|
||||
|
||||
def __init__(self, connect, port, **kwds):
|
||||
self.log = mlzlog.log.getChild('connection', False)
|
||||
@ -173,7 +173,7 @@ class TCPConnection(object):
|
||||
self.callbacks.discard(callback)
|
||||
|
||||
|
||||
class Client(object):
|
||||
class Client:
|
||||
|
||||
def __init__(self, opts):
|
||||
self.log = mlzlog.log.getChild('client', True)
|
||||
|
@ -44,7 +44,7 @@ from secop.protocol.messages import BUFFERREQUEST, COMMANDREQUEST, \
|
||||
READREQUEST, REQUEST2REPLY, WRITEREPLY, WRITEREQUEST
|
||||
|
||||
|
||||
class TCPConnection(object):
|
||||
class TCPConnection:
|
||||
# disguise a TCP connection as serial one
|
||||
|
||||
def __init__(self, host, port):
|
||||
@ -136,7 +136,7 @@ class TCPConnection(object):
|
||||
self.writeline(line)
|
||||
|
||||
|
||||
class Value(object):
|
||||
class Value:
|
||||
t = None # pylint: disable = C0103
|
||||
u = None
|
||||
e = None
|
||||
@ -165,7 +165,7 @@ class Value(object):
|
||||
return self.fmtstr % self.value
|
||||
|
||||
|
||||
class Client(object):
|
||||
class Client:
|
||||
secop_id = 'unknown'
|
||||
describing_data = {}
|
||||
stopflag = False
|
||||
@ -175,7 +175,7 @@ class Client(object):
|
||||
if 'testing' not in opts:
|
||||
self.log = mlzlog.log.getChild('client', True)
|
||||
else:
|
||||
class logStub(object):
|
||||
class logStub:
|
||||
|
||||
def info(self, *args):
|
||||
pass
|
||||
|
@ -48,7 +48,7 @@ DEFAULT_MAX_INT = 16777216
|
||||
Parser = Parser()
|
||||
|
||||
# base class for all DataTypes
|
||||
class DataType(object):
|
||||
class DataType:
|
||||
IS_COMMAND = False
|
||||
unit = ''
|
||||
fmtstr = '%r'
|
||||
@ -353,7 +353,7 @@ class EnumType(DataType):
|
||||
|
||||
|
||||
class BLOBType(DataType):
|
||||
minbytes = None
|
||||
minbytes = 0
|
||||
maxbytes = None
|
||||
|
||||
def __init__(self, minbytes=0, maxbytes=None):
|
||||
@ -366,7 +366,7 @@ class BLOBType(DataType):
|
||||
self.maxbytes = int(maxbytes)
|
||||
if self.minbytes < 0:
|
||||
raise BadValueError('sizes must be bigger than or equal to 0!')
|
||||
elif self.minbytes > self.maxbytes:
|
||||
if self.minbytes > self.maxbytes:
|
||||
raise BadValueError('maxbytes must be bigger than or equal to minbytes!')
|
||||
self.default = b'\0' * self.minbytes
|
||||
|
||||
@ -418,7 +418,7 @@ class StringType(DataType):
|
||||
self.set_prop('isUTF8', isUTF8, False, bool)
|
||||
if self.minchars < 0:
|
||||
raise BadValueError('sizes must be bigger than or equal to 0!')
|
||||
elif self.minchars > self.maxchars:
|
||||
if self.minchars > self.maxchars:
|
||||
raise BadValueError('maxchars must be bigger than or equal to minchars!')
|
||||
self.default = ' ' * self.minchars
|
||||
|
||||
@ -504,7 +504,7 @@ class BoolType(DataType):
|
||||
|
||||
def export_value(self, value):
|
||||
"""returns a python object fit for serialisation"""
|
||||
return True if self(value) else False
|
||||
return bool(self(value))
|
||||
|
||||
def import_value(self, value):
|
||||
"""returns a python object from serialisation"""
|
||||
@ -544,9 +544,9 @@ class ArrayOf(DataType):
|
||||
self.maxlen = int(maxlen)
|
||||
if self.minlen < 0:
|
||||
raise BadValueError('sizes must be > 0')
|
||||
elif self.maxlen < 1:
|
||||
if self.maxlen < 1:
|
||||
raise BadValueError('Maximum size must be >= 1!')
|
||||
elif self.minlen > self.maxlen:
|
||||
if self.minlen > self.maxlen:
|
||||
raise BadValueError('maxlen must be bigger than or equal to minlen!')
|
||||
self.default = [members.default] * self.minlen
|
||||
|
||||
@ -890,7 +890,7 @@ DATATYPES = dict(
|
||||
blob =lambda maxbytes, minbytes=0: BLOBType(minbytes=minbytes, maxbytes=maxbytes),
|
||||
string =lambda minchars=0, maxchars=None: StringType(minchars=minchars, maxchars=maxchars),
|
||||
array =lambda maxlen, members, minlen=0: ArrayOf(get_datatype(members), minlen=minlen, maxlen=maxlen),
|
||||
tuple =lambda members: TupleOf(*map(get_datatype, members)),
|
||||
tuple =lambda members: TupleOf(*tuple(map(get_datatype, members))),
|
||||
enum =lambda members: EnumType('', members=members),
|
||||
struct =lambda members, optional=None: StructOf(optional,
|
||||
**dict((n, get_datatype(t)) for n, t in list(members.items()))),
|
||||
|
@ -28,9 +28,8 @@ from secop.metaclass import ModuleMeta
|
||||
from secop.modules import Command, Parameter
|
||||
|
||||
|
||||
class Feature(object, metaclass=ModuleMeta):
|
||||
class Feature(metaclass=ModuleMeta):
|
||||
"""all things belonging to a small, predefined functionality influencing the working of a module"""
|
||||
pass
|
||||
|
||||
|
||||
class HAS_PID(Feature):
|
||||
|
@ -136,7 +136,7 @@ class MainWindow(QMainWindow):
|
||||
reply = self.show_save_message(self.tabWidget.tabText(index))
|
||||
if reply == QMessageBox.Cancel:
|
||||
return
|
||||
elif reply == QMessageBox.Save:
|
||||
if reply == QMessageBox.Save:
|
||||
self.save_tab(index)
|
||||
self.tabWidget.removeTab(index)
|
||||
|
||||
@ -158,7 +158,7 @@ class MainWindow(QMainWindow):
|
||||
if reply == QMessageBox.Cancel:
|
||||
event.ignore()
|
||||
return
|
||||
elif reply == QMessageBox.Save:
|
||||
if reply == QMessageBox.Save:
|
||||
for i in range(0, self.tabWidget.count()):
|
||||
self.save_tab(i)
|
||||
event.accept()
|
||||
|
@ -28,7 +28,7 @@ class NodeDisplay(QWidget):
|
||||
def __init__(self, file_path=None, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
loadUi(self, 'node_display.ui')
|
||||
self.saved = True if file_path else False
|
||||
self.saved = bool(file_path)
|
||||
self.created = self.tree_widget.set_file(file_path)
|
||||
self.tree_widget.save_status_changed.connect(self.change_save_status)
|
||||
self.tree_widget.currentItemChanged.connect(self.set_scroll_area)
|
||||
|
@ -104,8 +104,7 @@ class TreeWidget(QTreeWidget):
|
||||
self.set_tree(read_config(self.file_path))
|
||||
self.emit_save_status_changed(True)
|
||||
return True
|
||||
else:
|
||||
self.file_path = None
|
||||
self.file_path = None
|
||||
return self.new_tree()
|
||||
|
||||
def new_tree(self):
|
||||
@ -391,7 +390,7 @@ class AddDialog(QDialog):
|
||||
if self.exec_() == QDialog.Accepted:
|
||||
if self.kind in [NODE, MODULE, INTERFACE]:
|
||||
return [self.name.text(), self.get_value()]
|
||||
elif self.kind in [PARAMETER, PROPERTY, COMMENT]:
|
||||
if self.kind in [PARAMETER, PROPERTY, COMMENT]:
|
||||
return [self.get_value()]
|
||||
return None
|
||||
|
||||
|
@ -44,7 +44,7 @@ _orange = QBrush(QColor('#ffa500'))
|
||||
|
||||
my_uipath = path.dirname(__file__)
|
||||
|
||||
class MiniPlotCurve(object):
|
||||
class MiniPlotCurve:
|
||||
# placeholder for data
|
||||
linecolor = _black
|
||||
linewidth = 0 # set to 0 to disable lines
|
||||
|
@ -25,6 +25,7 @@
|
||||
import json
|
||||
import pprint
|
||||
from time import sleep
|
||||
import mlzlog
|
||||
|
||||
from secop.datatypes import EnumType, StringType
|
||||
from secop.errors import SECoPError
|
||||
@ -222,7 +223,6 @@ class ReadableWidget(QWidget):
|
||||
try:
|
||||
# if queried, we get the qualifiers as well, but don't want them
|
||||
# here
|
||||
import mlzlog
|
||||
mlzlog.getLogger('cached values').warn(
|
||||
'no cached value for %s:%s' % (self._module, pname))
|
||||
val = self._node.getParameter(self._module, pname)[0]
|
||||
|
@ -32,6 +32,7 @@ import subprocess
|
||||
import sys
|
||||
import threading
|
||||
import traceback
|
||||
import importlib
|
||||
from os import path
|
||||
|
||||
repodir = path.abspath(path.join(path.dirname(__file__), '..', '..'))
|
||||
@ -51,7 +52,7 @@ CONFIG = {
|
||||
|
||||
unset_value = object()
|
||||
|
||||
class lazy_property(object):
|
||||
class lazy_property:
|
||||
"""A property that calculates its value only once."""
|
||||
|
||||
def __init__(self, func):
|
||||
@ -89,7 +90,6 @@ def clamp(_min, value, _max):
|
||||
def get_class(spec):
|
||||
"""loads a class given by string in dotted notaion (as python would do)"""
|
||||
modname, classname = spec.rsplit('.', 1)
|
||||
import importlib
|
||||
if modname.startswith('secop'):
|
||||
module = importlib.import_module(modname)
|
||||
else:
|
||||
|
@ -26,7 +26,7 @@
|
||||
__ALL__ = ['Enum']
|
||||
|
||||
|
||||
class EnumMember(object):
|
||||
class EnumMember:
|
||||
"""represents one member of an Enum
|
||||
|
||||
has an int-type value and attributes 'name' and 'value'
|
||||
@ -53,7 +53,7 @@ class EnumMember(object):
|
||||
return -1 # XXX:!
|
||||
if self.value < other:
|
||||
return -1
|
||||
elif self.value > other:
|
||||
if self.value > other:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@ -262,7 +262,7 @@ class Enum(dict):
|
||||
elif isinstance(parent, dict):
|
||||
for k, v in parent.items():
|
||||
add(self, k, v)
|
||||
elif parent != None:
|
||||
elif parent is not None:
|
||||
raise TypeError('parent (if given) MUST be a dict or an Enum!')
|
||||
for k, v in kwds.items():
|
||||
add(self, k, v)
|
||||
@ -286,7 +286,7 @@ class Enum(dict):
|
||||
raise TypeError('Enum %r can not be changed!' % self.name)
|
||||
|
||||
def __repr__(self):
|
||||
return '<Enum %r (%d values)>' % (self.name, len(self)/2)
|
||||
return '<Enum %r (%d values)>' % (self.name, len(self)//2)
|
||||
|
||||
def __call__(self, key):
|
||||
return self[key]
|
||||
|
@ -149,7 +149,7 @@ def format_args(args):
|
||||
return repr(args) # for floats/ints/...
|
||||
|
||||
|
||||
class ArgsParser(object):
|
||||
class ArgsParser:
|
||||
"""returns a pythonic object from the input expression
|
||||
|
||||
grammar:
|
||||
@ -164,10 +164,8 @@ class ArgsParser(object):
|
||||
name = [A-Za-z_] [A-Za-z0-9_]*
|
||||
"""
|
||||
|
||||
DIGITS_CHARS = [c for c in '0123456789']
|
||||
NAME_CHARS = [
|
||||
c for c in '_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
]
|
||||
DIGITS_CHARS = '0123456789'
|
||||
NAME_CHARS = '_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
NAME_CHARS2 = NAME_CHARS + DIGITS_CHARS
|
||||
|
||||
def __init__(self, string=''):
|
||||
@ -276,7 +274,7 @@ class ArgsParser(object):
|
||||
|
||||
def parse_record(self):
|
||||
"""record_expr = '(' (name '=' expr ',')* ')' """
|
||||
if self.get != '(':
|
||||
if self.get() != '(':
|
||||
return None
|
||||
self.skip()
|
||||
res = {}
|
||||
|
@ -30,11 +30,11 @@ from secop.errors import IsBusyError
|
||||
from secop.lib import mkthread
|
||||
|
||||
|
||||
class Namespace(object):
|
||||
class Namespace:
|
||||
pass
|
||||
|
||||
|
||||
class Step(object):
|
||||
class Step:
|
||||
|
||||
def __init__(self, desc, waittime, func, *args, **kwds):
|
||||
self.desc = desc
|
||||
@ -44,7 +44,7 @@ class Step(object):
|
||||
self.kwds = kwds
|
||||
|
||||
|
||||
class SequencerMixin(object):
|
||||
class SequencerMixin:
|
||||
"""Mixin for worker classes that need to execute a sequence of actions,
|
||||
including waits, that exceeds the usual Tango timeout (about 3 seconds)
|
||||
and should be executed asynchronously.
|
||||
@ -129,11 +129,11 @@ class SequencerMixin(object):
|
||||
def read_status(self):
|
||||
if self.seq_is_alive():
|
||||
return self.Status.BUSY, 'moving: ' + self._seq_phase
|
||||
elif self._seq_error:
|
||||
if self._seq_error:
|
||||
if self._seq_fault_on_error:
|
||||
return self.Status.ERROR, self._seq_error
|
||||
return self.Status.WARN, self._seq_error
|
||||
elif self._seq_stopped:
|
||||
if self._seq_stopped:
|
||||
if self._seq_fault_on_stop:
|
||||
return self.Status.ERROR, self._seq_stopped
|
||||
return self.Status.WARN, self._seq_stopped
|
||||
|
@ -45,12 +45,12 @@ class ModuleMeta(PropertyMeta):
|
||||
and wraps read_*/write_* methods
|
||||
(so the dispatcher will get notfied of changed values)
|
||||
"""
|
||||
def __new__(mcs, name, bases, attrs):
|
||||
def __new__(cls, name, bases, attrs):
|
||||
commands = attrs.pop('commands', {})
|
||||
parameters = attrs.pop('parameters', {})
|
||||
overrides = attrs.pop('overrides', {})
|
||||
|
||||
newtype = type.__new__(mcs, name, bases, attrs)
|
||||
newtype = type.__new__(cls, name, bases, attrs)
|
||||
if '__constructed__' in attrs:
|
||||
return newtype
|
||||
|
||||
|
@ -324,6 +324,7 @@ class Readable(Module):
|
||||
rfunc() # pylint: disable = not-callable
|
||||
except Exception: # really all!
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
class Writable(Readable):
|
||||
|
@ -30,7 +30,7 @@ from secop.errors import ProgrammingError
|
||||
from secop.properties import HasProperties, Property
|
||||
|
||||
|
||||
class CountedObj(object):
|
||||
class CountedObj:
|
||||
ctr = [0]
|
||||
def __init__(self):
|
||||
cl = self.__class__.ctr
|
||||
@ -163,7 +163,7 @@ class Parameter(Accessible):
|
||||
del _set_unit_
|
||||
|
||||
|
||||
class UnusedClass(object):
|
||||
class UnusedClass:
|
||||
# do not derive anything from this!
|
||||
pass
|
||||
|
||||
@ -186,7 +186,7 @@ class Parameters(OrderedDict):
|
||||
return super(Parameters, self).__getitem__(self.exported.get(item, item))
|
||||
|
||||
|
||||
class ParamValue(object):
|
||||
class ParamValue:
|
||||
__slots__ = ['value', 'timestamp']
|
||||
def __init__(self, value, timestamp=0):
|
||||
self.value = value
|
||||
@ -195,7 +195,6 @@ class ParamValue(object):
|
||||
|
||||
class Commands(Parameters):
|
||||
"""class storage for Commands"""
|
||||
pass
|
||||
|
||||
|
||||
class Override(CountedObj):
|
||||
@ -232,10 +231,9 @@ class Override(CountedObj):
|
||||
#props['ctr'] = self.ctr
|
||||
return type(obj)(ctr=self.ctr, **props)
|
||||
return type(obj)(**props)
|
||||
else:
|
||||
raise ProgrammingError(
|
||||
u"Overrides can only be applied to Accessibles, %r is none!" %
|
||||
obj)
|
||||
raise ProgrammingError(
|
||||
u"Overrides can only be applied to Accessibles, %r is none!" %
|
||||
obj)
|
||||
|
||||
|
||||
class Command(Accessible):
|
||||
|
@ -40,7 +40,7 @@ further convertions are done by the validator of the datatype....
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
class Parser(object):
|
||||
class Parser:
|
||||
# all parsing methods return (parsed value, remaining string)
|
||||
# or (None, remaining_text) if parsing error
|
||||
|
||||
@ -153,9 +153,9 @@ class Parser(object):
|
||||
return None, orgtext
|
||||
if text[0] in '+-.0123456789':
|
||||
return self.parse_number(orgtext)
|
||||
elif text[0] == '{':
|
||||
if text[0] == '{':
|
||||
return self.parse_dict(orgtext)
|
||||
elif text[0] in '([<':
|
||||
if text[0] in '([<':
|
||||
return self.parse_tuple(orgtext)
|
||||
return self.parse_string(orgtext)
|
||||
|
||||
|
@ -45,7 +45,7 @@ SLOW = 2
|
||||
REGULAR = 3
|
||||
DYNAMIC = 4
|
||||
|
||||
class PollerBase(object):
|
||||
class PollerBase:
|
||||
|
||||
startup_timeout = 30 # default timeout for startup
|
||||
name = 'unknown' # to be overridden in implementors __init__ method
|
||||
@ -149,7 +149,7 @@ class Poller(PollerBase):
|
||||
raise ProgrammingError("module %s must have a pollinterval"
|
||||
% module.name)
|
||||
if polltype == AUTO: # covers also pobj.poll == True
|
||||
if pname == 'value' or pname == 'status':
|
||||
if pname in ('value', 'status'):
|
||||
polltype = DYNAMIC
|
||||
elif pobj.readonly:
|
||||
polltype = REGULAR
|
||||
|
@ -29,7 +29,7 @@ from secop.errors import ProgrammingError, ConfigError
|
||||
|
||||
|
||||
# storage for 'properties of a property'
|
||||
class Property(object):
|
||||
class Property:
|
||||
'''base class holding info about a property
|
||||
|
||||
properties are only sent to the ECS if export is True, or an extname is set
|
||||
@ -82,18 +82,18 @@ class PropertyMeta(type):
|
||||
joining the class's properties with those of base classes.
|
||||
"""
|
||||
|
||||
def __new__(mcs, name, bases, attrs):
|
||||
newtype = type.__new__(mcs, name, bases, attrs)
|
||||
def __new__(cls, name, bases, attrs):
|
||||
newtype = type.__new__(cls, name, bases, attrs)
|
||||
if '__constructed__' in attrs:
|
||||
return newtype
|
||||
|
||||
newtype = mcs.__join_properties__(newtype, name, bases, attrs)
|
||||
newtype = cls.__join_properties__(newtype, name, bases, attrs)
|
||||
|
||||
attrs['__constructed__'] = True
|
||||
return newtype
|
||||
|
||||
@classmethod
|
||||
def __join_properties__(mcs, newtype, name, bases, attrs):
|
||||
def __join_properties__(cls, newtype, name, bases, attrs):
|
||||
# merge properties from all sub-classes
|
||||
properties = Properties()
|
||||
for base in reversed(bases):
|
||||
@ -114,7 +114,7 @@ class PropertyMeta(type):
|
||||
return newtype
|
||||
|
||||
|
||||
class HasProperties(object, metaclass=PropertyMeta):
|
||||
class HasProperties(metaclass=PropertyMeta):
|
||||
properties = {}
|
||||
|
||||
def __init__(self, supercall_init=True):
|
||||
|
@ -50,7 +50,7 @@ from secop.protocol.messages import COMMANDREPLY, DESCRIPTIONREPLY, \
|
||||
HEARTBEATREPLY, IDENTREPLY, IDENTREQUEST, READREPLY, WRITEREPLY
|
||||
|
||||
|
||||
class Dispatcher(object):
|
||||
class Dispatcher:
|
||||
|
||||
def __init__(self, name, logger, options, srv):
|
||||
# to avoid errors, we want to eat all options here
|
||||
@ -145,7 +145,7 @@ class Dispatcher(object):
|
||||
def get_module(self, modulename):
|
||||
if modulename in self._modules:
|
||||
return self._modules[modulename]
|
||||
elif modulename in list(self._modules.values()):
|
||||
if modulename in list(self._modules.values()):
|
||||
return modulename
|
||||
raise NoSuchModuleError('Module does not exist on this SEC-Node!')
|
||||
|
||||
@ -296,8 +296,7 @@ class Dispatcher(object):
|
||||
|
||||
if handler:
|
||||
return handler(conn, specifier, data)
|
||||
else:
|
||||
raise InternalError('unhandled message!')
|
||||
raise InternalError('unhandled message!')
|
||||
|
||||
# now the (defined) handlers for the different requests
|
||||
def handle_help(self, conn, specifier, data):
|
||||
|
@ -40,7 +40,7 @@ except ImportError:
|
||||
import daemon.pidfile as pidlockfile
|
||||
|
||||
|
||||
class Server(object):
|
||||
class Server:
|
||||
# list allowed section prefixes
|
||||
# if mapped dict does not exist -> section need a 'class' option
|
||||
# otherwise a 'type' option is evaluatet and the class from the mapping dict used
|
||||
|
@ -30,7 +30,7 @@ from secop.lib import mkthread
|
||||
from secop.modules import Drivable, Module, Parameter, Readable, Writable
|
||||
|
||||
|
||||
class SimBase(object):
|
||||
class SimBase:
|
||||
def __init__(self, cfgdict):
|
||||
# spice up parameters if requested by extra property
|
||||
# hint: us a comma-separated list if mor than one extra_param
|
||||
|
@ -68,12 +68,11 @@ def get_version(abbrev=4):
|
||||
if git_version != release_version:
|
||||
write_release_version(git_version)
|
||||
return git_version
|
||||
elif release_version:
|
||||
if release_version:
|
||||
return release_version
|
||||
else:
|
||||
raise ValueError('Cannot find a version number - make sure that '
|
||||
'git is installed or a RELEASE-VERSION file is '
|
||||
'present!')
|
||||
raise ValueError('Cannot find a version number - make sure that '
|
||||
'git is installed or a RELEASE-VERSION file is '
|
||||
'present!')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -155,11 +155,11 @@ class MagneticField(Drivable):
|
||||
if self._state == self._state.enum.idle:
|
||||
return (PERSIST, 'at field') if self.value else \
|
||||
(self.Status.IDLE, 'zero field')
|
||||
elif self._state == self._state.enum.switch_on:
|
||||
if self._state == self._state.enum.switch_on:
|
||||
return (self.Status.PREPARE, self._state.name)
|
||||
elif self._state == self._state.enum.switch_off:
|
||||
if self._state == self._state.enum.switch_off:
|
||||
return (self.Status.FINISH, self._state.name)
|
||||
elif self._state == self._state.enum.ramp:
|
||||
if self._state == self._state.enum.ramp:
|
||||
return (self.Status.RAMPING, self._state.name)
|
||||
return (self.Status.ERROR, self._state.name)
|
||||
|
||||
|
@ -27,7 +27,7 @@ from secop.modules import Drivable, Parameter, Readable
|
||||
try:
|
||||
from pvaccess import Channel # import EPIVSv4 functionallity, PV access
|
||||
except ImportError:
|
||||
class Channel(object):
|
||||
class Channel:
|
||||
|
||||
def __init__(self, pv_name):
|
||||
self.pv_name = pv_name
|
||||
@ -48,7 +48,7 @@ except ImportError:
|
||||
try:
|
||||
from epics import PV
|
||||
except ImportError:
|
||||
class PV(object):
|
||||
class PV:
|
||||
|
||||
def __init__(self, pv_name):
|
||||
self.pv_name = pv_name
|
||||
|
@ -116,7 +116,7 @@ class GarfieldMagnet(SequencerMixin, Drivable):
|
||||
if field == tryfield:
|
||||
self.log.debug('current for %g T is %g A', field, trycurr)
|
||||
return trycurr # Gotcha!
|
||||
elif field > tryfield:
|
||||
if field > tryfield:
|
||||
# retry upper interval
|
||||
mincurr = trycurr
|
||||
minfield = tryfield
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
@pytest.fixture(scope="module")
|
||||
def constants():
|
||||
# setup
|
||||
class Constants(object):
|
||||
class Constants:
|
||||
ONE = 1
|
||||
TWO = 2
|
||||
c = Constants()
|
||||
|
@ -29,7 +29,7 @@ from secop.basic_validators import FloatProperty, PositiveFloatProperty, \
|
||||
NonNegativeIntProperty, BoolProperty, StringProperty, UnitProperty, \
|
||||
FmtStrProperty, OneOfProperty, NoneOr, EnumProperty, TupleProperty
|
||||
|
||||
class unprintable(object):
|
||||
class unprintable:
|
||||
def __str__(self):
|
||||
raise NotImplementedError
|
||||
|
||||
|
@ -30,7 +30,7 @@ from secop.client.baseclient import Client
|
||||
# define Test-only connection object
|
||||
|
||||
|
||||
class TestConnect(object):
|
||||
class TestConnect:
|
||||
callbacks = []
|
||||
|
||||
def writeline(self, line):
|
||||
|
@ -28,7 +28,7 @@ from secop.modules import Drivable
|
||||
from secop.poller import Poller, REGULAR, DYNAMIC, SLOW
|
||||
Status = Drivable.Status
|
||||
|
||||
class Time(object):
|
||||
class Time:
|
||||
STARTTIME = 1000 # artificial time zero
|
||||
def __init__(self):
|
||||
self.reset()
|
||||
@ -65,7 +65,7 @@ def patch_time(monkeypatch):
|
||||
monkeypatch.setattr(time, 'time', artime.time)
|
||||
|
||||
|
||||
class Event(object):
|
||||
class Event:
|
||||
def __init__(self):
|
||||
self.flag = False
|
||||
|
||||
@ -79,7 +79,7 @@ class Event(object):
|
||||
return self.flag
|
||||
|
||||
|
||||
class Parameter(object):
|
||||
class Parameter:
|
||||
def __init__(self, name, readonly, poll, polltype, interval):
|
||||
self.poll = poll
|
||||
self.polltype = polltype # used for check only
|
||||
@ -107,7 +107,7 @@ class Parameter(object):
|
||||
return 'Parameter(%s)' % ", ".join("%s=%r" % item for item in self.__dict__.items())
|
||||
|
||||
|
||||
class Module(object):
|
||||
class Module:
|
||||
properties = {}
|
||||
pollerClass = Poller
|
||||
iodev = 'common_iodev'
|
||||
|
Loading…
x
Reference in New Issue
Block a user