Loading src/types/yaml.py +18 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from sys import maxsize from typing import Any, Dict, List, Optional, Union # Modules libraries from yaml import dump as yaml_dump, load_all as yaml_load_all from yaml import dump as yaml_dump, Dumper as yaml_Dumper, load_all as yaml_load_all from yaml import SafeLoader as yaml_SafeLoader, YAMLError as yaml_Error from yaml.nodes import SequenceNode as yaml_SequenceNode Loading Loading @@ -413,9 +413,25 @@ class YAML: @staticmethod def dump(data: Data) -> str: # Dumper, pylint: disable=too-many-ancestors class Dumper(yaml_Dumper): pass # Representer Dumper.add_representer( str, lambda dumper, data: dumper.represent_scalar( 'tag:yaml.org,2002:str', data, style='|' if '\n' in data else None, ), ) # Dump YAML data return str(yaml_dump( return str( yaml_dump( data, Dumper=Dumper, indent=2, sort_keys=False, width=maxsize, Loading Loading
src/types/yaml.py +18 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from sys import maxsize from typing import Any, Dict, List, Optional, Union # Modules libraries from yaml import dump as yaml_dump, load_all as yaml_load_all from yaml import dump as yaml_dump, Dumper as yaml_Dumper, load_all as yaml_load_all from yaml import SafeLoader as yaml_SafeLoader, YAMLError as yaml_Error from yaml.nodes import SequenceNode as yaml_SequenceNode Loading Loading @@ -413,9 +413,25 @@ class YAML: @staticmethod def dump(data: Data) -> str: # Dumper, pylint: disable=too-many-ancestors class Dumper(yaml_Dumper): pass # Representer Dumper.add_representer( str, lambda dumper, data: dumper.represent_scalar( 'tag:yaml.org,2002:str', data, style='|' if '\n' in data else None, ), ) # Dump YAML data return str(yaml_dump( return str( yaml_dump( data, Dumper=Dumper, indent=2, sort_keys=False, width=maxsize, Loading