<s> import os <EOL> import sys <EOL> def unique_messages ( ) : <EOL> basedir = None <EOL> if os . path . isdir ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) : <EOL> basedir = os . path . abspath ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> elif os . path . isdir ( '<STR_LIT>' ) : <EOL> basedir = os . path . abspath ( '<STR_LIT>' ) <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> for ( dirpath , dirnames , filenames ) in os . walk ( basedir ) : <EOL> for f in filenames : <EOL> if f . endswith ( '<STR_LIT>' ) : <EOL> sys . stderr . write ( '<STR_LIT>' % ( f , dirpath ) ) <EOL> pf = os . path . splitext ( os . path . join ( dirpath , f ) ) [ <NUM_LIT:0> ] <EOL> cmd = '<STR_LIT>' % pf <EOL> stdout = os . popen ( cmd ) <EOL> msg = stdout . read ( ) <EOL> with open ( '<STR_LIT>' % pf , '<STR_LIT:w>' ) as fp : <EOL> fp . write ( msg ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unique_messages ( ) </s>
