Ejemplo n.º 1
0
def get_systems(engine=get_engine()):
    '''Returns all the :class:`~tng.device.abc_device.ABCDevice` that TNG pi
    has created.

    They are loosely ordered in that all targets come first, then all refs.
    '''
    return get_targets(engine) + get_refeps(engine)
Ejemplo n.º 2
0
def get_system(name, engine=get_engine()):
    '''Gets a TNG pi :class:`~tng.device.abc_device.ABCDevice` by setup file
    name, or raises :class:`KeyError` if not found.

    >>> get_system("vcs")
    <ABCDevice Oak 10.50.156.80>

    .. seealso:: :meth:`~tng.device.abc_device.ABCDevice.name`
    '''
    for system in get_systems(engine):
        if system.name == name:
            return system
    raise KeyError('No system with name %s found' % name)
Ejemplo n.º 3
0
def get_refeps(engine=get_engine()):
    '''Returns all the :class:`~tng.device.abc_device.ABCDevice` objects for
    which is_target() returns False.'''
    return [
        system for system in _get_systems(engine) if not system.is_target()
    ]
Ejemplo n.º 4
0
def _get_systems(engine=get_engine()):
    return list(engine.device_factory.devices)
Ejemplo n.º 5
0
 def decorator(cls):
     get_engine().device_factory.interface(name, version, cls)
     return cls