ruamel.yaml Questions

1

I've searched and found "similar" posts, but nothing that answers my question directly. I also found a stackoverflow post here, but no answers. I need to write to a yaml file using the following f...
Sultana asked 14/6, 2018 at 8:16

2

Solved

The following is not working for me, with Python 3.4.7, ruamel.yaml version 0.15.35: import sys import enum import ruamel.yaml from ruamel.yaml import yaml_object yaml = ruamel.yaml.YAML() @yaml...
Ludeman asked 29/12, 2017 at 4:14

2

I have an yaml file as mentioned below test1.yaml resources: name:{get_param: vname} ssh_keypair: {get_param: ssh_keypair} Now I want to add test1_routable_net: { get_param: abc_routable_net }...
Galactopoietic asked 22/11, 2017 at 18:21

1

Solved

I have a YAML file, test.yaml: test: server_group_1: type: OS::Nova::ServerGroup properties: name: { get_param: [server_groups, 5] } policies: [ { get_param: [server_group_types, 5] } ] and...
Beanstalk asked 21/11, 2017 at 16:52

1

Solved

I am trying to create a Python script that will convert our IPtables config to firewall multi within a YAML file. I originally was using pyyaml, however, later found that this removes all comments ...
Irrationality asked 17/10, 2017 at 9:28

2

Solved

I am using Ruamel to preserve quote styles in human-edited YAML files. I have example input data as: --- a: '1' b: "2" c: 3 I read in data using: def read_file(f): with open(f, 'r') as _f: r...
Balkanize asked 1/9, 2016 at 4:6

1

This is very similar to questions/44786412 but mine appears to be triggered by YAML safe_load(). I'm using Ruamel's library and YamlReader to glue a bunch of CloudFormation pieces together into a s...
Eudy asked 30/8, 2017 at 17:39

1

Solved

With the following data from ruamel import yaml data = {1: {1:[{1:1,2:2},{1:1,2:2}], 2:2}, 2: 42} I get an incorrect indentation for the sequence >>> print yaml.round_trip_dump(data) 1...
Ashly asked 6/6, 2017 at 11:21

1

I have YAML file site.yaml: Kvm_BLOCK: ip_address: 10.X.X.X property: null server_type: zone loaded and then dumped with: ruamel.yaml.dump(site_yaml, new_file, Dumper=ruamel.yaml.RoundTripDu...
Bucolic asked 1/6, 2017 at 17:44

1

Solved

I need to add an extra value to an existing key in a YAML file. Following is the code I'm using. with open(yaml_in_path, 'r') as f: doc, ind, bsi = load_yaml_guess_indent(f, preserve_quotes=True)...
Mishandle asked 11/2, 2017 at 4:58

1

Solved

I use the load_yaml_guess_indent(f, preserve_quotes=True) to read a YAML file, then modify it and write it back. I noticed long lines are getting wrapped when they are written back. (A line break i...
Atheist asked 11/2, 2017 at 0:13

1

Solved

I've been reading the PyYAML source code to try to understand how to define a proper constructor function that I can add with add_constructor. I have a pretty good understanding of how that code wo...
Nicolas asked 27/1, 2017 at 18:35

1

Solved

I have a structure like this to which I want to add comment lines using ruamel.yaml: xyz: a: 1 # comment 1 b: 2 test1: test2: test3: 3 Now, I want to insert comment-lines (not eol_comments)...
Sickly asked 20/11, 2016 at 14:1

1

Solved

Recursive references work great in ruamel.yaml or pyyaml: $ ruamel.yaml.dump(ruamel.yaml.load('&A [ *A ]')) '&id001 - *id001' However it (obviously) does not work on normal references: ...
Kiwi asked 16/9, 2016 at 14:34

1

Solved

I'd like to get the comment strings from a YAML file I loaded using ruamel.yaml. The project documentation lacks an API reference and I can't find a relevant example. What's the right way to access...
Solfeggio asked 7/7, 2016 at 18:12

1

Solved

I have a YAML file and would like to constrain a certain field to contain no whitespace. Here's a script that demonstrates my attempt: test.py #!/usr/bin/env python3 import os from ruamel import...
Otto asked 5/7, 2016 at 12:26

1

Solved

I understand that this is related to this SO question, but what I'm mostly concerned about is whether this might mess with things such as the preserved comments. import ruamel.yaml as yaml yaml_s...
Scarf asked 1/5, 2016 at 17:40

2

Solved

I am writing a YAML file using https://pypi.python.org/pypi/ruamel.yaml The code is like this: import ruamel.yaml from ruamel.yaml.comments import CommentedSeq d = {} for m in ['B1', 'B2', 'B3']...
Mystical asked 23/6, 2015 at 5:17

© 2022 - 2024 — McMap. All rights reserved.