mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 16:44:49 -04:00
Optimize FrozenEvent creation
This commit is contained in:
parent
36a2a877e2
commit
dfa05f0cd6
2 changed files with 16 additions and 9 deletions
|
@ -17,10 +17,11 @@ from frozendict import frozendict
|
|||
|
||||
|
||||
def freeze(o):
|
||||
if isinstance(o, dict) or isinstance(o, frozendict):
|
||||
t = type(o)
|
||||
if t is dict:
|
||||
return frozendict({k: freeze(v) for k, v in o.items()})
|
||||
|
||||
if isinstance(o, basestring):
|
||||
if t is str or t is unicode:
|
||||
return o
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue