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
When you use keys() method in a "dotted" situation, meaning we have a tree of keys in a Box, and you want to get the keys of a given node, one can notice that we get back a list of keys that are multiplicated if the value of a key is a list. (and the multiplication is by the lengh of the list)
and we can see the multiple occurances of the keys (with indexes of their number of values), and the method len(keys) would have wrong answer - 6 instead of 3.
The output which I thought would be right is: ['Animals.Land_animals', 'Animals.Sea_animals', 'Trees']
A workaround is to add to the box this:
box_intact_types = (tuple,list)
so that lists wouldn't be converted, and than it works fine.
The text was updated successfully, but these errors were encountered:
Bug of keys in Box:
When you use
keys()
method in a "dotted" situation, meaning we have a tree of keys in a Box, and you want to get the keys of a given node, one can notice that we get back a list of keys that are multiplicated if the value of a key is a list. (and the multiplication is by the lengh of the list)For example:
When you are using
keys = b.keys(dotted = True)
you get -and we can see the multiple occurances of the keys (with indexes of their number of values), and the method
len(keys)
would have wrong answer - 6 instead of 3.The output which I thought would be right is:
['Animals.Land_animals', 'Animals.Sea_animals', 'Trees']
A workaround is to add to the box this:
box_intact_types = (tuple,list)
so that lists wouldn't be converted, and than it works fine.
The text was updated successfully, but these errors were encountered: