<s> '''<STR_LIT>''' <EOL> from . cheat_hash_functions import ( cheat_hash_dict , cheat_hash_object , <EOL> cheat_hash_sequence , cheat_hash_set ) <EOL> infinity = float ( '<STR_LIT>' ) <EOL> dispatch_map = { <EOL> object : cheat_hash_object , <EOL> tuple : cheat_hash_sequence , <EOL> list : cheat_hash_sequence , <EOL> dict : cheat_hash_dict , <EOL> set : cheat_hash_set <EOL> } <EOL> '''<STR_LIT>''' <EOL> def cheat_hash ( thing ) : <EOL> '''<STR_LIT>''' <EOL> thing_type = type ( thing ) <EOL> matching_types = [ type_ for type_ in dispatch_map if issubclass ( thing_type , type_ ) ] <EOL> mro = thing_type . mro ( ) <EOL> matching_type = min ( <EOL> matching_types , <EOL> key = lambda type_ : ( mro . index ( type_ ) if type_ in mro else infinity ) <EOL> ) <EOL> return dispatch_map [ matching_type ] ( thing ) </s>
