You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works fine when the representation of the elements themselves are pretty short, but if we're storing large(-ish) strings, things get out of hand, even when the number of elements is less than 4. Here's an example for a config file I use to store user-defined regexes:
The best case scenario would be to have some way to get the total length of the elements after dump, and have a threshold on the number of chars to decide. But from my brief look over the pyyaml api, this doesn't seem to be feasible.
As a workaround, I'd be ok if the Configuration.dump() method exposes the default_flow_style parameter as a keyword argument, so that we can enforce no inlining of lists.
The text was updated successfully, but these errors were encountered:
Seems like a reasonable thing to want! FWIW, the "real solution" may be #52, i.e., switching to a YAML library that has reasonable round-trip dumping built in so we don't need to resort to these hacks.
The current version counts the number of elements in the list to determine whether it should be inline or not.
confuse/confuse/yaml_util.py
Lines 128 to 131 in c244db7
This works fine when the representation of the elements themselves are pretty short, but if we're storing large(-ish) strings, things get out of hand, even when the number of elements is less than 4. Here's an example for a config file I use to store user-defined regexes:
Possible solutions
Configuration.dump()
method exposes thedefault_flow_style
parameter as a keyword argument, so that we can enforce no inlining of lists.The text was updated successfully, but these errors were encountered: