after running isort

Change-Id: I6d7dbb8dee9480fc9242529089a1b40f17f068e7
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25052
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2021-02-24 09:21:08 +01:00
parent 1a8ddbc696
commit bb6f692c6b
51 changed files with 197 additions and 168 deletions

View File

@ -22,21 +22,22 @@
# ***************************************************************************** # *****************************************************************************
"""general SECoP client""" """general SECoP client"""
import time
import queue
import json import json
from threading import Event, RLock, current_thread import queue
import time
from collections import defaultdict from collections import defaultdict
from threading import Event, RLock, current_thread
from secop.lib import mkthread, formatExtendedTraceback, formatExtendedStack
from secop.lib.asynconn import AsynConn, ConnectionClosed
from secop.datatypes import get_datatype
from secop.protocol.interface import encode_msg_frame, decode_msg
from secop.protocol.messages import REQUEST2REPLY, ERRORPREFIX, EVENTREPLY, WRITEREQUEST, WRITEREPLY, \
READREQUEST, READREPLY, IDENTREQUEST, IDENTPREFIX, ENABLEEVENTSREQUEST, COMMANDREQUEST, \
DESCRIPTIONREQUEST, HEARTBEATREQUEST
import secop.errors import secop.errors
import secop.params import secop.params
from secop.datatypes import get_datatype
from secop.lib import formatExtendedStack, formatExtendedTraceback, mkthread
from secop.lib.asynconn import AsynConn, ConnectionClosed
from secop.protocol.interface import decode_msg, encode_msg_frame
from secop.protocol.messages import COMMANDREQUEST, \
DESCRIPTIONREQUEST, ENABLEEVENTSREQUEST, ERRORPREFIX, \
EVENTREPLY, HEARTBEATREQUEST, IDENTPREFIX, IDENTREQUEST, \
READREPLY, READREQUEST, REQUEST2REPLY, WRITEREPLY, WRITEREQUEST
# replies to be handled for cache # replies to be handled for cache
UPDATE_MESSAGES = {EVENTREPLY, READREPLY, WRITEREPLY, ERRORPREFIX + READREQUEST, ERRORPREFIX + EVENTREPLY} UPDATE_MESSAGES = {EVENTREPLY, READREPLY, WRITEREPLY, ERRORPREFIX + READREQUEST, ERRORPREFIX + EVENTREPLY}

View File

@ -30,11 +30,6 @@ import time
from collections import OrderedDict from collections import OrderedDict
from select import select from select import select
try:
import mlzlog
except ImportError:
pass
import serial import serial
from secop.datatypes import CommandType, EnumType, get_datatype from secop.datatypes import CommandType, EnumType, get_datatype
@ -47,6 +42,13 @@ from secop.protocol.messages import BUFFERREQUEST, COMMANDREQUEST, \
HEARTBEATREQUEST, HELPREQUEST, IDENTREQUEST, READREPLY, \ HEARTBEATREQUEST, HELPREQUEST, IDENTREQUEST, READREPLY, \
READREQUEST, REQUEST2REPLY, WRITEREPLY, WRITEREQUEST READREQUEST, REQUEST2REPLY, WRITEREPLY, WRITEREQUEST
try:
import mlzlog
except ImportError:
pass
class TCPConnection: class TCPConnection:
# disguise a TCP connection as serial one # disguise a TCP connection as serial one

View File

@ -25,18 +25,18 @@
import code import code
import configparser
import socket import socket
import threading import threading
from collections import deque from collections import deque
from os import path from os import path
import configparser
import mlzlog import mlzlog
from secop.protocol.interface import decode_msg, encode_msg_frame, get_msg from secop.protocol.interface import decode_msg, encode_msg_frame, get_msg
from secop.protocol.messages import EVENTREPLY from secop.protocol.messages import EVENTREPLY
class NameSpace(dict): class NameSpace(dict):
def __init__(self): def __init__(self):

View File

@ -26,13 +26,14 @@
# allow to import the most important classes from 'secop' # allow to import the most important classes from 'secop'
# pylint: disable=unused-import # pylint: disable=unused-import
from secop.datatypes import FloatRange, IntRange, ScaledInteger, \ from secop.datatypes import ArrayOf, BLOBType, BoolType, EnumType, \
BoolType, EnumType, BLOBType, StringType, TupleOf, ArrayOf, StructOf FloatRange, IntRange, ScaledInteger, StringType, StructOf, TupleOf
from secop.lib.enum import Enum
from secop.modules import Module, Readable, Writable, Drivable, Communicator, Attached, Done
from secop.properties import Property
from secop.params import Parameter, Command
from secop.poller import AUTO, REGULAR, SLOW, DYNAMIC
from secop.iohandler import IOHandler, IOHandlerBase from secop.iohandler import IOHandler, IOHandlerBase
from secop.stringio import StringIO, HasIodev from secop.lib.enum import Enum
from secop.proxy import SecNode, Proxy, proxy_class from secop.modules import Attached, Communicator, \
Done, Drivable, Module, Readable, Writable
from secop.params import Command, Parameter
from secop.poller import AUTO, DYNAMIC, REGULAR, SLOW
from secop.properties import Property
from secop.proxy import Proxy, SecNode, proxy_class
from secop.stringio import HasIodev, StringIO

View File

@ -28,13 +28,13 @@
import sys import sys
from base64 import b64decode, b64encode from base64 import b64decode, b64encode
from secop.errors import ProgrammingError, ProtocolError, BadValueError, ConfigError from secop.errors import BadValueError, \
ConfigError, ProgrammingError, ProtocolError
from secop.lib import clamp from secop.lib import clamp
from secop.lib.enum import Enum from secop.lib.enum import Enum
from secop.parse import Parser from secop.parse import Parser
from secop.properties import HasProperties, Property from secop.properties import HasProperties, Property
# Only export these classes for 'from secop.datatypes import *' # Only export these classes for 'from secop.datatypes import *'
__all__ = [ __all__ = [
'DataType', 'get_datatype', 'DataType', 'get_datatype',

View File

@ -24,7 +24,7 @@
from secop.datatypes import ArrayOf, BoolType, EnumType, \ from secop.datatypes import ArrayOf, BoolType, EnumType, \
FloatRange, StringType, StructOf, TupleOf FloatRange, StringType, StructOf, TupleOf
from secop.modules import Command, Parameter, HasAccessibles from secop.modules import Command, HasAccessibles, Parameter
class Feature(HasAccessibles): class Feature(HasAccessibles):

View File

@ -21,13 +21,13 @@
# ***************************************************************************** # *****************************************************************************
import configparser import configparser
from configparser import NoOptionError
from collections import OrderedDict from collections import OrderedDict
from secop.gui.cfg_editor.tree_widget_item import TreeWidgetItem from configparser import NoOptionError
from secop.gui.cfg_editor.utils import get_all_items, get_params, get_props,\
get_all_children_with_names, get_module_class_from_name, \
get_interface_class_from_name
from secop.gui.cfg_editor.tree_widget_item import TreeWidgetItem
from secop.gui.cfg_editor.utils import get_all_children_with_names, \
get_all_items, get_interface_class_from_name, \
get_module_class_from_name, get_params, get_props
NODE = 'node' NODE = 'node'
INTERFACE = 'interface' INTERFACE = 'interface'

View File

@ -21,11 +21,11 @@
# ***************************************************************************** # *****************************************************************************
import os import os
from secop.gui.qt import QMainWindow, QMessageBox
from secop.gui.cfg_editor.node_display import NodeDisplay
from secop.gui.cfg_editor.utils import loadUi, get_file_paths
from secop.gui.cfg_editor.widgets import TabBar
from secop.gui.cfg_editor.node_display import NodeDisplay
from secop.gui.cfg_editor.utils import get_file_paths, loadUi
from secop.gui.cfg_editor.widgets import TabBar
from secop.gui.qt import QMainWindow, QMessageBox
# TODO move secop mainwinodw to gui/client and all specific stuff # TODO move secop mainwinodw to gui/client and all specific stuff
NODE = 'node' NODE = 'node'

View File

@ -20,8 +20,8 @@
# #
# ***************************************************************************** # *****************************************************************************
from secop.gui.qt import QWidget, Qt, QHBoxLayout, QSpacerItem, QSizePolicy
from secop.gui.cfg_editor.utils import loadUi from secop.gui.cfg_editor.utils import loadUi
from secop.gui.qt import QHBoxLayout, QSizePolicy, QSpacerItem, Qt, QWidget
class NodeDisplay(QWidget): class NodeDisplay(QWidget):

View File

@ -20,10 +20,11 @@
# #
# ***************************************************************************** # *****************************************************************************
from secop.gui.qt import QTreeWidgetItem, QFont, QWidget, QVBoxLayout, QLabel, \ from secop.gui.cfg_editor.utils import loadUi, \
QHBoxLayout, QPushButton, QSize, QSizePolicy, QDialog, QTextEdit, pyqtSignal set_name_edit_style, setIcon, setTreeIcon
from secop.gui.cfg_editor.utils import setTreeIcon, setIcon, loadUi, \ from secop.gui.qt import QDialog, QFont, QHBoxLayout, \
set_name_edit_style QLabel, QPushButton, QSize, QSizePolicy, QTextEdit, \
QTreeWidgetItem, QVBoxLayout, QWidget, pyqtSignal
from secop.gui.valuewidgets import get_widget from secop.gui.valuewidgets import get_widget
from secop.properties import Property from secop.properties import Property

View File

@ -20,15 +20,16 @@
# #
# ***************************************************************************** # *****************************************************************************
from os import path, listdir
import sys
import inspect import inspect
from secop.gui.qt import uic, QIcon, QSize, QFileDialog, QDialogButtonBox import sys
from secop.server import getGeneralConfig from os import listdir, path
from secop.gui.qt import QDialogButtonBox, QFileDialog, QIcon, QSize, uic
from secop.modules import Module from secop.modules import Module
from secop.params import Parameter from secop.params import Parameter
from secop.properties import Property from secop.properties import Property
from secop.protocol.interface.tcp import TCPServer from secop.protocol.interface.tcp import TCPServer
from secop.server import getGeneralConfig
uipath = path.dirname(__file__) uipath = path.dirname(__file__)

View File

@ -23,15 +23,15 @@
import os import os
from secop.gui.cfg_editor.config_file import write_config, read_config from secop.gui.cfg_editor.config_file import read_config, write_config
from secop.gui.cfg_editor.tree_widget_item import TreeWidgetItem from secop.gui.cfg_editor.tree_widget_item import TreeWidgetItem
from secop.gui.cfg_editor.utils import get_file_paths, get_modules, \ from secop.gui.cfg_editor.utils import get_all_items, \
get_interfaces, loadUi, set_name_edit_style, get_module_class_from_name, \ get_file_paths, get_interface_class_from_name, get_interfaces, \
get_all_items, get_interface_class_from_name, get_params, get_props, \ get_module_class_from_name, get_modules, get_params, \
setActionIcon get_props, loadUi, set_name_edit_style, setActionIcon
from secop.gui.qt import QWidget, QDialog, QLabel, QTabBar, Qt, QPoint, QMenu, \ from secop.gui.qt import QComboBox, QDialog, QDialogButtonBox, QLabel, \
QTreeWidget, QSize, pyqtSignal, QLineEdit, QComboBox, QDialogButtonBox, \ QLineEdit, QMenu, QPoint, QSize, QStandardItem, QStandardItemModel, \
QTextEdit, QTreeView, QStandardItemModel, QStandardItem Qt, QTabBar, QTextEdit, QTreeView, QTreeWidget, QWidget, pyqtSignal
NODE = 'node' NODE = 'node'
MODULE = 'module' MODULE = 'module'

View File

@ -26,9 +26,9 @@ import secop.client
from secop.gui.modulectrl import ModuleCtrl from secop.gui.modulectrl import ModuleCtrl
from secop.gui.nodectrl import NodeCtrl from secop.gui.nodectrl import NodeCtrl
from secop.gui.paramview import ParameterView from secop.gui.paramview import ParameterView
from secop.gui.qt import QInputDialog, QMainWindow, QMessageBox, \ from secop.gui.qt import QBrush, QColor, QInputDialog, QMainWindow, \
QObject, QTreeWidgetItem, pyqtSignal, pyqtSlot, QBrush, QColor QMessageBox, QObject, QTreeWidgetItem, pyqtSignal, pyqtSlot
from secop.gui.util import loadUi, Value from secop.gui.util import Value, loadUi
from secop.lib import formatExtendedTraceback from secop.lib import formatExtendedTraceback
ITEM_TYPE_NODE = QTreeWidgetItem.UserType + 1 ITEM_TYPE_NODE = QTreeWidgetItem.UserType + 1

View File

@ -25,14 +25,15 @@
import json import json
import pprint import pprint
from time import sleep from time import sleep
import mlzlog import mlzlog
import secop.lib
from secop.datatypes import EnumType, StringType from secop.datatypes import EnumType, StringType
from secop.errors import SECoPError from secop.errors import SECoPError
from secop.gui.qt import QFont, QFontMetrics, QLabel, \ from secop.gui.qt import QFont, QFontMetrics, QLabel, \
QMessageBox, QTextCursor, QWidget, pyqtSlot, toHtmlEscaped QMessageBox, QTextCursor, QWidget, pyqtSlot, toHtmlEscaped
from secop.gui.util import loadUi, Value from secop.gui.util import Value, loadUi
import secop.lib
class NodeCtrl(QWidget): class NodeCtrl(QWidget):

View File

@ -23,9 +23,9 @@
from secop.datatypes import EnumType, FloatRange, IntRange from secop.datatypes import EnumType, FloatRange, IntRange
from secop.gui.qt import QCheckBox, QLabel, QLineEdit, QMessageBox
from secop.gui.qt import QPushButton as QButton from secop.gui.qt import QPushButton as QButton
from secop.gui.qt import QCheckBox, QLabel, QLineEdit, \ from secop.gui.qt import QSizePolicy, Qt, QWidget, pyqtSignal, pyqtSlot
QMessageBox, QSizePolicy, Qt, QWidget, pyqtSignal, pyqtSlot
from secop.gui.util import loadUi from secop.gui.util import loadUi
from secop.lib import formatExtendedStack from secop.lib import formatExtendedStack

View File

@ -23,10 +23,10 @@
from secop.datatypes import ArrayOf, BLOBType, BoolType, EnumType, \ from secop.datatypes import ArrayOf, BLOBType, BoolType, EnumType, \
FloatRange, IntRange, StringType, StructOf, TupleOf, TextType FloatRange, IntRange, StringType, StructOf, TextType, TupleOf
from secop.gui.qt import QCheckBox, QComboBox, QDialog, QDoubleSpinBox, \ from secop.gui.qt import QCheckBox, QComboBox, QDialog, \
QFrame, QGridLayout, QGroupBox, QLabel, QLineEdit, QSpinBox, QVBoxLayout, \ QDoubleSpinBox, QFrame, QGridLayout, QGroupBox, \
QTextEdit QLabel, QLineEdit, QSpinBox, QTextEdit, QVBoxLayout
from secop.gui.util import loadUi from secop.gui.util import loadUi
# XXX: implement live validators !!!! # XXX: implement live validators !!!!

View File

@ -54,8 +54,8 @@ method has to be called explicitly int the write_<parameter> method, if needed.
""" """
import re import re
from secop.modules import Done
from secop.errors import ProgrammingError from secop.errors import ProgrammingError
from secop.modules import Done
class CmdParser: class CmdParser:

View File

@ -21,13 +21,13 @@
# ***************************************************************************** # *****************************************************************************
"""Define helpers""" """Define helpers"""
import importlib
import linecache import linecache
import socket import socket
import sys import sys
import threading import threading
import traceback import traceback
import importlib from os import environ, path
from os import path, environ
repodir = path.abspath(path.join(path.dirname(__file__), '..', '..')) repodir = path.abspath(path.join(path.dirname(__file__), '..', '..'))

View File

@ -28,16 +28,18 @@ support for asynchronous communication, but may be used also for
synchronous IO (see secop.stringio.StringIO) synchronous IO (see secop.stringio.StringIO)
""" """
import socket
import select
import time
import ast import ast
import select
import socket
import time
from secop.errors import CommunicationFailedError, ConfigError
from secop.lib import closeSocket, parseHostPort, tcpSocket
try: try:
from serial import Serial from serial import Serial
except ImportError: except ImportError:
Serial = None Serial = None
from secop.lib import parseHostPort, tcpSocket, closeSocket
from secop.errors import ConfigError, CommunicationFailedError
class ConnectionClosed(ConnectionError): class ConnectionClosed(ConnectionError):

View File

@ -21,7 +21,8 @@
# ***************************************************************************** # *****************************************************************************
from textwrap import indent from textwrap import indent
from secop.modules import Module, HasProperties, Property, Parameter, Command
from secop.modules import Command, HasProperties, Module, Parameter, Property
def indent_description(p): def indent_description(p):

View File

@ -26,16 +26,15 @@
import sys import sys
import time import time
from secop.datatypes import EnumType, FloatRange, BoolType, IntRange, \ from secop.datatypes import ArrayOf, BoolType, EnumType, FloatRange, \
StringType, TupleOf, get_datatype, ArrayOf, TextType, StatusType IntRange, StatusType, StringType, TextType, TupleOf, get_datatype
from secop.errors import ConfigError, ProgrammingError, SECoPError, BadValueError,\ from secop.errors import BadValueError, ConfigError, InternalError, \
SilentError, InternalError, secop_error ProgrammingError, SECoPError, SilentError, secop_error
from secop.lib import formatException, formatExtendedStack, mkthread from secop.lib import formatException, formatExtendedStack, mkthread
from secop.lib.enum import Enum from secop.lib.enum import Enum
from secop.params import PREDEFINED_ACCESSIBLES, Command, Parameter, Accessible from secop.params import PREDEFINED_ACCESSIBLES, Accessible, Command, Parameter
from secop.poller import BasicPoller, Poller
from secop.properties import HasProperties, Property from secop.properties import HasProperties, Property
from secop.poller import Poller, BasicPoller
Done = object() #: a special return value for a read/write function indicating that the setter is triggered already Done = object() #: a special return value for a read/write function indicating that the setter is triggered already

View File

@ -25,12 +25,12 @@
import inspect import inspect
from secop.datatypes import CommandType, DataType, StringType, BoolType, EnumType, DataTypeType, ValueType, OrType, \ from secop.datatypes import BoolType, CommandType, DataType, \
NoneOr, TextType, IntRange, TupleOf, StructOf DataTypeType, EnumType, IntRange, NoneOr, OrType, \
from secop.errors import ProgrammingError, BadValueError StringType, StructOf, TextType, TupleOf, ValueType
from secop.errors import BadValueError, ProgrammingError
from secop.properties import HasProperties, Property from secop.properties import HasProperties, Property
UNSET = object() # an argument not given, not even None UNSET = object() # an argument not given, not even None

View File

@ -34,10 +34,11 @@ Usage examples:
""" """
import time import time
from threading import Event
from heapq import heapify, heapreplace from heapq import heapify, heapreplace
from secop.lib import mkthread from threading import Event
from secop.errors import ProgrammingError from secop.errors import ProgrammingError
from secop.lib import mkthread
# poll types: # poll types:
AUTO = 1 #: equivalent to True, converted to REGULAR, SLOW or DYNAMIC AUTO = 1 #: equivalent to True, converted to REGULAR, SLOW or DYNAMIC

View File

@ -23,10 +23,10 @@
"""Define validated data types.""" """Define validated data types."""
import sys
import inspect import inspect
import sys
from secop.errors import ConfigError, ProgrammingError, BadValueError from secop.errors import BadValueError, ConfigError, ProgrammingError
class HasDescriptorMeta(type): class HasDescriptorMeta(type):

View File

@ -21,12 +21,12 @@
# ***************************************************************************** # *****************************************************************************
"""provides tcp interface to the SECoP Server""" """provides tcp interface to the SECoP Server"""
import sys
import socket import socket
import socketserver import socketserver
import sys
import threading import threading
from secop.datatypes import StringType, BoolType from secop.datatypes import BoolType, StringType
from secop.errors import SECoPError from secop.errors import SECoPError
from secop.lib import formatException, \ from secop.lib import formatException, \
formatExtendedStack, formatExtendedTraceback formatExtendedStack, formatExtendedTraceback
@ -35,7 +35,6 @@ from secop.protocol.interface import decode_msg, encode_msg_frame, get_msg
from secop.protocol.messages import ERRORPREFIX, \ from secop.protocol.messages import ERRORPREFIX, \
HELPREPLY, HELPREQUEST, HelpMessage HELPREPLY, HELPREQUEST, HelpMessage
DEF_PORT = 10767 DEF_PORT = 10767
MESSAGE_READ_SIZE = 1024 MESSAGE_READ_SIZE = 1024
HELP = HELPREQUEST.encode() HELP = HELPREQUEST.encode()

View File

@ -34,12 +34,12 @@ simplifications:
import time import time
import secop.protocol.dispatcher
import secop.errors
from secop.protocol.messages import DESCRIPTIONREPLY, ENABLEEVENTSREPLY, ERRORPREFIX, EVENTREPLY,\
READREQUEST, WRITEREQUEST, COMMANDREQUEST
import secop.client import secop.client
import secop.errors
import secop.protocol.dispatcher
from secop.lib.multievent import MultiEvent from secop.lib.multievent import MultiEvent
from secop.protocol.messages import COMMANDREQUEST, DESCRIPTIONREPLY, \
ENABLEEVENTSREPLY, ERRORPREFIX, EVENTREPLY, READREQUEST, WRITEREQUEST
class SecopClient(secop.client.SecopClient): class SecopClient(secop.client.SecopClient):

View File

@ -21,14 +21,15 @@
# ***************************************************************************** # *****************************************************************************
"""SECoP proxy modules""" """SECoP proxy modules"""
from secop.params import Parameter, Command from secop.client import SecopClient, decode_msg, encode_msg_frame
from secop.modules import Module, Writable, Readable, Drivable
from secop.datatypes import StringType from secop.datatypes import StringType
from secop.errors import BadValueError, \
CommunicationFailedError, ConfigError, make_secop_error
from secop.lib import get_class
from secop.modules import Drivable, Module, Readable, Writable
from secop.params import Command, Parameter
from secop.properties import Property from secop.properties import Property
from secop.stringio import HasIodev from secop.stringio import HasIodev
from secop.lib import get_class
from secop.client import SecopClient, decode_msg, encode_msg_frame
from secop.errors import ConfigError, make_secop_error, CommunicationFailedError, BadValueError
class ProxyModule(HasIodev, Module): class ProxyModule(HasIodev, Module):

View File

@ -23,12 +23,17 @@
# ***************************************************************************** # *****************************************************************************
"""Define helpers""" """Define helpers"""
import os
import ast import ast
import time
import threading
import configparser import configparser
import os
import threading
import time
from collections import OrderedDict from collections import OrderedDict
from secop.errors import ConfigError
from secop.lib import formatException, get_class, getGeneralConfig
from secop.modules import Attached
try: try:
from daemon import DaemonContext from daemon import DaemonContext
try: try:
@ -38,9 +43,6 @@ try:
except ImportError: except ImportError:
DaemonContext = None DaemonContext = None
from secop.errors import ConfigError
from secop.lib import formatException, get_class, getGeneralConfig
from secop.modules import Attached
try: try:
import systemd.daemon import systemd.daemon

View File

@ -29,7 +29,8 @@ from time import sleep
from secop.datatypes import FloatRange from secop.datatypes import FloatRange
from secop.lib import mkthread from secop.lib import mkthread
from secop.modules import Drivable, Module, Parameter, Readable, Writable, BasicPoller from secop.modules import BasicPoller, Drivable, \
Module, Parameter, Readable, Writable
class SimBase: class SimBase:

View File

@ -23,13 +23,17 @@
implements TCP/IP and is be used as a base for SerialIO implements TCP/IP and is be used as a base for SerialIO
""" """
import time
import threading
import re import re
import threading
import time
from secop.datatypes import ArrayOf, BoolType, \
FloatRange, StringType, TupleOf, ValueType
from secop.errors import CommunicationFailedError, \
CommunicationSilentError, ConfigError
from secop.lib.asynconn import AsynConn, ConnectionClosed from secop.lib.asynconn import AsynConn, ConnectionClosed
from secop.modules import Module, Communicator, Parameter, Command, Property, Attached, Done from secop.modules import Attached, Command, \
from secop.datatypes import StringType, FloatRange, ArrayOf, BoolType, TupleOf, ValueType Communicator, Done, Module, Parameter, Property
from secop.errors import CommunicationFailedError, CommunicationSilentError, ConfigError
from secop.poller import REGULAR from secop.poller import REGULAR

View File

@ -25,10 +25,9 @@ import random
import time import time
from math import atan from math import atan
from secop.datatypes import EnumType, FloatRange, TupleOf, StringType, BoolType from secop.datatypes import BoolType, EnumType, FloatRange, StringType, TupleOf
from secop.lib import clamp, mkthread from secop.lib import clamp, mkthread
from secop.modules import Drivable, Parameter, Command from secop.modules import Command, Drivable, Parameter
# test custom property (value.test can be changed in config file) # test custom property (value.test can be changed in config file)
from secop.properties import Property from secop.properties import Property

View File

@ -28,7 +28,9 @@ import time
from secop.datatypes import ArrayOf, BoolType, EnumType, \ from secop.datatypes import ArrayOf, BoolType, EnumType, \
FloatRange, IntRange, StringType, StructOf, TupleOf FloatRange, IntRange, StringType, StructOf, TupleOf
from secop.lib.enum import Enum from secop.lib.enum import Enum
from secop.modules import Drivable, Parameter as SECoP_Parameter, Readable from secop.modules import Drivable
from secop.modules import Parameter as SECoP_Parameter
from secop.modules import Readable
from secop.properties import Property from secop.properties import Property

View File

@ -31,7 +31,7 @@ import math
from secop.datatypes import ArrayOf, FloatRange, StringType, StructOf, TupleOf from secop.datatypes import ArrayOf, FloatRange, StringType, StructOf, TupleOf
from secop.errors import ConfigError, DisabledError from secop.errors import ConfigError, DisabledError
from secop.lib.sequence import SequencerMixin, Step from secop.lib.sequence import SequencerMixin, Step
from secop.modules import Drivable, Parameter, BasicPoller from secop.modules import BasicPoller, Drivable, Parameter
class GarfieldMagnet(SequencerMixin, Drivable): class GarfieldMagnet(SequencerMixin, Drivable):

View File

@ -30,18 +30,17 @@ MLZ TANGO interface for the respective device classes.
import re import re
import threading import threading
from time import time as currenttime
from time import sleep from time import sleep
from time import time as currenttime
import PyTango import PyTango
from secop.datatypes import ArrayOf, EnumType, FloatRange, \
from secop.datatypes import ArrayOf, EnumType, \ IntRange, LimitsType, StringType, TupleOf
FloatRange, IntRange, StringType, TupleOf, LimitsType
from secop.errors import CommunicationFailedError, \ from secop.errors import CommunicationFailedError, \
ConfigError, HardwareError, ProgrammingError ConfigError, HardwareError, ProgrammingError
from secop.lib import lazy_property from secop.lib import lazy_property
from secop.modules import Command, Drivable, \ from secop.modules import BasicPoller, Command, \
Module, Parameter, Readable, BasicPoller Drivable, Module, Parameter, Readable
##### #####

View File

@ -20,7 +20,7 @@
# ***************************************************************************** # *****************************************************************************
"""Andeen Hagerling capacitance bridge""" """Andeen Hagerling capacitance bridge"""
from secop.core import Readable, Parameter, FloatRange, HasIodev, StringIO, Done from secop.core import Done, FloatRange, HasIodev, Parameter, Readable, StringIO
class Ah2700IO(StringIO): class Ah2700IO(StringIO):

View File

@ -22,7 +22,8 @@
"""drivers for CCU4, the cryostat control unit at SINQ""" """drivers for CCU4, the cryostat control unit at SINQ"""
# the most common Frappy classes can be imported from secop.core # the most common Frappy classes can be imported from secop.core
from secop.core import Readable, Parameter, FloatRange, EnumType, StringIO, HasIodev from secop.core import EnumType, FloatRange, \
HasIodev, Parameter, Readable, StringIO
class CCU4IO(StringIO): class CCU4IO(StringIO):

View File

@ -22,8 +22,8 @@
not tested yet""" not tested yet"""
from secop.core import Writable, Module, Parameter, Attached,\ from secop.core import Attached, BoolType, EnumType, FloatRange, \
BoolType, FloatRange, EnumType, HasIodev, StringIO HasIodev, Module, Parameter, StringIO, Writable
class K2601bIO(StringIO): class K2601bIO(StringIO):

View File

@ -22,12 +22,13 @@
import time import time
from secop.modules import Readable, Drivable, Parameter, Property, Attached, Done
from secop.datatypes import FloatRange, IntRange, EnumType, BoolType
from secop.stringio import HasIodev
from secop.poller import Poller, REGULAR
from secop.lib import formatStatusBits
import secop.iohandler import secop.iohandler
from secop.datatypes import BoolType, EnumType, FloatRange, IntRange
from secop.lib import formatStatusBits
from secop.modules import Attached, Done, \
Drivable, Parameter, Property, Readable
from secop.poller import REGULAR, Poller
from secop.stringio import HasIodev
Status = Drivable.Status Status = Drivable.Status

View File

@ -22,6 +22,7 @@
from secop.modules import Communicator from secop.modules import Communicator
class Ls370Sim(Communicator): class Ls370Sim(Communicator):
CHANNEL_COMMANDS = [ CHANNEL_COMMANDS = [
('RDGR?%d', '1.0'), ('RDGR?%d', '1.0'),

View File

@ -31,18 +31,18 @@ Polling of value and status is done commonly for all modules. For each registere
<module>.update_value_status() is called in order to update their value and status. <module>.update_value_status() is called in order to update their value and status.
""" """
import time
import threading import threading
import time
from secop.modules import Readable, Drivable, Parameter,\
Communicator, Property, Attached, HasAccessibles, Done
from secop.datatypes import EnumType, FloatRange, IntRange, StringType,\
BoolType, StatusType
from secop.lib.enum import Enum
from secop.lib import clamp
from secop.errors import HardwareError
from secop.poller import Poller
import secop.iohandler import secop.iohandler
from secop.datatypes import BoolType, EnumType, \
FloatRange, IntRange, StatusType, StringType
from secop.errors import HardwareError
from secop.lib import clamp
from secop.lib.enum import Enum
from secop.modules import Attached, Communicator, Done, \
Drivable, HasAccessibles, Parameter, Property, Readable
from secop.poller import Poller
from secop.stringio import HasIodev from secop.stringio import HasIodev
try: try:

View File

@ -18,9 +18,10 @@
# Module authors: # Module authors:
# Markus Zolliker <markus.zolliker@psi.ch> # Markus Zolliker <markus.zolliker@psi.ch>
# ***************************************************************************** # *****************************************************************************
import time
import json import json
import math import math
import time
def num(string): def num(string):
return json.loads(string) return json.loads(string)

View File

@ -20,13 +20,14 @@
# ***************************************************************************** # *****************************************************************************
"""Software calibration""" """Software calibration"""
import os
from os.path import join, exists, basename
import math import math
import numpy as np import os
from scipy.interpolate import splrep, splev # pylint: disable=import-error from os.path import basename, exists, join
from secop.core import Readable, Parameter, Attached, StringType, BoolType import numpy as np
from scipy.interpolate import splev, splrep # pylint: disable=import-error
from secop.core import Attached, BoolType, Parameter, Readable, StringType
def linear(x): def linear(x):

View File

@ -24,10 +24,11 @@
# no fixtures needed # no fixtures needed
import pytest import pytest
from secop.basic_validators import FloatProperty, PositiveFloatProperty, \ from secop.basic_validators import BoolProperty, EnumProperty, FloatProperty, \
NonNegativeFloatProperty, IntProperty, PositiveIntProperty, \ FmtStrProperty, IntProperty, NoneOr, NonNegativeFloatProperty, \
NonNegativeIntProperty, BoolProperty, StringProperty, UnitProperty, \ NonNegativeIntProperty, OneOfProperty, PositiveFloatProperty, \
FmtStrProperty, OneOfProperty, NoneOr, EnumProperty, TupleProperty PositiveIntProperty, StringProperty, TupleProperty, UnitProperty
class unprintable: class unprintable:
def __str__(self): def __str__(self):

View File

@ -25,9 +25,10 @@
# no fixtures needed # no fixtures needed
import pytest import pytest
from secop.datatypes import ArrayOf, BLOBType, BoolType, Enum, StatusType, \ from secop.datatypes import ArrayOf, BLOBType, BoolType, \
DataType, EnumType, FloatRange, IntRange, ProgrammingError, ConfigError, \ CommandType, ConfigError, DataType, Enum, EnumType, FloatRange, \
ScaledInteger, StringType, TextType, StructOf, TupleOf, get_datatype, CommandType IntRange, ProgrammingError, ScaledInteger, StatusType, \
StringType, StructOf, TextType, TupleOf, get_datatype
def copytest(dt): def copytest(dt):

View File

@ -23,10 +23,11 @@
import pytest import pytest
from secop.datatypes import FloatRange, IntRange, Property, StringType
from secop.errors import ProgrammingError
from secop.iohandler import CmdParser, IOHandler from secop.iohandler import CmdParser, IOHandler
from secop.modules import Module, Parameter from secop.modules import Module, Parameter
from secop.datatypes import FloatRange, StringType, IntRange, Property
from secop.errors import ProgrammingError
@pytest.mark.parametrize('fmt, text, values, text2', [ @pytest.mark.parametrize('fmt, text, values, text2', [
('%d,%d', '2,3', [2,3], None), ('%d,%d', '2,3', [2,3], None),

View File

@ -23,13 +23,14 @@
"""test data types.""" """test data types."""
import threading import threading
import pytest import pytest
from secop.datatypes import BoolType, FloatRange, StringType from secop.datatypes import BoolType, FloatRange, StringType
from secop.errors import ProgrammingError
from secop.modules import Communicator, Drivable, Module from secop.modules import Communicator, Drivable, Module
from secop.params import Command, Parameter from secop.params import Command, Parameter
from secop.poller import BasicPoller from secop.poller import BasicPoller
from secop.errors import ProgrammingError
class DispatcherStub: class DispatcherStub:

View File

@ -23,8 +23,8 @@
import pytest import pytest
from secop.protocol.interface import encode_msg_frame, decode_msg
import secop.protocol.messages as m import secop.protocol.messages as m
from secop.protocol.interface import decode_msg, encode_msg_frame
# args are: msg tuple, msg bytes # args are: msg tuple, msg bytes
MSG = [ MSG = [

View File

@ -25,10 +25,10 @@
# no fixtures needed # no fixtures needed
import pytest import pytest
from secop.datatypes import BoolType, IntRange, FloatRange from secop.datatypes import BoolType, FloatRange, IntRange
from secop.params import Command, Parameter
from secop.modules import HasAccessibles
from secop.errors import ProgrammingError from secop.errors import ProgrammingError
from secop.modules import HasAccessibles
from secop.params import Command, Parameter
def test_Command(): def test_Command():

View File

@ -22,8 +22,8 @@
"""test data types.""" """test data types."""
from collections import OrderedDict
from ast import literal_eval from ast import literal_eval
from collections import OrderedDict
import pytest import pytest

View File

@ -23,9 +23,12 @@
import time import time
from collections import OrderedDict from collections import OrderedDict
import pytest import pytest
from secop.modules import Drivable from secop.modules import Drivable
from secop.poller import Poller, REGULAR, DYNAMIC, SLOW from secop.poller import DYNAMIC, REGULAR, SLOW, Poller
Status = Drivable.Status Status = Drivable.Status
class Time: class Time:

View File

@ -23,9 +23,9 @@
import pytest import pytest
from secop.datatypes import IntRange, StringType, FloatRange, ValueType from secop.datatypes import FloatRange, IntRange, StringType, ValueType
from secop.errors import ProgrammingError, ConfigError, BadValueError from secop.errors import BadValueError, ConfigError, ProgrammingError
from secop.properties import Property, HasProperties from secop.properties import HasProperties, Property
def Prop(*args, name=None, **kwds): def Prop(*args, name=None, **kwds):