[issue46792] Indentation not preserved with ruamel.yaml.round_trip_dump

2022-02-18 Thread Eric V. Smith


Change by Eric V. Smith :


--
title: Indentation now preserved with ruamel.yaml.round_trip_dump -> 
Indentation not preserved with ruamel.yaml.round_trip_dump

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46792] Indentation now preserved with ruamel.yaml.round_trip_dump

2022-02-18 Thread Zachary Ware


Change by Zachary Ware :


--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46792] Indentation now preserved with ruamel.yaml.round_trip_dump

2022-02-18 Thread Eric V. Smith


Eric V. Smith  added the comment:

This looks like an issue with ruamel.yaml, which is a third party package. You 
should report it to them.

Good luck!

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46792] Indentation now preserved with ruamel.yaml.round_trip_dump

2022-02-18 Thread Harshini


New submission from Harshini :

I observed that the indentation is not preserved when I load and dump a YAML 
file using round_trip_dump from ruamel.yaml. For example, I have an input file 
with the data:

Inventory:
  - name: Apples
count: 10
vendors:
- - vendor_name: xyz
boxes: 2

  - name: Bananas
number: 20
vendors:
- - vendor_name: abc
boxes: 1
  - vendor_name: xyz
boxes: 4


I wrote a simple script that just loads and dumps the same data into a new YAML 
file:

import sys
import os
import ruamel.yaml

yaml = ruamel.yaml.YAML()
input_file = sys.argv[1]
output_yaml =  r"data_output.yaml"
output = open(output_yaml, 'w+')
with open(input_file, 'r') as f:
data = yaml.load(f)
ruamel.yaml.round_trip_dump(data, output)


I would expect the output yaml to be the same as the input yaml but what is see 
is:

Inventory:
- name: Apples
  count: 10
  vendors:
  - - vendor_name: xyz
  boxes: 2
- name: Bananas
  number: 20
  vendors:
  - - vendor_name: abc
  boxes: 1
- vendor_name: xyz
  boxes: 4

It is missing the indentation under Inventory as there should be a tab before 
"- name" .

--
components: Library (Lib)
files: input.yaml
messages: 413502
nosy: nvorugan
priority: normal
severity: normal
status: open
title: Indentation now preserved with ruamel.yaml.round_trip_dump
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file50629/input.yaml

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com