<s> '''<STR_LIT>''' <EOL> import imp , os <EOL> from collections import defaultdict <EOL> class Plugin : <EOL> def Get ( self , ModuleName , ModuleFile , ModulePath ) : <EOL> f , Filename , desc = imp . find_module ( ModuleFile . split ( '<STR_LIT:.>' ) [ <NUM_LIT:0> ] , [ ModulePath ] ) <EOL> return imp . load_module ( ModuleName , f , Filename , desc ) <EOL> def Run ( self , Name , Path , Params ) : <EOL> return self . Get ( "<STR_LIT>" , Name , Path + "<STR_LIT:/>" ) . Run ( Params ) <EOL> class Storage : <EOL> def __init__ ( self , FileName ) : <EOL> self . FileName = FileName <EOL> self . Init ( ) <EOL> self . Load ( ) <EOL> def Init ( self ) : <EOL> self . Content = "<STR_LIT>" <EOL> def Get ( self ) : <EOL> return self . Content <EOL> def Set ( self , Content ) : <EOL> self . Content = Content <EOL> def Load ( self ) : <EOL> if not os . path . isfile ( self . FileName ) : <EOL> self . Init ( ) <EOL> else : <EOL> self . Set ( File ( ) . GetAsList ( self . FileName ) [ <NUM_LIT:0> ] . strip ( ) ) <EOL> def Save ( self ) : <EOL> File ( ) . Save ( self . FileName , self . Content ) <EOL> class File : <EOL> def GetAsList ( self , FileName ) : <EOL> try : <EOL> Output = open ( FileName , '<STR_LIT:r>' ) . read ( ) . split ( "<STR_LIT:\n>" ) <EOL> print "<STR_LIT>" + FileName + "<STR_LIT:'>" <EOL> except IOError , error : <EOL> print "<STR_LIT>" + FileName + "<STR_LIT>" + str ( sys . exc_info ( ) ) + "<STR_LIT:)>" <EOL> Output = [ ] <EOL> return Output <EOL> def Save ( self , FileName , Data ) : <EOL> Data = str ( Data ) <EOL> try : <EOL> print "<STR_LIT>" + str ( FileName ) + "<STR_LIT>" + str ( Data ) <EOL> print "<STR_LIT>" + str ( FileName ) + "<STR_LIT>" + str ( Data ) + "<STR_LIT:..>" <EOL> File = open ( FileName , '<STR_LIT:w>' ) <EOL> File . write ( Data ) <EOL> except IOError , error : <EOL> print "<STR_LIT>" + FileName + "<STR_LIT>" + str ( sys . exc_info ( ) ) + "<STR_LIT:)>" <EOL> class Config : <EOL> def __init__ ( self , FileName ) : <EOL> self . Config = defaultdict ( list ) <EOL> self . Load ( FileName ) <EOL> def Load ( self , FileName ) : <EOL> for Line in File ( ) . GetAsList ( FileName ) : <EOL> try : <EOL> Name = Line . split ( "<STR_LIT::>" ) [ <NUM_LIT:0> ] <EOL> Value = Line . replace ( Name + "<STR_LIT::>" , "<STR_LIT>" ) . strip ( ) <EOL> self . Config [ Name ] = Value <EOL> except : <EOL> print "<STR_LIT>" + Line <EOL> def Get ( self , Setting ) : <EOL> return self . Config [ Setting ] <EOL> def Set ( self , Setting , Value ) : <EOL> self . Config [ Setting ] = Value </s>
