Skip to content

Dotted keys read from YAML are lost with box_dots / default_box #305

Description

@ipspace

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'}})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions