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
I was in the process of updating usage of tomlkit over in requirementslib where I have a need to support compatibility with an old usage of sources keys in a Pipfile (we now just use the source key in an AoT). I was hoping to simply pop the key and reassign it from sources to its proper name, source, if I encounter it. However, pop does not remove the key from the table, so I wind up retaining the original key and also adding the new key. The original key is not valid for the schema so the document fails validation.
So it's just effectively duplicating the key and not removing it. I also noticed that pop seems to just pop the _body value of the item and not the item itself (as compared with __getitem__ which returns the actual AoT in this case), so what I thought was an AoT instance was just a list.
Is this the expected behavior or should someone put together a patch?
The text was updated successfully, but these errors were encountered:
It is easy to add pop support, but i am thinking of introducing collections.abc.MutableMapping as base class to reduce overhead. dict can still be kept to not break isinstance() check. That may require a little refactor of Container and Table classes.
I was in the process of updating usage of tomlkit over in requirementslib where I have a need to support compatibility with an old usage of
sources
keys in aPipfile
(we now just use thesource
key in anAoT
). I was hoping to simply pop the key and reassign it fromsources
to its proper name,source
, if I encounter it. However,pop
does not remove the key from the table, so I wind up retaining the original key and also adding the new key. The original key is not valid for the schema so the document fails validation.Here is an example document:
And for completeness:
So it's just effectively duplicating the key and not removing it. I also noticed that
pop
seems to just pop the_body
value of the item and not the item itself (as compared with__getitem__
which returns the actual AoT in this case), so what I thought was anAoT
instance was just a list.Is this the expected behavior or should someone put together a patch?
The text was updated successfully, but these errors were encountered: