<s> """<STR_LIT>""" <EOL> import os <EOL> import glob <EOL> import diamond . collector <EOL> class KSMCollector ( diamond . collector . Collector ) : <EOL> def get_default_config_help ( self ) : <EOL> config_help = super ( KSMCollector , self ) . get_default_config_help ( ) <EOL> config_help . update ( { <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> } ) <EOL> return config_help <EOL> def get_default_config ( self ) : <EOL> """<STR_LIT>""" <EOL> config = super ( KSMCollector , self ) . get_default_config ( ) <EOL> config . update ( { <EOL> '<STR_LIT:path>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> return config <EOL> def collect ( self ) : <EOL> for item in glob . glob ( os . path . join ( self . config [ '<STR_LIT>' ] , "<STR_LIT:*>" ) ) : <EOL> if os . access ( item , os . R_OK ) : <EOL> filehandle = open ( item ) <EOL> try : <EOL> self . publish ( os . path . basename ( item ) , <EOL> float ( filehandle . readline ( ) . rstrip ( ) ) ) <EOL> except ValueError : <EOL> pass <EOL> filehandle . close ( ) </s>
