diff --git a/src/parsers/yaml.py b/src/parsers/yaml.py index 4591c0a86..0b706ca83 100644 --- a/src/parsers/yaml.py +++ b/src/parsers/yaml.py @@ -44,14 +44,15 @@ def writeSerializedTypes(value: Tuple[str, any] | any, case _: svalue = str(svalue) # Escape control and reserved characters # @see https://symfony.com/doc/current/reference/formats/yaml.html - reserve_chars = [':', '{', '}', '[', ']', ',', '&', '*', '#', '?', - '|', '-', '<', '>', '=', '!', '%',' @', '`'] - control_chars = ['\0', '\x01', '\x02', '\x03', '\x04', '\x05', - '\x06', '\a', '\b', '\t', '\n', '\v', '\f', '\r', - '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', - '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', - '\x1a', '\e', '\x1c', '\x1d', '\x1e', '\x1f', - r'\N', r'\_', r'\L', r'\P'] + reserve_chars = [':', '{', '}', '[', ']', ',', '&', + '*', '#', '?', '|', '-', '<', '>', + '=', '!', '%', '@', '`'] + control_chars = ['\0', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', + '\a', '\b', '\t', '\n', '\v', '\f', '\r', + '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', + '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', r'\e', + '\x1c', '\x1d', '\x1e', '\x1f', r'\N', r'\_', r'\L', + r'\P'] if any([c for c in control_chars if c in svalue]): svalue = f'"{svalue}"' elif any([c for c in reserve_chars if c in svalue]):