<s> from os import listdir <EOL> from os . path import isfile , isdir , join <EOL> import pdb <EOL> import glob <EOL> import pdb <EOL> import shutil <EOL> REPO = "<STR_LIT>" <EOL> OUTPUT = "<STR_LIT>" <EOL> ttl_files = glob . glob ( "<STR_LIT>" % ( OUTPUT ) ) <EOL> file_map = { } <EOL> for ttl in ttl_files : <EOL> acronym = ttl . split ( "<STR_LIT:/>" ) [ - <NUM_LIT:1> ] [ <NUM_LIT:0> : - <NUM_LIT:4> ] <EOL> file_map [ acronym ] = ttl <EOL> for acronym in file_map : <EOL> ttl = file_map [ acronym ] <EOL> dir_ont = join ( REPO , acronym ) <EOL> if isdir ( dir_ont ) : <EOL> sub_dirs = glob . glob ( join ( dir_ont , "<STR_LIT:*>" ) ) <EOL> latest = <NUM_LIT:0> <EOL> latest_subdir = None <EOL> for sub_dir in sub_dirs : <EOL> s = sub_dir . split ( "<STR_LIT:/>" ) [ - <NUM_LIT:1> ] <EOL> try : <EOL> i = int ( s ) <EOL> if i > latest : <EOL> latest = i <EOL> latest_subdir = sub_dir <EOL> except ValueError : <EOL> continue <EOL> print "<STR_LIT>" + acronym + "<STR_LIT>" + str ( latest ) <EOL> if latest_subdir : <EOL> if isfile ( join ( latest_subdir , ttl . split ( "<STR_LIT:/>" ) [ - <NUM_LIT:1> ] ) ) : <EOL> shutil . copy2 ( ttl , latest_subdir ) <EOL> print "<STR_LIT>" <EOL> else : <EOL> print "<STR_LIT>" + acronym <EOL> else : <EOL> print "<STR_LIT>" + dir_ont </s>
