Skip to content

Commit f9f6ecf

Browse files
Chipe1norvig
authored andcommitted
Changes to hashable dict (aimacode#482)
* Adds hashable dict type * Implemented permutation decoder * added test for permutation decode * Optimized permutationdecoder * relaxed tests * uses isinstance
1 parent 99d4cc3 commit f9f6ecf

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

text.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ def actions(self, state):
399399

400400
def result(self, state, action):
401401
new_state = hashabledict(state) # copy to prevent hash issues
402-
assert type(new_state) == hashabledict
403402
new_state[action[0]] = action[1]
404403
return new_state
405404

utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,19 +579,19 @@ def __hash__(self):
579579
return hash(self.__tuplify__())
580580

581581
def __lt__(self, odict):
582-
assert type(odict) is hashabledict
582+
assert isinstance(odict, hashabledict)
583583
return self.__tuplify__() < odict.__tuplify__()
584584

585585
def __gt__(self, odict):
586-
assert type(odict) is hashabledict
586+
assert isinstance(odict, hashabledict)
587587
return self.__tuplify__() > odict.__tuplify__()
588588

589589
def __le__(self, odict):
590-
assert type(odict) is hashabledict
590+
assert isinstance(odict, hashabledict)
591591
return self.__tuplify__() <= odict.__tuplify__()
592592

593593
def __ge__(self, odict):
594-
assert type(odict) is hashabledict
594+
assert isinstance(odict, hashabledict)
595595
return self.__tuplify__() >= odict.__tuplify__()
596596

597597

0 commit comments

Comments
 (0)