Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use sets instead of tuples in make_hashable

  • Loading branch information...
commit 20872d8ba70521a4fda8aabb0b942fe568f6ee19 1 parent 202d63e
@scooby authored
Showing with 6 additions and 4 deletions.
  1. +3 −2 example_dumper.py
  2. +3 −2 handle_mappings.py
View
5 example_dumper.py
@@ -79,9 +79,10 @@ def make_hashable(value):
if isinstance(value, list):
return tuple(map(make_hashable, value))
elif isinstance(value, set):
- return frozenset(map(make_hashable, value))
+ return frozenset(value)
elif isinstance(value, dict):
- return tuple(sorted((make_hashable(key), val) for key, val in value.items()))
+ return frozenset((make_hashable(key), make_hashable(val))
+ for key, val in value.items())
else:
return value
def new_items():
View
5 handle_mappings.py
@@ -20,9 +20,10 @@ def make_hashable(value):
if isinstance(value, list):
return tuple(map(make_hashable, value))
elif isinstance(value, set):
- return frozenset(map(make_hashable, value))
+ return frozenset(value)
elif isinstance(value, dict):
- return tuple(sorted((make_hashable(key), val) for key, val in value.items()))
+ return frozenset((make_hashable(key), make_hashable(val))
+ for key, val in value.items())
else:
return value
def new_items():
Please sign in to comment.
Something went wrong with that request. Please try again.