Box icon indicating copy to clipboard operation
Box copied to clipboard

box_dots notation support for get() and set()

Open trallnag opened this issue 5 years ago • 2 comments

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.

trallnag avatar Oct 31 '20 14:10 trallnag

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

myusko avatar Dec 01 '20 09:12 myusko

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 avatar Dec 01 '20 15:12 cdgriffith

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

cdgriffith avatar Jan 28 '23 03:01 cdgriffith