Network: allow sending frozenset
This commit is contained in:
parent
94c6562f82
commit
bdfbc7e14a
|
@ -86,7 +86,7 @@ def _scan_for_TypedTuples(obj: typing.Any) -> typing.Any:
|
||||||
data = obj._asdict()
|
data = obj._asdict()
|
||||||
data["class"] = obj.__class__.__name__
|
data["class"] = obj.__class__.__name__
|
||||||
return data
|
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)
|
return tuple(_scan_for_TypedTuples(o) for o in obj)
|
||||||
if isinstance(obj, dict):
|
if isinstance(obj, dict):
|
||||||
return {key: _scan_for_TypedTuples(value) for key, value in obj.items()}
|
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"]))
|
return Version(int(data["major"]), int(data["minor"]), int(data["build"]))
|
||||||
|
|
||||||
|
|
||||||
whitelist = {
|
allowlist = {
|
||||||
"NetworkPlayer": NetworkPlayer,
|
"NetworkPlayer": NetworkPlayer,
|
||||||
"NetworkItem": NetworkItem,
|
"NetworkItem": NetworkItem,
|
||||||
"NetworkSlot": NetworkSlot
|
"NetworkSlot": NetworkSlot
|
||||||
|
@ -125,7 +125,7 @@ def _object_hook(o: typing.Any) -> typing.Any:
|
||||||
hook = custom_hooks.get(o.get("class", None), None)
|
hook = custom_hooks.get(o.get("class", None), None)
|
||||||
if hook:
|
if hook:
|
||||||
return hook(o)
|
return hook(o)
|
||||||
cls = whitelist.get(o.get("class", None), None)
|
cls = allowlist.get(o.get("class", None), None)
|
||||||
if cls:
|
if cls:
|
||||||
for key in tuple(o):
|
for key in tuple(o):
|
||||||
if key not in cls._fields:
|
if key not in cls._fields:
|
||||||
|
|
Loading…
Reference in New Issue