示例#1
0
def FakePytmcSignal(prefix, *, io, **kwargs):
    norm = normalize_io(io)
    if norm == 'output':
        return FakeEpicsSignal(prefix, **kwargs)
    elif norm == 'input':
        return FakeEpicsSignalRO(prefix, **kwargs)
    else:
        # Give us the normal error message
        return PytmcSignal(prefix, io=io, **kwargs)
示例#2
0
def pytmc_writable(io):
    """Returns `True` if the pytmc io arg represents a writable PV."""
    norm = normalize_io(io)
    if norm == 'output':
        return True
    elif norm == 'input':
        return False
    else:
        # Should never get here unless pytmc's API changes
        raise ValueError(f'Invalid io specifier {io}')
示例#3
0
 def __new__(cls, prefix, io=None, **kwargs):
     if io is None:
         # Provide a better error here than "__new__ missing an arg"
         raise ValueError('Must provide an "io" argument to PytmcSignal. '
                          f'This is missing for signal with pv {prefix}. '
                          'Feel free to copy the io field from the '
                          'pytmc pragma.')
     norm = normalize_io(io)
     if norm == 'output':
         return super().__new__(PytmcSignalRW)
     elif norm == 'input':
         return super().__new__(PytmcSignalRO)
     else:
         # Should never get here unless pytmc's API changes
         raise ValueError(f'Invalid io specifier {io}')