From 728f36c5ce5ab4d60feb2fedf39da39c5125895e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Paw=C5=82owski?= Date: Mon, 13 Jan 2025 13:06:45 +0100 Subject: [PATCH 1/2] Prevent strings from wrapping in .yaml for a proper round trip --- dvc/utils/serialize/_yaml.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dvc/utils/serialize/_yaml.py b/dvc/utils/serialize/_yaml.py index 6de2ae4ade..05157a4257 100644 --- a/dvc/utils/serialize/_yaml.py +++ b/dvc/utils/serialize/_yaml.py @@ -46,6 +46,8 @@ def _get_yaml(): from ruamel.yaml import YAML yaml = YAML() + # prevent strings from wrapping for a proper round-trip + yaml.width = float("inf") yaml.default_flow_style = False # tell Dumper to represent OrderedDict as normal dict From 6afef5804501197d5baa4600b8ae7cdb3caab512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Paw=C5=82owski?= Date: Mon, 13 Jan 2025 13:35:45 +0100 Subject: [PATCH 2/2] use-sys-maxsize-to-satisfy-mypy --- dvc/utils/serialize/_yaml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dvc/utils/serialize/_yaml.py b/dvc/utils/serialize/_yaml.py index 05157a4257..85cee9dbb0 100644 --- a/dvc/utils/serialize/_yaml.py +++ b/dvc/utils/serialize/_yaml.py @@ -1,4 +1,5 @@ import io +import sys from collections import OrderedDict from contextlib import contextmanager from typing import Any, TextIO @@ -47,7 +48,7 @@ def _get_yaml(): yaml = YAML() # prevent strings from wrapping for a proper round-trip - yaml.width = float("inf") + yaml.width = sys.maxsize yaml.default_flow_style = False # tell Dumper to represent OrderedDict as normal dict