ruamel.yaml Questions

4

I am attempting to use MyPy with modules that use ruamel.yaml and Mypy cannot find ruamel.yaml even though Python has no problem finding it. I am puzzled because I can't find a module called YAML.p...
Familist asked 5/9, 2018 at 15:54

2

Solved

I have two dataclasses: Msg and Field. Msg has a field fields of type list[Field]. I want to assign something to a field of each Field after they have all been initialized which is more or less the...
Goforth asked 14/11, 2023 at 22:42

3

Solved

I am trying to parse data from yaml file having some expressions similar to jinaj2 template syntax, the goal is to delete or add some items to the file. AddCodesList.yaml AddCodesList: body: li...
Canvasback asked 16/2, 2017 at 9:27

15

Conda gives error when I run any command with it. Traceback (most recent call last): File "/usr/local/bin/conda", line 7, in <module> from conda.cli.main import main File "/usr/local/lib/...
Sierrasiesser asked 29/12, 2016 at 5:50

3

Solved

I'm trying to debug an issue, and it boils down to... >>> import yaml as pyyaml >>> import ruamel.yaml as ruamel >>> ruamel.load("x: yes") == ruamel.load("x: true") Fals...
Phonemics asked 27/8, 2019 at 21:49

2

Solved

I am receiving an error when I want to install the ruamel.yaml package Here is the command: python --version;pip --version;pip install ruamel.yaml And the output: Python 2.7.10 pip 10.0.0 fr...
Levator asked 17/4, 2018 at 0:32

4

Solved

We are in need of parsing YAML files which contain duplicate keys and all of these need to be parsed. It is not enough to skip duplicates. I know this is against the YAML spec and I would like to n...
Chanticleer asked 4/7, 2017 at 11:4

2

Solved

I need to get the line numbers of certain keys of a YAML file. Please note, this answer does not solve the issue: I do use ruamel.yaml, and the answers do not work with ordered maps. #!/usr/bin/e...
Exsiccate asked 16/8, 2017 at 14:26

3

I'm trying to dump a Python dict to a YAML file using ruamel.yaml. I'm familiar with the json module's interface, where pretty-printing a dict is as simple as import json with open('outfile.json',...
Oliverolivera asked 24/10, 2016 at 20:4

1

Solved

Here is the code I have from ruamel.yaml import YAML yaml = YAML() user = [{"login":"login1","fullName":"First1 Last1", "list":["a"]},{&...
Consensual asked 29/9, 2021 at 13:2

1

Solved

When I try following solution PyYAML - Saving data to .yaml files and try to modify values in nested dictionaries using ruamel.yaml cfg = Config("test.yaml") cfg['setup']['a'] = 3 print(...
Cafard asked 7/8, 2021 at 10:26

1

Solved

For Python 3.7, I am getting following error: `ruamel.yaml.representer.RepresenterError: cannot represent an object: {'a': 3}` For the following piece of code taken from answer for PyYAML - Savin...
Thigmotaxis asked 6/8, 2021 at 8:49

2

I am trying to download the Kinetics-600 dataset for activity recognition and for that I am following the instructions in this repo: https://github.com/activitynet/ActivityNet However, at the step ...
Jordans asked 13/3, 2021 at 0:52

2

I really like how ruamel.yaml can Round-trip comments, but I haven't figured out how to remove a comment from a YAML file. #!/usr/bin/env python3 from ruamel.yaml import YAML import sys yaml = YA...
Badillo asked 21/8, 2019 at 19:47

3

Solved

In the past, I did something like some_fancy_printing_loggin_func(yaml.dump(...), ...), using the backward-compatible part of ruamel.yaml, but I want to convert my code to use the latest API so tha...
Burin asked 3/12, 2017 at 3:5

1

Solved

ruamel.yaml formats a simple, but nested dictionary differently depending on if it's using the safe or the round-trip representer. I can't see why the different repersenters should format such a si...
Freud asked 2/7, 2020 at 3:37

1

Solved

I am not able to find a way to dump the YAML to a variable in ruamel.yaml. With PyYAML, I could able to achieve the same like below: with open('oldPipeline.yml','r') as f: data = yaml.load(f, Load...
Duluth asked 11/5, 2020 at 4:23

2

Solved

I'm trying to dump some Python objects out into YAML. Currently, regardless of YAML library (pyyaml, oyaml, or ruamel) I'm having an issue where calling .dump(MyObject) gives me correct YAML, but ...
Seedtime asked 24/4, 2019 at 9:18

1

Solved

The following code: from ruamel.yaml import YAML import sys, textwrap yaml = YAML() yaml.default_flow_style = False yaml.dump({ 'hello.py': textwrap.dedent("""\ import sys sys.stdout.write("he...
Olia asked 6/8, 2019 at 19:9

2

Solved

I am wondering if this is a bug or intentional, but anyway. Why does dumping a single value with ruamel.yaml always include an explicit YAML end marker? import sys from ruamel.yaml import YAML yaml...
Luba asked 9/7, 2019 at 10:19

1

Solved

I am using a function from a python library which returns an object with a specific data type. I would like to serialize that object to a yaml file and I would like to use ruamel.yaml. The problem ...
Alidus asked 26/1, 2019 at 12:9

2

Solved

I have two yaml files as mentioned below test1.yaml resources: server_group_1: type: OS::Nova::ServerGroup properties: name: { get_param: [server_groups, 5] } policies: [ { get_param: [serve...
Tobey asked 22/11, 2017 at 0:15

2

Solved

I'm using ruamel.yaml for modifying a YAML file. My requirement is to add a value for an existing key, preserving everything else including the order. I got it to work, but looks like quotation mar...
Inamorata asked 7/2, 2017 at 16:7

2

Assume I created a @dataclass class Foo, and added a __post_init__ to perform type checking and processing. When I attempt to yaml.load a !Foo object, __post_init__ is not called. from dataclasse...
Microwatt asked 26/7, 2018 at 0:43

1

Solved

I am trying to understand what typ and pure=True mean in the ruamel.yaml Python library. I've read the documentation here. So far, I've understood that typ='safe' uses a safe loader which omits YAM...
Bedder asked 13/7, 2018 at 1:24

© 2022 - 2024 — McMap. All rights reserved.