<s> import temperusb <EOL> from braubuddy . thermometer import DeviceError <EOL> from braubuddy . thermometer import ReadError <EOL> from braubuddy . thermometer import IThermometer <EOL> class TEMPerThermometer ( IThermometer ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> temper_devices = self . _get_temper_devices ( ) <EOL> if len ( temper_devices ) == <NUM_LIT:0> : <EOL> msg = '<STR_LIT>' <EOL> raise DeviceError ( msg ) <EOL> self . _temper_device = temper_devices [ <NUM_LIT:0> ] <EOL> def _get_temper_devices ( self ) : <EOL> """<STR_LIT>""" <EOL> th = temperusb . TemperHandler ( ) <EOL> temper_devices = th . get_devices ( ) <EOL> return temper_devices <EOL> def get_temperature ( self , units = '<STR_LIT>' ) : <EOL> try : <EOL> return self . _temper_device . get_temperature ( format = units ) <EOL> except Exception as err : <EOL> raise ReadError ( <EOL> '<STR_LIT>' . format ( err ) ) </s>
