-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with Sequence template #137
Comments
Ah, that's a very funky problem! I believe print(type(valid_config['servers'][0])) which reveals that the things that look like The problem goes away if you convert these back to plain config.set({
'servers': [dict(m) for m in valid_config['servers']] + [
{'host': 'four.example.org'},
{'host': 'five.example.org', 'port': 9000},
],
}) Maybe we should consider this a problem in PyYaml, and maybe it would go away if we switched to a modern library (#52). But maybe, if we stick with PyYaml, we should teach the dumper we use about |
(Thank you, by the way, for the self-contained reproducible bug report. Having a program I could actually run made it easy to find the problem!) |
Thanks @sampsyo for the detailed and fast response! Maybe it's a different issue, but it's also not exactly clear how can you extend a Sequence dynamically (the way I did it with |
Oh sure, that's a very good question! You should be able to accomplish this by using Lines 230 to 233 in 2d7b6c8
Namely, |
@sampsyo - sorry, don't really understand how is it related. I am trying to add extra members to Sequence dynamically instead of using I tried the following things, but they are not working:
|
I suppose what I'm saying is that both of those things should work as-is, but you have to retrieve the data with |
|
You can use For broader context, I don't think there is a built-in template that can do this "flattening" without using |
I am trying to use confuse examples to dynamically update a Sequence, but
dump
function is not working after dynamic update:servers_example.yaml
:test.py
:config.dump
produces:Any idea what am I doing wrong? or is it a bug?
The text was updated successfully, but these errors were encountered: