#NEWLINE# def find_duplicates( files ) : #NEWLINE# #INDENT# primary = files [ 0 ] #NEWLINE# others = files [ 1 : len ( files ) ] #NEWLINE# for package in primary [ 'packages' ] . copy ( ) : #NEWLINE# #INDENT# for other in others : #NEWLINE# #INDENT# otherpacks = other [ 'packages' ] #NEWLINE# try : #NEWLINE# #INDENT# dupe = otherpacks [ other ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# this = { #NEWLINE# #INDENT# 'file' : primary [ 'name' ] , #NEWLINE# 'package' : package , #NEWLINE# 'version' : primary [ 'packages' ] [ package ] , #NEWLINE# #UNINDENT# } #NEWLINE# that = { #NEWLINE# #INDENT# 'file' : other [ 'name' ] , #NEWLINE# 'package' : package , #NEWLINE# 'version' : other [ 'packages' ] [ package ] , #NEWLINE# #UNINDENT# } #NEWLINE# click . echo ( 'Found {} in {} and {}' . format ( package , this [ 'file' ] , that [ 'file' ] ) ) #NEWLINE# value = click . prompt ( '[0]Keep both\n[1] Keep {} in {}\n[2] Keep {} in {}\n' . format ( this [ 'version' ] , this [ 'file' ] , that [ 'version' ] , that [ 'file' ] ) , type = int ) #NEWLINE# if ( value == 1 ) : #NEWLINE# #INDENT# del otherpacks [ package ] #NEWLINE# other [ 'updated' ] . append ( package ) #NEWLINE# other [ 'removed' ] . append ( package ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( value == 2 ) : #NEWLINE# #INDENT# del primary [ 'packages' ] [ package ] #NEWLINE# primary [ 'updated' ] . append ( package ) #NEWLINE# primary [ 'removed' ] . append ( package )