Skip to content

Commit

Permalink
also sort datatypes by depth
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcmicu committed Nov 16, 2023
1 parent 81d973a commit ea0630a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/guess.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ def tiebreak(datatypes):
in_types.append(dt)
else:
other_types.append(dt)
sorted_types = sorted(in_types, key=lambda k: k["success_rate"], reverse=True) + sorted(
other_types, key=lambda k: k["success_rate"], reverse=True
)
sorted_types = sorted(
in_types, key=lambda k: (k["depth"], k["success_rate"]), reverse=True
) + sorted(other_types, key=lambda k: (k["depth"], k["success_rate"]), reverse=True)
return sorted_types[0]["datatype"]

curr_index = 0
Expand All @@ -264,6 +264,7 @@ def tiebreak(datatypes):
matching_datatypes.append(
{
"datatype": datatype,
"depth": curr_index,
"success_rate": success_rate,
}
)
Expand Down

0 comments on commit ea0630a

Please sign in to comment.