diff --git a/aiida/orm/utils/serialize.py b/aiida/orm/utils/serialize.py index a5cb5a1bec..5715d9b346 100644 --- a/aiida/orm/utils/serialize.py +++ b/aiida/orm/utils/serialize.py @@ -210,6 +210,8 @@ def serialize(data: Any, encoding: str | None = None) -> str | bytes: :param encoding: optional encoding for the serialized string :return: string representation of the serialized data structure or byte array if specific encoding is specified """ + serialized: bytes | str + if encoding is not None: serialized = yaml.dump(data, encoding=encoding, Dumper=AiiDADumper) else: