[Bug] Camel killer box and box dots gives unexpected behaviour
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 30/100
Research direction
Start by reproducing the five accesses shown with Box({"someKey": ["a"]}, camel_killer_box=True, box_dots=True), comparing the results for snake_case, camelCase, and capitalized keys. Determine the intended behavior for each lookup, then add regression coverage for the agreed behavior and verify the inconsistent BoxKeyError case is resolved.
Written by the indexing model from the issue text.
Description
Hello! Thank you for this awesome package. The combination of camel killer box and box dots does exactly what I'm looking for. Well, almost - there's a couple of behaviours that are not working quite as I expected. I'm not sure how many of these are bugs or just my expectations are wrong but hopefully you can explain!
from box import Box
b = Box({"someKey": ["a"]}, camel_killer_box=True, box_dots=True)
b["some_key"]
# works as expected: BoxList(['a'])
b["some_key[0]"]
# works as expected: 'a'
b["someKey"]
# works but I don't know if it should? From the docs it sounds like the original camel-case
# version should have been destroyed completely, but this gives BoxList(['a'])
b["someKey[0]"]
# raises BoxKeyError - not sure whether this should work, but given that just "someKey" worked above
# it feels inconsistent at any rate
b["SomeKey"]
# works but I wouldn't expect it to! Is this meant to work?
- Dominant language
- Python
- Stars
- 2.8k
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cdgriffith/Box
-
subclass of `Box` does not unpickle correctlyPossibly taken @koriyoshi2041 claimed this 128 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
cdgriffith/Box#308 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
cdgriffith/Box#307 · 1 comment ·
-
Dotted keys read from YAML are lost with box_dots / default_boxPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 48/100
cdgriffith/Box#305 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
cdgriffith/Box#298 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
cdgriffith/Box#296 · 1 reaction ·
Similar issues
-
enhancement P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Toloka/tolokaforge#1776 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
TencentCloud/Octop#1622 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Rust: `const _` gets its file's node ID, so the file node is relabelled `_` and gains a self-loopOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Graphify-Labs/graphify#4064 · 1 comment ·
Maintainers usually reply within 2 days