if s < 1000: print "Tonic on string", tonicstring, g.tonic[0], " pedals:", combo, " ==>", result print "sought:", soughtchord candidates += [(s, combo, result, tonicstring)] candgrips += [(s, Grip(combo, [int(x != None) for x in result], neck, tonicstring).normalize())] neck.allup() # sys.exit(0) # candidates.sort(cmp=lambda x,y: x[0] - y[0]) candgrips = g.uniqify(candgrips, lambda x: x[1]) candgrips = g.thin(candgrips, Grip.superset_of, lambda x: x[1]) for c in candgrips: print str(c[1]), '\n' sys.exit(1) redundant_grips = [] print "Done searching.\n", '-'*40, "\nCandidates:" pprint(candidates) # pprint(candgrips) # sys.exit(1) def clean(l, pred):
def test_uniqify(): l = [(9,1), (9,2), (8,2), (9,3)] eq_(g.uniqify(l, lambda x: x[1]), [(9,1), (9,2), (9,3)])