cdgriffith / Box

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

box_dots notation support for get() and set() #176

Closed trallnag closed 1 year ago

trallnag commented 4 years ago
from box import Box

box = Box({"logging": {"level": "INFO", "structured": True}}, box_dots=True)
assert box.logging.level == "INFO"
assert box["logging.level"] == "INFO"
assert box.get("logging.level") == "INFO"
assert box.get("logging.level", None) == "INFO"

The last two asserts fail. I think it would make sense to support the notation in the get and set methods as well.

myusko commented 3 years ago

@cdgriffith Someone is working on the issue? otherwise I can take a look.

cdgriffith commented 3 years ago

Looks like someone tried to do something about it a long time ago, but I never got around to actually working on it or testing it https://github.com/cdgriffith/Box/tree/bugfix/dots_get

Please feel free to work on it @myusko!

cdgriffith commented 1 year ago

Just noticed this was still open, is actually a dup of https://github.com/cdgriffith/Box/issues/161 and was added in 6.0!