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

List wildcard #114

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
98f1bf6
add wildcard for rename
milhauzindahauz Sep 12, 2022
d69450a
wildcard
milhauzindahauz Sep 12, 2022
4f8e893
wildcard
milhauzindahauz Sep 13, 2022
7e26ee2
wildcard
milhauzindahauz Sep 13, 2022
6987943
wildcard
milhauzindahauz Sep 13, 2022
c85c1a4
wildcard
milhauzindahauz Sep 13, 2022
baf4f70
wildcard
milhauzindahauz Sep 13, 2022
9eba3fc
wildcard
milhauzindahauz Sep 13, 2022
95e3ee8
wildcard
milhauzindahauz Sep 13, 2022
48070d3
fix typos
milhauzindahauz Sep 14, 2022
1c7da03
wildcard
milhauzindahauz Sep 14, 2022
6dfff10
wildcard
milhauzindahauz Sep 14, 2022
4de87dd
wildcard
milhauzindahauz Sep 14, 2022
df926ca
wildcard
milhauzindahauz Sep 14, 2022
409d742
wildcard
milhauzindahauz Sep 15, 2022
38931d6
wildcard
milhauzindahauz Sep 15, 2022
b34a803
wildcard
milhauzindahauz Sep 15, 2022
ec6caac
wildcard
milhauzindahauz Sep 15, 2022
64e355e
wildcard
milhauzindahauz Sep 15, 2022
87b87b1
wildcard
milhauzindahauz Sep 15, 2022
07bdb1b
wildcard
milhauzindahauz Sep 15, 2022
f7401eb
wildcard
milhauzindahauz Sep 15, 2022
a631b9a
wildcard
milhauzindahauz Sep 15, 2022
750b78f
wildcard
milhauzindahauz Sep 15, 2022
9e136ea
wildcard
milhauzindahauz Sep 22, 2022
1142a4b
wildcard
milhauzindahauz Sep 22, 2022
417f0a0
wildcard
milhauzindahauz Sep 22, 2022
bda6ceb
wildcard
milhauzindahauz Sep 23, 2022
87f918a
wildcard
milhauzindahauz Oct 18, 2022
d2f1446
wildcard
milhauzindahauz Oct 18, 2022
cc5b7fa
wildcard
milhauzindahauz Oct 18, 2022
f910abb
wildcard
milhauzindahauz Oct 18, 2022
273e674
wildcard
milhauzindahauz Oct 18, 2022
1fb37fd
wildcard
milhauzindahauz Oct 18, 2022
747f27d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 18, 2022
5cd2d6a
wildcard
milhauzindahauz Oct 18, 2022
06029f7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 18, 2022
6e70434
wildcard
milhauzindahauz Oct 18, 2022
d09b79e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 18, 2022
30e9f07
wildcard
milhauzindahauz Oct 18, 2022
4bb0b04
wildcard
milhauzindahauz Oct 18, 2022
6f610ec
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 18, 2022
bd0d7fd
wildcard
milhauzindahauz Oct 18, 2022
17edc65
wildcard
milhauzindahauz Oct 18, 2022
1db0e6c
wildcard
milhauzindahauz Oct 18, 2022
53331f2
wildcard
milhauzindahauz Oct 18, 2022
a94bf27
wildcard
milhauzindahauz Oct 19, 2022
6f8487a
wildcard
milhauzindahauz Oct 19, 2022
f54e3d0
wildcard
milhauzindahauz Oct 19, 2022
9d5560b
wildcard
milhauzindahauz Oct 20, 2022
7ac667c
.gitignore - add folder for JB IDEs
milhauzindahauz Oct 27, 2022
6788e78
Merge branch 'master' into list-wildcard
milhauzindahauz Oct 30, 2022
71d23c0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 30, 2022
8842f01
wildcard
milhauzindahauz Nov 7, 2022
a43563d
wildcard
milhauzindahauz Nov 7, 2022
fa32b00
wildcard
milhauzindahauz Nov 7, 2022
b928196
wildcard
milhauzindahauz Nov 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benedict/dicts/keylist/keylist_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __getitem__(self, key):

def _getitem_by_keys(self, keys):
parent, key, _ = keylist_util.get_item(self, keys)
if type_util.is_list_of_dicts(parent):
if type_util.is_list_of_dicts(parent) and any(type_util.is_wildcard(_key) for _key in keys):
milhauzindahauz marked this conversation as resolved.
Show resolved Hide resolved
return [item.get(key) for item in parent]
if type_util.is_dict_or_list_or_tuple(parent):
milhauzindahauz marked this conversation as resolved.
Show resolved Hide resolved
return parent[key]
Expand Down
2 changes: 1 addition & 1 deletion tests/dicts/keypath/test_keypath_dict_list_wildcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ def setUp(self):
)

def test_correct_wildcard(self):
correct_wildcard_path_example = "a[*]"
correct_wildcard_path_example = "a[*].x"
self.assertEqual(self.blueprint[correct_wildcard_path_example], [1, 2])
milhauzindahauz marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion tests/dicts/test_benedict_wildcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_rename_wildcard(self):
self.assertEqual(b, result)

def test_swap_wildcard(self):
self.d = {
d = {
"a": [
{"x": 1, "y": 1},
{"x": 2, "y": 2},
Expand Down