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
Add ability to custom-sort YAML-configured item lists #15
Comments
Only for presets! Otherwise, random! |
I think the issue is that in our Python implementation dictionary order is randomized. Presets are explicitly sorted: Line 105 in 570b5bc
But for other yaml loads, I think Python is randomizing the sort (though this should be checked by hard-loading the dict from code). yaml/pyyaml#110 makes it sound like the only way pyyaml affects this is in the yaml.dump function, which we're not using. OrderedDict might be the sensible solution here (given than insertion order is only guaranteed to be preserved in 3.7+). Trick then is to get pyyaml to load into an OrderedDict. A possible solution is at https://stackoverflow.com/a/21912744. (Additional considerations are at https://stackoverflow.com/questions/1867861/how-to-keep-keys-values-in-same-order-as-declared) |
Confirmed. |
Probable fix is now committed in branch split_location, but doesn't work due to order of controller sections. So this now depends on #22. Also, once this is tested, should move definition of ordered_load to the yamls_in_order branch |
So #22 won't be fixed properly for a while. The function should be shoehorned into the mess of the controller file wherever works for now. |
Function shoehorned effectively. This is now fixed in branch yamls-in-order. |
Currently, sort is automatically alphabetical.
The text was updated successfully, but these errors were encountered: