Skip to content

Commit

Permalink
fix: Use 'paths(scalars)' as 'leaf_paths' filter is deprecated (#99)
Browse files Browse the repository at this point in the history
* 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 69aadb9 commit 50dbc21
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>=1.0.0,<1.6.0", # FIXME c.f. https://github.com/yadage/packtivity/issues/96
"jq>=1.0.0",
"yadage-schemas",
"mock",
"checksumdir",
Expand Down

0 comments on commit 50dbc21

Please sign in to comment.