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

Wildcard support for renaming #113

Open
milhauzindahauz opened this issue Sep 12, 2022 · 9 comments · May be fixed by #236
Open

Wildcard support for renaming #113

milhauzindahauz opened this issue Sep 12, 2022 · 9 comments · May be fixed by #236
Assignees
Labels
enhancement New feature or request

Comments

@milhauzindahauz
Copy link

milhauzindahauz commented Sep 12, 2022

Desired functionality as following:

d = {
"a": [
  {
    "x": 1,
    "y": 1,
  },
  {
    "x": 2,
    "y": 2,
  },
  ]
}
b = benedict(d)
b.rename("a[*].x", "a[*].m")
Fund with Polar
@milhauzindahauz
Copy link
Author

Hi @fabiocaccamo,

I want to use the module in my workflow. The benedict class has a lot of features but wildcard support for moving/renaming is missing. I checked the docs and usage of wildcard is possible in match method. So I made it working in #114.

I am not sure if I covered all use cases in tests. And I am not sure if this functionality is even desired.

Cheers.

@fabiocaccamo
Copy link
Owner

@milhauzindahauz thank you for the enhancement proposal and the PR. I will review the PR as soon as possible.

@milhauzindahauz
Copy link
Author

@fabiocaccamo
what behaiviour should be expected with keypath = "a[*]"?

@fabiocaccamo
Copy link
Owner

@milhauzindahauz could you be more specific about the context?

@milhauzindahauz
Copy link
Author

@fabiocaccamo check this out

d = {
    "a": [
        {"x": 1, "y": 1},
        {"x": 2, "y": 2},
    ],
    "x": [
        {"a": 10, "b": 10},
        {"a": 11, "b": 11},
    ],
}
b = benedict(d)
b.get("a[1]")

# should it be 
b.get("a") == b.get("a[*]")
# or
try:
    b.get("a[*]")
except KeypathError:
    pass

@fabiocaccamo
Copy link
Owner

@milhauzindahauz it should be b.get("a") == b.get("a[*]"), no doubts.

@fabiocaccamo
Copy link
Owner

@milhauzindahauz any update? I would like to publish a new release in the next days and it would be great having also this feature released.

@milhauzindahauz
Copy link
Author

@fabiocaccamo I have had a little time for this for last week. There are few points from the last review I need to solve. I am not sure if I made to the release.

@fabiocaccamo
Copy link
Owner

@milhauzindahauz no problem, the release can wait.
Thank you very much for the quick feedback.

@fabiocaccamo fabiocaccamo moved this to In Progress in Open Source Dec 1, 2022
@fabiocaccamo fabiocaccamo moved this from In Progress to Todo in Open Source Jun 2, 2023
@fabiocaccamo fabiocaccamo linked a pull request Mar 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants