Exemple #1
0
_log = logging.getLogger(__name__)

# hijack cothread
assert 'cothread' not in sys.modules

CM = ModuleType('cothread')
sys.modules['cothread'] = CM

CM.Event = object

CA = ModuleType('cothread.catools')
sys.modules['cothread.catools'] = CA

_PVs = {}

CA.FORMAT_TIME = 1
CA.DBR_CHAR_STR = 2


def caget(name, timeout=None):
    return _PVs[name]


CA.caget = caget
del caget


def caput(name, value, wait=False, timeout=None):
    assert name in _PVs, name
    _PVs[name] = value