Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
trallnag opened this issue Oct 31, 2020 · 3 comments
Closed

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

trallnag opened this issue Oct 31, 2020 · 3 comments

Comments

@trallnag
Copy link

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
Copy link

myusko commented Dec 1, 2020

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

@cdgriffith
Copy link
Owner

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
Copy link
Owner

Just noticed this was still open, is actually a dup of #161 and was added in 6.0!

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

No branches or pull requests

3 participants