def filter_upgrade_duplicates(file_list):
 bases = {}
 for f in file_list:
  basekey = f.replace('.json', '')
  if f.endswith('.json'):
   bases[basekey] = f
  else:
   lookup = bases.get(basekey, '')
   if (not lookup.endswith('.json')):
    bases[basekey] = f
 return bases.values()

def filter_upgrade_duplicates ( file_list ) : bases = { } for f in file_list : basekey = f . replace ( '.json' , '' ) if f . endswith ( '.json' ) : bases [ basekey ] = f else : lookup = bases . get ( basekey , '' ) if ( not lookup . endswith ( '.json' ) ) : bases [ basekey ] = f return bases . values ( )
in a set of files .