diff options
author | Jacob Floyd <cognifloyd@gmail.com> | 2022-03-07 01:02:21 -0600 |
---|---|---|
committer | Jacob Floyd <cognifloyd@gmail.com> | 2022-03-07 01:02:21 -0600 |
commit | 9b00a89d94a38a31af24e32031ade5a9e50b9371 (patch) | |
tree | ec70562129e01cf534b70e8ab5d66a2e54599093 /representer.py | |
parent | 93219905074f2db276572bccaf886e260355fbb5 (diff) | |
download | ruamel.yaml-9b00a89d94a38a31af24e32031ade5a9e50b9371.tar.gz |
Preserve Octal format in YAML 1.1 docs
Diffstat (limited to 'representer.py')
-rw-r--r-- | representer.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/representer.py b/representer.py index 820559b..c57d9aa 100644 --- a/representer.py +++ b/representer.py @@ -634,7 +634,10 @@ class RoundTripRepresenter(SafeRepresenter): else: s = format(data, 'o') anchor = data.yaml_anchor(any=True) - return self.insert_underscore('0o', s, data._underscore, anchor=anchor) + prefix = '0o' + if getattr(self.serializer, 'use_version', None) == (1, 1): + prefix = '0' + return self.insert_underscore(prefix, s, data._underscore, anchor=anchor) def represent_hex_int(self, data): # type: (Any) -> Any |