# Path: braubuddy/output/base.py
# class IOutput(object):
#     """
#     Interface for creating an output for use with :mod:`braubuddy`.
# 
#     :param units: Temperature units to output.
#     :type units: :class:`str`
#     """
# 
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, units='celsius'):
# 
#         self.set_units(units)
# 
#     def set_units(self, new_units):
#         """
#         Set units to output.
# 
#         :param units: Temperature units to output.
#         :type units: :class:`str`
#         """
# 
#         try:
#             self.units = utils.map_temp_units_to_symbol(new_units)
#         except:
#             raise OutputError('Unrecognised units: {0}'.format(new_units))
# 
#     @abc.abstractmethod
#     def publish_status(self, target, temp, heater_percent, cooler_percent):
#         """
#         Publish braubuddy status
# 
#         :param target: Target temperature.
#         :type target: :class:`float`
#         :param temp: Current temperature.
#         :type temp: :class:`float`
#         :param heater_percent: Current heater power level as percentage.
#         :type heater_percent: :class:`float`
#         :param cooler_percent: Current cooler power level as percentage.
#         :type coolerer_percent: :class:`float`
#         """
# 
# Path: braubuddy/output/base.py
# class OutputError(Exception):
#     """
#     Raised whenever an output fails
#     """


from datetime import datetime
from os.path import expanduser
from braubuddy.output import IOutput
from braubuddy.output import OutputError
        cooler_str = cooler_percent
        # Add units if required
        if self._show_units:
            target_str = '{0}{1}'.format(target_str, self.units)
            temp_str = '{0}{1}'.format(temp_str, self.units)
            heater_str = '{0}%'.format(heater_str)
            cooler_str = '{0}%'.format(cooler_str)
        # Add labels if required
        if self._show_labels:
            target_str = 'Target:{0}'.format(target_str)
            temp_str = 'Temperature:{0}'.format(temp_str)
            heater_str = 'Heater:{0}'.format(heater_str)
            cooler_str = 'Cooler:{0}'.format(cooler_str)
        # Generate output line
        line = '{1}{0}{2}{0}{3}{0}{4}\n'.format(
            self._separator,
            target_str,
            temp_str,
            heater_str,
            cooler_str
        )
        # Add timestamp if required
        if self._show_timestamp:
            timestamp = datetime.now().strftime(self._timestamp_format)
            line = '{0}{1}{2}'.format(timestamp, self._separator, line)
        try:
            fh = open(self._out_file, 'a+')
            fh.write(line)
            fh.close()
        except IOError, err:

# Path: braubuddy/output/base.py
# class IOutput(object):
#     """
#     Interface for creating an output for use with :mod:`braubuddy`.
# 
#     :param units: Temperature units to output.
#     :type units: :class:`str`
#     """
# 
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, units='celsius'):
# 
#         self.set_units(units)
# 
#     def set_units(self, new_units):
#         """
#         Set units to output.
# 
#         :param units: Temperature units to output.
#         :type units: :class:`str`
#         """
# 
#         try:
#             self.units = utils.map_temp_units_to_symbol(new_units)
#         except:
#             raise OutputError('Unrecognised units: {0}'.format(new_units))
# 
#     @abc.abstractmethod
#     def publish_status(self, target, temp, heater_percent, cooler_percent):
#         """
#         Publish braubuddy status
# 
#         :param target: Target temperature.
#         :type target: :class:`float`
#         :param temp: Current temperature.
#         :type temp: :class:`float`
#         :param heater_percent: Current heater power level as percentage.
#         :type heater_percent: :class:`float`
#         :param cooler_percent: Current cooler power level as percentage.
#         :type coolerer_percent: :class:`float`
#         """
# 
# Path: braubuddy/output/base.py
# class OutputError(Exception):
#     """
#     Raised whenever an output fails
#     """


# Path: braubuddy/output/textfile.py
from datetime import datetime
from os.path import expanduser
from braubuddy.output import IOutput
from braubuddy.output import OutputError

        cooler_str = cooler_percent
        # Add units if required
        if self._show_units:
            target_str = '{0}{1}'.format(target_str, self.units)
            temp_str = '{0}{1}'.format(temp_str, self.units)
            heater_str = '{0}%'.format(heater_str)
            cooler_str = '{0}%'.format(cooler_str)
        # Add labels if required
        if self._show_labels:
            target_str = 'Target:{0}'.format(target_str)
            temp_str = 'Temperature:{0}'.format(temp_str)
            heater_str = 'Heater:{0}'.format(heater_str)
            cooler_str = 'Cooler:{0}'.format(cooler_str)
        # Generate output line
        line = '{1}{0}{2}{0}{3}{0}{4}\n'.format(
            self._separator,
            target_str,
            temp_str,
            heater_str,
            cooler_str
        )
        # Add timestamp if required
        if self._show_timestamp:
            timestamp = datetime.now().strftime(self._timestamp_format)
            line = '{0}{1}{2}'.format(timestamp, self._separator, line)
        try:
            fh = open(self._out_file, 'a+')
            fh.write(line)
            fh.close()
        except IOError, err:

            raise OutputError(err)