cdgriffith / Box

Python dictionaries with advanced dot notation access
https://github.com/cdgriffith/Box/wiki
MIT License
2.61k stars 106 forks source link

Add box_namespace to track nested Box names #240

Closed JacobHayes closed 1 year ago

JacobHayes commented 1 year ago

I'd like to track the "namespace" of nested boxes, which is hard to do in a subclass because of the (necessary) recursive conversions during __init__ and other actions. To handle this, I added a new box_namespace parameter, which is tracked in _box_config, to allow propagating and extending the namespace as we create nested boxes.

Closes #226


This recreates https://github.com/cdgriffith/Box/pull/227 after the develop branch was replaced. I updated it to avoid creating an intermediate box config when not needed (as per https://github.com/cdgriffith/Box/pull/227#discussion_r946289689). There were two open questions on how to label elements of lists and whether to add a box_history accessor, but I'd be fine 1: punting for now and 2: just accessing the config.

JacobHayes commented 1 year ago

Pushed a fix for None keys and the dup imports!