summary refs log tree commit diff
path: root/synapse/util/frozenutils.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-06-04 00:09:17 +0300
committerMatthew Hodgson <matthew@matrix.org>2018-06-04 00:09:17 +0300
commit28f09fcdd51796dd5036cb74e62b7a74d753f4be (patch)
tree40f098938d04cf93c8f7bb7aa82af879479b3334 /synapse/util/frozenutils.py
parentmore comments (diff)
parentMerge pull request #3317 from thegcat/feature/3312-add_ipv6_to_blacklist_exam... (diff)
downloadsynapse-28f09fcdd51796dd5036cb74e62b7a74d753f4be.tar.xz
Merge branch 'develop' into matthew/filter_members
Diffstat (limited to 'synapse/util/frozenutils.py')
-rw-r--r--synapse/util/frozenutils.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/synapse/util/frozenutils.py b/synapse/util/frozenutils.py
index f497b51f4a..15f0a7ba9e 100644
--- a/synapse/util/frozenutils.py
+++ b/synapse/util/frozenutils.py
@@ -16,16 +16,17 @@
 from frozendict import frozendict
 import simplejson as json
 
+from six import string_types
+
 
 def freeze(o):
-    t = type(o)
-    if t is dict:
+    if isinstance(o, dict):
         return frozendict({k: freeze(v) for k, v in o.items()})
 
-    if t is frozendict:
+    if isinstance(o, frozendict):
         return o
 
-    if t is str or t is unicode:
+    if isinstance(o, string_types):
         return o
 
     try:
@@ -37,11 +38,10 @@ def freeze(o):
 
 
 def unfreeze(o):
-    t = type(o)
-    if t is dict or t is frozendict:
+    if isinstance(o, (dict, frozendict)):
         return dict({k: unfreeze(v) for k, v in o.items()})
 
-    if t is str or t is unicode:
+    if isinstance(o, string_types):
         return o
 
     try: