Add handy shortcut to match string path#25
Merged
dmlb2000 merged 5 commits intopacifica:masterfrom Jun 9, 2019
Merged
Conversation
Member
|
@dangra I think the thought behind this is fine, please make sure the pipeline passes. |
Member
|
@dangra can you make a test to cover the code? either add the call to or make another method and call your match function? |
Contributor
Author
|
Yes, I will once I have a free minute in front of the keyboard. Wait for it
this week. Thanks for the heads up
…On Sun, Jun 9, 2019, 00:00 David Brown ***@***.***> wrote:
@dangra <https://github.com/dangra> can you make a test to cover the
code? either add the call to
https://github.com/pacifica/python-jsonpath2/blob/2d74af236c86b51256d5f4d8686183ebcf33252e/jsonpath2/test/jsonpath2_test.py#L712
or make another method and call your match function?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#25?email_source=notifications&email_token=AAAJD6K2CDEJF7YISXSKJETPZRW4JA5CNFSM4HTOSHYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXICOWA#issuecomment-500180824>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAJD6JQFQSKGE2X7XTVF4TPZRW4JANCNFSM4HTOSHYA>
.
|
Member
|
@dangra Forgot to add a bit to the README to document the new method. Could you add that? |
This change aims to avoid the boilerplate of applying a JsonPath to a document
```python
>>> import jsonpath2 as jsonpath
>>> doc = {'hello': 'Hello, world!'}
>>> [m.current_value for m in jsonpath.match('$["hello"]', doc)]
```
It resembles the use of `re` module in `re.match(pattern, string)` vs `re.compile(pattern).match(string)`
Contributor
Author
|
@dmlb2000 I think I broke your accepted review by force pushing a rebase to cleanup commit history. Feel free to review again and merge. thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[WIP] Opened to measure acceptance by maintainers.
Tests and docs will be updated once API is agreed (if any)
Description
This change aims to avoid the boilerplate of applying a JsonPath to a document
It resembles the use of
remodule inre.match(pattern, string)vsre.compile(pattern).match(string)Issues Resolved
None.
Check List