diff --git a/doc/source/reference.rst b/doc/source/reference.rst index d85b838d..0f4fc941 100644 --- a/doc/source/reference.rst +++ b/doc/source/reference.rst @@ -4,6 +4,8 @@ Reference Module Base Classes ................... +.. autodata:: secop.modules.Done + .. autoclass:: secop.modules.Module :members: earlyInit, initModule, startModule, pollerClass diff --git a/secop/lib/__init__.py b/secop/lib/__init__.py index c0c21c78..e942ff55 100644 --- a/secop/lib/__init__.py +++ b/secop/lib/__init__.py @@ -31,9 +31,6 @@ from configparser import ConfigParser from os import environ, path -unset_value = object() - - class GeneralConfig: def __init__(self): self._config = None @@ -319,3 +316,11 @@ def formatStatusBits(sword, labels, start=0): if sword & (1 << i) and lbl: result.append(lbl) return result + + +class UniqueObject: + def __init__(self, name): + self.name = name + + def __repr__(self): + return 'UniqueObject(%r)' % self.name diff --git a/secop/modules.py b/secop/modules.py index 1cdca29a..47934508 100644 --- a/secop/modules.py +++ b/secop/modules.py @@ -31,14 +31,17 @@ from secop.datatypes import ArrayOf, BoolType, EnumType, FloatRange, \ IntRange, StatusType, StringType, TextType, TupleOf from secop.errors import BadValueError, ConfigError, \ ProgrammingError, SECoPError, SilentError, secop_error -from secop.lib import formatException, mkthread +from secop.lib import formatException, mkthread, UniqueObject from secop.lib.enum import Enum from secop.params import Accessible, Command, Parameter from secop.poller import BasicPoller, Poller from secop.properties import HasProperties, Property from secop.logging import RemoteLogHandler, HasComlog -Done = object() #: a special return value for a read/write function indicating that the setter is triggered already +Done = UniqueObject('already set') +"""a special return value for a read/write function + +indicating that the setter is triggered already""" class HasAccessibles(HasProperties): diff --git a/secop/params.py b/secop/params.py index 9add5a83..f7c287ce 100644 --- a/secop/params.py +++ b/secop/params.py @@ -31,8 +31,6 @@ from secop.datatypes import BoolType, CommandType, DataType, \ from secop.errors import BadValueError, ProgrammingError from secop.properties import HasProperties, Property -UNSET = object() # an argument not given, not even None - class Accessible(HasProperties): """base class for Parameter and Command diff --git a/secop/properties.py b/secop/properties.py index 047c147a..74ba68ad 100644 --- a/secop/properties.py +++ b/secop/properties.py @@ -26,8 +26,11 @@ import inspect from secop.errors import BadValueError, ConfigError, ProgrammingError +from secop.lib import UniqueObject from secop.lib.py35compat import Object +UNSET = UniqueObject('undefined value') #: an unset value, not even None + class HasDescriptors(Object): @classmethod @@ -39,9 +42,6 @@ class HasDescriptors(Object): raise ProgrammingError('misplaced trailing comma after %s.%s' % (cls.__name__, '/'.join(bad))) -UNSET = object() # an unset value, not even None - - # storage for 'properties of a property' class Property: """base class holding info about a property