# Path: concert/coroutines/base.py
# def background(coroutine):
#     """Same as :func:`.start`, just meant to be used as a decorator."""
#     @functools.wraps(coroutine)
#     def inner(*args, **kwargs):
#         return start(coroutine(*args, **kwargs))
# 
#     return inner
# 
# Path: concert/devices/base.py
# class Device(Parameterizable):
# 
#     """
#     A :class:`.Device` provides locked access to a real-world device.
# 
#     It implements the context protocol to provide locking::
# 
#         async with device:
#             # device is locked
#             await device.set_parameter(1 * q.m)
#             ...
# 
#         # device is unlocked again
#     """
# 
#     def __init__(self):
#         # We have to create the lock early on because it will be accessed in
#         # any add_parameter calls, especially those in the Parameterizable base
#         # class
#         self._lock = asyncio.Lock()
#         super(Device, self).__init__()
# 
#     async def __aenter__(self):
#         await self._lock.acquire()
# 
#         return self
# 
#     async def __aexit__(self, exc_type, exc, tb):
#         self._lock.release()
# 
#     @background
#     async def emergency_stop(self):
#         """Emergency stop."""
#         await self._emergency_stop()
# 
#     async def _emergency_stop(self):
#         """Emergency stop implementation."""
#         pass
# 
# Path: concert/base.py
# class Quantity(Parameter):
# 
#     """A :class:`.Parameter` associated with a unit."""
# 
#     def __init__(self, unit, fget=None, fset=None, fget_target=None, lower=None, upper=None,
#                  data=None, check=None, external_lower_getter=None, external_upper_getter=None,
#                  user_lower_getter=None, user_lower_setter=None, user_upper_getter=None,
#                  user_upper_setter=None, help=None):
#         """
#         *fget*, *fset*, *data*, *check* and *help* are identical to the
#         :class:`.Parameter` constructor arguments.
# 
#         *unit* is a Pint quantity. *lower* and *upper* denote soft limits
#         between the :class:`.Quantity` values can lie.
#         """
#         super(Quantity, self).__init__(fget=fget, fset=fset, fget_target=fget_target, data=data,
#                                        check=check, help=help)
#         self.unit = unit
# 
#         self.upper = upper
#         self.lower = lower
#         self.external_lower_getter = external_lower_getter
#         self.external_upper_getter = external_upper_getter
#         self.user_lower_getter = user_lower_getter
#         self.user_lower_setter = user_lower_setter
#         self.user_upper_getter = user_upper_getter
#         self.user_upper_setter = user_upper_setter
# 
#     def convert(self, value):
#         return value.to(self.unit)
# 
# class AccessorNotImplementedError(NotImplementedError):
# 
#     """Raised when a setter or getter is not implemented."""
# 
# Path: concert/quantities.py



from concert.coroutines.base import background
from concert.devices.base import Device
from concert.base import Quantity, AccessorNotImplementedError
from concert.quantities import q

class Scales(Device):

    """Base scales class."""
    weight = Quantity(q.g, help="Weighted mass")

    def __init__(self):
        super(Scales, self).__init__()

    async def _get_weight(self):
        raise AccessorNotImplementedError


class TarableScales(Scales):

    """Scales which can be tared."""

    def __init__(self):
        super(TarableScales, self).__init__()

    @background
    async def tare(self):
        """
        tare()

        Tare the scales.
        """
        await self._tare()

    async def _tare(self):

# Path: concert/coroutines/base.py
# def background(coroutine):
#     """Same as :func:`.start`, just meant to be used as a decorator."""
#     @functools.wraps(coroutine)
#     def inner(*args, **kwargs):
#         return start(coroutine(*args, **kwargs))
# 
#     return inner
# 
# Path: concert/devices/base.py
# class Device(Parameterizable):
# 
#     """
#     A :class:`.Device` provides locked access to a real-world device.
# 
#     It implements the context protocol to provide locking::
# 
#         async with device:
#             # device is locked
#             await device.set_parameter(1 * q.m)
#             ...
# 
#         # device is unlocked again
#     """
# 
#     def __init__(self):
#         # We have to create the lock early on because it will be accessed in
#         # any add_parameter calls, especially those in the Parameterizable base
#         # class
#         self._lock = asyncio.Lock()
#         super(Device, self).__init__()
# 
#     async def __aenter__(self):
#         await self._lock.acquire()
# 
#         return self
# 
#     async def __aexit__(self, exc_type, exc, tb):
#         self._lock.release()
# 
#     @background
#     async def emergency_stop(self):
#         """Emergency stop."""
#         await self._emergency_stop()
# 
#     async def _emergency_stop(self):
#         """Emergency stop implementation."""
#         pass
# 
# Path: concert/base.py
# class Quantity(Parameter):
# 
#     """A :class:`.Parameter` associated with a unit."""
# 
#     def __init__(self, unit, fget=None, fset=None, fget_target=None, lower=None, upper=None,
#                  data=None, check=None, external_lower_getter=None, external_upper_getter=None,
#                  user_lower_getter=None, user_lower_setter=None, user_upper_getter=None,
#                  user_upper_setter=None, help=None):
#         """
#         *fget*, *fset*, *data*, *check* and *help* are identical to the
#         :class:`.Parameter` constructor arguments.
# 
#         *unit* is a Pint quantity. *lower* and *upper* denote soft limits
#         between the :class:`.Quantity` values can lie.
#         """
#         super(Quantity, self).__init__(fget=fget, fset=fset, fget_target=fget_target, data=data,
#                                        check=check, help=help)
#         self.unit = unit
# 
#         self.upper = upper
#         self.lower = lower
#         self.external_lower_getter = external_lower_getter
#         self.external_upper_getter = external_upper_getter
#         self.user_lower_getter = user_lower_getter
#         self.user_lower_setter = user_lower_setter
#         self.user_upper_getter = user_upper_getter
#         self.user_upper_setter = user_upper_setter
# 
#     def convert(self, value):
#         return value.to(self.unit)
# 
# class AccessorNotImplementedError(NotImplementedError):
# 
#     """Raised when a setter or getter is not implemented."""
# 
# Path: concert/quantities.py



# Path: concert/devices/scales/base.py
from concert.coroutines.base import background
from concert.devices.base import Device
from concert.base import Quantity, AccessorNotImplementedError
from concert.quantities import q


class Scales(Device):

    """Base scales class."""
    weight = Quantity(q.g, help="Weighted mass")

    def __init__(self):
        super(Scales, self).__init__()

    async def _get_weight(self):
        raise AccessorNotImplementedError


class TarableScales(Scales):

    """Scales which can be tared."""

    def __init__(self):
        super(TarableScales, self).__init__()

    @background
    async def tare(self):
        """
        tare()

        Tare the scales.
        """
        await self._tare()

    async def _tare(self):

        raise AccessorNotImplementedError