use pydantic's exclude

This commit is contained in:
seehi 2024-08-12 17:16:28 +08:00
parent 11894d12f3
commit b4207cec92
4 changed files with 17 additions and 49 deletions

View file

@ -125,15 +125,3 @@ class MGXEnv(Environment, SerializationMixin):
def __repr__(self):
return "MGXEnv()"
def remove_unserializable(self, data: dict):
"""Removes unserializable content from the data dictionary.
Args:
data (dict): The data dictionary to clean, obtained from Pydantic's model_dump method.
"""
roles = data.get("roles", {})
for role in roles.values():
[role.pop(key, None) for key in role.get("unserializable_fields", [])]