cdgriffith / cdgriffith/Box

Dotted keys read from YAML are lost with box_dots / default_box

Open
#305 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.8k
Forks
135
PR merge metrics
No merged PRs in 30d

Description

When reading the following YAML file...

```
a.b: c
a:
d: e
```

... with `box_dots=True` and `default_box=True`, the key a.b is lost when it's in front of a:

```
>>> import box
>>> box.Box.from_yaml(filename='test.yml')
Box({'a.b': 'c', 'a': {'d': 'e'}})
>>> box.Box.from_yaml(filename='test.yml',box_dots=True,default_box=True)
Box({'a': {'d': 'e'}})
```

Having the keys in reverse works correctly:

```
>>> box.Box.from_yaml(filename='test_reverse.yml')
Box({'a': {'d': 'e'}, 'a.b': 'c'})
>>> box.Box.from_yaml(filename='test_reverse.yml',box_dots=True,default_box=True)
Box({'a': {'d': 'e', 'b': 'c'}})
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.