Skip to content

Commit

Permalink
Merge pull request #39 from ascribe/fix-issue-38
Browse files Browse the repository at this point in the history
Fix issue on dict ordering
  • Loading branch information
rhsimplex authored Aug 19, 2016
2 parents b1d6662 + 0193db7 commit bea2012
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions image_match/signature_database_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,15 @@ def search_image(self, path, all_orientations=False, bytestream=False):

l = self.search_single_record(transformed_record)
result.extend(l)
r = sorted(np.unique(result).tolist(), key=itemgetter('dist'))
s = set([x['id'] for x in r])
for i, x in enumerate(r):
if x['id'] not in s:
r.pop(i)
else:
s.remove(x['id'])

ids = set()
unique = []
for item in result:
if item['id'] not in ids:
unique.append(item)
ids.add(item['id'])

r = sorted(unique, key=itemgetter('dist'))
return r


Expand Down

0 comments on commit bea2012

Please sign in to comment.