# Path: concert/base.py
# def transition(immediate=None, target=None):
#     """Change software state of a device to *immediate*. After the function execution finishes
#     change the state to *target*. On :py:class:`.asyncio.CancelledError`, state is set to *target*
#     and cleanup logic must take place in the callable to be wrapped.
#     """
#     def wrapped(func):
#         @functools.wraps(func)
#         async def call_func(instance, *args, **kwargs):
#             if 'state' not in instance:
#                 raise FSMError('Changing state requires state parameter')
# 
#             # Store the original in case target is None
#             target_state = target if target else await instance['state'].get()
# 
#             if immediate:
#                 setattr(instance, '_state_value', immediate)
# 
#             try:
#                 result = await _execute_func(func, instance, *args, **kwargs)
#                 setattr(instance, '_state_value', target_state)
#             except StateError as error:
#                 setattr(instance, '_state_value', error.state)
#                 raise error
#             except asyncio.CancelledError:
#                 # If *func* is cancelled, *func* must make sure that all cleanup except state update
#                 # happens. If even the state should have some special value, then do not use
#                 # *transition* at all and implement everything in *func*.
#                 setattr(instance, '_state_value', target_state)
#                 raise
# 
#             return result
# 
#         return call_func
# 
#     return wrapped
# 
# Path: concert/devices/xraytubes/base.py
# class XRayTube(Device):
#     def __init__(self):
#     async def _get_state(self):
#     async def _get_voltage(self):
#     async def _set_voltage(self, voltage):
#     async def _get_current(self):
#     async def _set_current(self, current):
#     async def _get_power(self):
#     async def on(self):
#     async def off(self):
#     async def _on(self):
#     async def _off(self):
# 
# Path: concert/quantities.py



from concert.base import transition
from concert.devices.xraytubes import base
from concert.quantities import q
"""A dummy X-ray tube."""



class XRayTube(base.XRayTube):

    """A dummy X-ray tube implementation."""

    def __init__(self):
        super(XRayTube, self).__init__()
        self._voltage = 0 * q.V
        self._current = 0 * q.A

    @transition(target='on')
    async def _on(self):
        pass


# Path: concert/base.py
# def transition(immediate=None, target=None):
#     """Change software state of a device to *immediate*. After the function execution finishes
#     change the state to *target*. On :py:class:`.asyncio.CancelledError`, state is set to *target*
#     and cleanup logic must take place in the callable to be wrapped.
#     """
#     def wrapped(func):
#         @functools.wraps(func)
#         async def call_func(instance, *args, **kwargs):
#             if 'state' not in instance:
#                 raise FSMError('Changing state requires state parameter')
# 
#             # Store the original in case target is None
#             target_state = target if target else await instance['state'].get()
# 
#             if immediate:
#                 setattr(instance, '_state_value', immediate)
# 
#             try:
#                 result = await _execute_func(func, instance, *args, **kwargs)
#                 setattr(instance, '_state_value', target_state)
#             except StateError as error:
#                 setattr(instance, '_state_value', error.state)
#                 raise error
#             except asyncio.CancelledError:
#                 # If *func* is cancelled, *func* must make sure that all cleanup except state update
#                 # happens. If even the state should have some special value, then do not use
#                 # *transition* at all and implement everything in *func*.
#                 setattr(instance, '_state_value', target_state)
#                 raise
# 
#             return result
# 
#         return call_func
# 
#     return wrapped
# 
# Path: concert/devices/xraytubes/base.py
# class XRayTube(Device):
#     def __init__(self):
#     async def _get_state(self):
#     async def _get_voltage(self):
#     async def _set_voltage(self, voltage):
#     async def _get_current(self):
#     async def _set_current(self, current):
#     async def _get_power(self):
#     async def on(self):
#     async def off(self):
#     async def _on(self):
#     async def _off(self):
# 
# Path: concert/quantities.py



# Path: concert/devices/xraytubes/dummy.py
from concert.base import transition
from concert.devices.xraytubes import base
from concert.quantities import q

"""A dummy X-ray tube."""



class XRayTube(base.XRayTube):

    """A dummy X-ray tube implementation."""

    def __init__(self):
        super(XRayTube, self).__init__()
        self._voltage = 0 * q.V
        self._current = 0 * q.A

    @transition(target='on')
    async def _on(self):
        pass


    @transition(target='off')