<s> import os <EOL> import re <EOL> import subprocess <EOL> from ajenti . api import * <EOL> from ajenti . api . sensors import Sensor <EOL> @ plugin <EOL> class DiskTemperatureSensor ( Sensor ) : <EOL> id = '<STR_LIT>' <EOL> timeout = <NUM_LIT:5> <EOL> def get_variants ( self ) : <EOL> r = [ ] <EOL> for s in os . listdir ( '<STR_LIT>' ) : <EOL> if re . match ( '<STR_LIT>' , s ) : <EOL> r . append ( s ) <EOL> return sorted ( r ) <EOL> def measure ( self , device ) : <EOL> try : <EOL> v = float ( '<STR_LIT:0>' + subprocess . check_output ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' % device , '<STR_LIT>' , '<STR_LIT>' ] , stderr = None ) . strip ( ) ) <EOL> return v <EOL> except : <EOL> return <NUM_LIT:0> </s>
