From 70682cd4a843776300395d25c5f33f506595af5f Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Fri, 12 Jul 2024 09:30:50 +0200 Subject: [PATCH] Bump NimYAML module and related changes (#2474) --- fluffy/eth_data/yaml_utils.nim | 27 +++++++++++---------------- vendor/NimYAML | 2 +- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/fluffy/eth_data/yaml_utils.nim b/fluffy/eth_data/yaml_utils.nim index e5edd3b6f..bef5cd73f 100644 --- a/fluffy/eth_data/yaml_utils.nim +++ b/fluffy/eth_data/yaml_utils.nim @@ -41,30 +41,25 @@ proc loadFromYaml*(T: type, file: string): Result[T, string] = ok(res) proc dumpToYaml*[T](value: T, file: string): Result[void, string] = - # These are the default options aside from outputVersion which is set to none. - const options = PresentationOptions( - containers: cMixed, - indentationStep: 2, - newlines: nlOSDefault, - outputVersion: ovNone, - maxLineLength: some(80), - directivesEnd: deIfNecessary, - suppressAttrs: false, - quoting: sqUnset, - condenseFlow: true, - explicitKeys: false, - ) - let s = newFileStream(file, fmWrite) defer: try: close(s) except Exception as e: raiseAssert(e.msg) + + # To dump to yaml, avoiding TAGS and YAML version directives, no max line + # length. + var dumper = minimalDumper() + dumper.setDefaultStyle() + dumper.serialization.handles = @[] + dumper.serialization.tagStyle = tsNone + dumper.presentation.outputVersion = ovNone + dumper.presentation.maxLineLength = none(int) + try: {.gcsafe.}: - # Dump to yaml, avoiding TAGS and YAML version directives. - dump(value, s, tagStyle = tsNone, options = options, handles = @[]) + dumper.dump(value, s) except YamlPresenterJsonError as e: return err(e.msg) except YamlSerializationError as e: diff --git a/vendor/NimYAML b/vendor/NimYAML index 189844a72..25f600ebc 160000 --- a/vendor/NimYAML +++ b/vendor/NimYAML @@ -1 +1 @@ -Subproject commit 189844a72b90ba7ade864f997280809efcb21d0a +Subproject commit 25f600ebcd8f03492e6531f5642c3c2f1b83b3e3