codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[requirements][mistral] Add yamlloader to global requirements


On 19-02-14 11:15:59, Ben Nemec wrote:
> 
> 
> On 2/14/19 10:46 AM, Oleg Ovcharuk wrote:
> > Matthew, we use not only load, but also dump. We can't use custom
> > constructor and default representer - the output will be terrible.
> > This custom constructor contains about 50 lines of code, representer
> > would have a similar count. Also, we should think about compatibility
> > with Python 2.7, 3.x and about it's performance.
> > Summary, we would have about 150 lines of code, which is just copy-paste
> > from `yamlloader` library.
> > IMHO, it is better to use existing solutions.
> 
> You don't need a complex representer to dump OrderedDicts. It can be done in
> about three lines: https://github.com/cybertron/tripleo-scripts/blob/105381d4f080394e68a40327c398d32eb9f4f580/net_processing.py#L302
> 
> That's the code I used when I wanted to dump dicts in a particular order.
> Once you add the representer OrderedDicts are handled as you would expect.
> 
> > 
> > Ñ?Ñ?, 14 Ñ?евÑ?. 2019 г. в 19:14, Matthew Thode <mthode at mthode.org
> > <mailto:mthode at mthode.org>>:
> > 
> >     On 19-02-14 16:58:49, Oleg Ovcharuk wrote:
> >      > Hi! Can you please add yamlloader library to global requirements?
> >      > https://pypi.org/project/yamlloader/
> >      >
> >      > It provides ability to preserve key order in dicts, it supports
> >     either
> >      > python 2.7 and python 3.x, it provides better performance than
> >     built-in
> >      > functions.
> >      > Thank you.
> > 
> >     I'd like to know a little more about why we need this, yaml as a spec
> >     itself doesn't guarantee order so order should be stored somewhere else.
> > 
> >     If all you need is ordereddict support something like this may be better
> >     then adding yet another lib.
> > 
> >     https://gist.github.com/enaeseth/844388
> > 
> >     --     Matthew Thode
> > 

Thanks for this,  hope this can be used instead of adding yet another
lib to track

-- 
Matthew Thode
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20190214/956033b2/attachment.sig>