Skip to content

Commit

Permalink
fix(backport): Use 'paths(scalars)' as 'leaf_paths' filter is depreca…
Browse files Browse the repository at this point in the history
…ted (#101)

* Backport PR #99
* The 'leaf_paths' filter has been deprecated for 9 years and was removed in jqlang v1.7 (jq v1.6) so use the 'paths(scalars)' filter.
   - c.f. jqlang/jq#2666
   - c.f. jqlang/jq#426
* Remove upper bound on jq version
   - Reverts #97
  • Loading branch information
matthewfeickert authored Sep 19, 2023
1 parent b5bd630 commit 333167c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packtivity/datamodels/purejson.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def leafs(self):
else:
ptrs = [
jsonpointer.JsonPointer.from_parts(parts)
for parts in self.jq("leaf_paths", multiple_output=True).typed()
for parts in self.jq("paths(scalars)", multiple_output=True).typed()
]
for p in ptrs:
yield p, p.get(self.typed())
Expand Down
2 changes: 1 addition & 1 deletion packtivity/typedleafs.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def leafs(self):
else:
ptrs = [
jsonpointer.JsonPointer.from_parts(parts)
for parts in self.jq("leaf_paths", multiple_output=True).typed()
for parts in self.jq("paths(scalars)", multiple_output=True).typed()
]
for p in ptrs:
yield p, p.get(self.typed())
2 changes: 1 addition & 1 deletion packtivity/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def leaf_iterator(jsonable):
if not isinstance(jsonable, (list, dict)):
yield jsonpointer.JsonPointer(""), jsonable
else:
allleafs = jq.jq("leaf_paths").transform(jsonable, multiple_output=True)
allleafs = jq.jq("paths(scalars)").transform(jsonable, multiple_output=True)
leafpointers = [jsonpointer.JsonPointer.from_parts(x) for x in allleafs]
for x in leafpointers:
yield x, x.get(jsonable)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"glob2",
"jsonpointer",
"jsonpath-rw",
"jq",
"jq>=1.0.0",
"yadage-schemas",
"mock",
"checksumdir",
Expand Down

0 comments on commit 333167c

Please sign in to comment.