<s> import datetime <EOL> from JsonStats . FetchStats import Fetcher <EOL> class RPM ( Fetcher ) : <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> self . context = '<STR_LIT>' <EOL> self . _load_data ( ) <EOL> def _load_data ( self ) : <EOL> self . _refresh_time = datetime . datetime . utcnow ( ) <EOL> self . _rpms = { } <EOL> cmd = '<STR_LIT>' <EOL> try : <EOL> for line in self . _exec ( cmd ) . split ( '<STR_LIT:\n>' ) [ : - <NUM_LIT:1> ] : <EOL> ( rpm_name , rpm_version ) = line . split ( ) <EOL> self . _rpms [ rpm_name ] = rpm_version <EOL> self . _loaded ( True ) <EOL> except Exception , e : <EOL> self . _loaded ( False , str ( e ) ) <EOL> def dump ( self ) : <EOL> if ( datetime . datetime . utcnow ( ) - <EOL> datetime . timedelta ( minutes = <NUM_LIT:1> ) ) > self . _refresh_time : <EOL> self . _load_data ( ) <EOL> return self . _rpms <EOL> def dump_json ( self ) : <EOL> return self . json . dumps ( self . dump ( ) ) </s>
