From bdfbc7e14a9e935b54a048e53c65c2f6565340db Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sat, 31 Dec 2022 19:52:04 +0100 Subject: [PATCH] Network: allow sending frozenset --- NetUtils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NetUtils.py b/NetUtils.py index 513ab074..d7ab7a43 100644 --- a/NetUtils.py +++ b/NetUtils.py @@ -86,7 +86,7 @@ def _scan_for_TypedTuples(obj: typing.Any) -> typing.Any: data = obj._asdict() data["class"] = obj.__class__.__name__ return data - if isinstance(obj, (tuple, list, set)): + if isinstance(obj, (tuple, list, set, frozenset)): return tuple(_scan_for_TypedTuples(o) for o in obj) if isinstance(obj, dict): return {key: _scan_for_TypedTuples(value) for key, value in obj.items()} @@ -109,7 +109,7 @@ def get_any_version(data: dict) -> Version: return Version(int(data["major"]), int(data["minor"]), int(data["build"])) -whitelist = { +allowlist = { "NetworkPlayer": NetworkPlayer, "NetworkItem": NetworkItem, "NetworkSlot": NetworkSlot @@ -125,7 +125,7 @@ def _object_hook(o: typing.Any) -> typing.Any: hook = custom_hooks.get(o.get("class", None), None) if hook: return hook(o) - cls = whitelist.get(o.get("class", None), None) + cls = allowlist.get(o.get("class", None), None) if cls: for key in tuple(o): if key not in cls._fields: