Skip to content

Commit 277be88

Browse files
committed
Prepare for release of version 0.5.0 [skip ci].
1 parent f617ad8 commit 277be88

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Python JSONPath Change Log
22

3-
## Version 0.5.0 (unreleased)
3+
## Version 0.5.0
44

55
**Features**
66

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ This is a list of things that you might find in other JSONPath implementation th
280280

281281
And this is a list of areas where we deviate from the [IETF JSONPath draft](https://datatracker.ietf.org/doc/html/draft-ietf-jsonpath-base-11).
282282

283-
- We don't require filters that use a function extension to include a comparison operator.
283+
- We don't yet follow all "non-singular query" rules when evaluating a filter comparison.
284+
- We don't yet force the result of some filter functions to be compared.
284285
- Whitespace is mostly insignificant unless inside quotes.
285286
- The root token (default `$`) is optional.
286287
- Paths starting with a dot (`.`) are OK. `.thing` is the same as `$.thing`, as is `thing`, `$[thing]` and `$["thing"]`.

docs/exceptions.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Exceptions
22

3+
TODO: mention accessing the token and position
4+
35
::: jsonpath.JSONPathError

docs/index.md

+13
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ with open("some.json") as fd:
9999
print(products)
100100
```
101101

102+
You could use Python JSONPath on data read from a YAML formatted file too, or any data format that can be loaded into dictionaries and lists. If you have [PyYAML](https://pyyaml.org/wiki/PyYAML) installed:
103+
104+
```python
105+
import jsonpath
106+
import yaml
107+
108+
with open("some.yaml") as fd:
109+
data = yaml.safe_load(fd)
110+
111+
products = jsonpath.findall("$..products.*", data)
112+
print(products)
113+
```
114+
102115
## Next Steps
103116

104117
Have a read through the [Quick Start](quickstart.md) and [High Level API Reference](api.md), or the default [JSONPath Syntax](syntax.md) supported by Python JSONPath.

jsonpath/path.py

-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ def findall(
7676
an incompatible way.
7777
"""
7878
if isinstance(data, str):
79-
# TODO: catch JSONDecodeError?
8079
_data = json.loads(data)
8180
elif isinstance(data, TextIO):
8281
_data = json.loads(data.read())
@@ -141,7 +140,6 @@ async def findall_async(
141140
) -> List[object]:
142141
"""An async version of `findall()`."""
143142
if isinstance(data, str):
144-
# TODO: catch JSONDecodeError
145143
_data = json.loads(data)
146144
elif isinstance(data, TextIO):
147145
_data = json.loads(data.read())

tests/compliance.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@ class Case:
3737
SKIP = {
3838
"no leading whitespace": "flexible whitespace policy",
3939
"no trailing whitespace": "flexible whitespace policy",
40+
"bald descendant segment": "alost has a consensus",
41+
"name selector, double quotes, invalid escaped single quote": "TODO",
42+
"name selector, double quotes, incomplete escape": "TODO",
43+
"name selector, single quotes, invalid escaped double quote": "TODO",
44+
"name selector, single quotes, incomplete escape": "TODO",
45+
"index selector, leading 0": "TODO",
46+
"index selector, leading -0": "TODO",
47+
"filter, non-singular query in comparison, slice": "TODO",
48+
"filter, non-singular query in comparison, all children": "TODO",
49+
"filter, non-singular query in comparison, descendants": "TODO",
50+
"filter, non-singular query in comparison, combined": "TODO",
51+
"filter, length function, result must be compared": "TODO",
52+
"filter, count function, non-array/string arg": "TODO",
53+
"filter, count function, result must be compared": "TODO",
54+
"filter, match function, result cannot be compared": "TODO",
55+
"filter, search function, result cannot be compared": "TODO",
56+
"filter, value function, result must be compared": "TODO",
4057
}
4158

4259

@@ -86,6 +103,3 @@ def test_invalid_selectors(case: Case) -> None:
86103

87104
with pytest.raises(jsonpath.JSONPathError):
88105
jsonpath.compile(case.selector)
89-
90-
91-
# TODO: async invalid cases

0 commit comments

Comments
 (0)