mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-08 12:52:12 -04:00
Use immutabledict instead of frozendict (#15113)
Additionally: * Consistently use `freeze()` in test --------- Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
cabe4a3005
commit
3b0083c92a
20 changed files with 123 additions and 243 deletions
|
@ -14,14 +14,14 @@
|
|||
import collections.abc
|
||||
from typing import Any
|
||||
|
||||
from frozendict import frozendict
|
||||
from immutabledict import immutabledict
|
||||
|
||||
|
||||
def freeze(o: Any) -> Any:
|
||||
if isinstance(o, dict):
|
||||
return frozendict({k: freeze(v) for k, v in o.items()})
|
||||
return immutabledict({k: freeze(v) for k, v in o.items()})
|
||||
|
||||
if isinstance(o, frozendict):
|
||||
if isinstance(o, immutabledict):
|
||||
return o
|
||||
|
||||
if isinstance(o, (bytes, str)):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue