python-jsonpath
Advanced tools
| # SPDX-FileCopyrightText: 2023-present James Prior <jamesgr.prior@gmail.com> | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
| __version__ = "1.3.0" | ||
| __version__ = "1.3.1" |
@@ -33,3 +33,3 @@ """Filter expression nodes.""" | ||
| # ruff: noqa: D102 | ||
| # ruff: noqa: D102, PLW1641 | ||
@@ -36,0 +36,0 @@ |
| """Class-based function extension base.""" | ||
| import inspect | ||
@@ -29,3 +30,3 @@ from typing import TYPE_CHECKING | ||
| # Keyword only params are not supported | ||
| if len([p for p in params if p.kind in (p.KEYWORD_ONLY, p.VAR_KEYWORD)]): | ||
| if [p for p in params if p.kind in (p.KEYWORD_ONLY, p.VAR_KEYWORD)]: | ||
| raise JSONPathTypeError( | ||
@@ -32,0 +33,0 @@ f"function {token.value!r} requires keyword arguments", |
@@ -77,3 +77,3 @@ """JSON Patch, as per RFC 6902.""" | ||
| elif isinstance(parent, MutableMapping): | ||
| parent[target] = self.value | ||
| parent[str(target)] = self.value | ||
| else: | ||
@@ -128,3 +128,3 @@ raise JSONPatchError( | ||
| This is like _OpAdd_, but assumes an index of "-" if the path can not | ||
| be resolved. | ||
| be resolved rather than raising a JSONPatchError. | ||
@@ -188,3 +188,3 @@ **New in version 1.2.0** | ||
| raise JSONPatchError("can't remove nonexistent property") | ||
| del parent[self.path.parts[-1]] | ||
| del parent[str(self.path.parts[-1])] | ||
| else: | ||
@@ -227,3 +227,3 @@ raise JSONPatchError( | ||
| raise JSONPatchError("can't replace nonexistent property") | ||
| parent[self.path.parts[-1]] = self.value | ||
| parent[str(self.path.parts[-1])] = self.value | ||
| else: | ||
@@ -266,3 +266,3 @@ raise JSONPatchError( | ||
| if isinstance(source_parent, MutableMapping): | ||
| del source_parent[self.source.parts[-1]] | ||
| del source_parent[str(self.source.parts[-1])] | ||
@@ -278,3 +278,3 @@ dest_parent, _ = self.dest.resolve_parent(data) | ||
| elif isinstance(dest_parent, MutableMapping): | ||
| dest_parent[self.dest.parts[-1]] = source_obj | ||
| dest_parent[str(self.dest.parts[-1])] = source_obj | ||
| else: | ||
@@ -321,3 +321,3 @@ raise JSONPatchError( | ||
| elif isinstance(dest_parent, MutableMapping): | ||
| dest_parent[self.dest.parts[-1]] = copy.deepcopy(source_obj) | ||
| dest_parent[str(self.dest.parts[-1])] = copy.deepcopy(source_obj) | ||
| else: | ||
@@ -429,3 +429,3 @@ raise JSONPatchError( | ||
| elif op == "addap": | ||
| self.addne( | ||
| self.addap( | ||
| path=self._op_pointer(operation, "path", "addap", i), | ||
@@ -432,0 +432,0 @@ value=self._op_value(operation, "value", "addap", i), |
@@ -488,2 +488,5 @@ """JSON Pointer. See https://datatracker.ietf.org/doc/html/rfc6901.""" | ||
| def __hash__(self) -> int: | ||
| return hash((self.origin, self.index, self.pointer)) | ||
| def _parse( | ||
@@ -490,0 +493,0 @@ self, |
+3
-1
| Metadata-Version: 2.4 | ||
| Name: python-jsonpath | ||
| Version: 1.3.0 | ||
| Version: 1.3.1 | ||
| Summary: JSONPath, JSON Pointer and JSON Patch for Python. | ||
@@ -100,2 +100,4 @@ Project-URL: Documentation, https://jg-rp.github.io/python-jsonpath/ | ||
| - [Ruby JSON P3](https://github.com/jg-rp/ruby-json-p3) - RFC 9535, RFC 6901 and RFC 6902 implemented in Ruby. | ||
| ## Examples | ||
@@ -102,0 +104,0 @@ |
+2
-0
@@ -75,2 +75,4 @@ <h1 align="center">Python JSONPath</h1> | ||
| - [Ruby JSON P3](https://github.com/jg-rp/ruby-json-p3) - RFC 9535, RFC 6901 and RFC 6902 implemented in Ruby. | ||
| ## Examples | ||
@@ -77,0 +79,0 @@ |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
237788
0.16%5442
0.04%