jsonpatch 1.43__py3-none-any.whl → 1.44__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jsonpatch-1.43.dist-info → jsonpatch-1.44.dist-info}/METADATA +1 -1
- jsonpatch-1.44.dist-info/RECORD +10 -0
- jsonpatch-stubs/__init__.pyi +6 -5
- jsonpatch.py +9 -4
- jsonpatch-1.43.dist-info/RECORD +0 -10
- {jsonpatch-1.43.dist-info → jsonpatch-1.44.dist-info}/WHEEL +0 -0
- {jsonpatch-1.43.dist-info → jsonpatch-1.44.dist-info}/entry_points.txt +0 -0
- {jsonpatch-1.43.dist-info → jsonpatch-1.44.dist-info}/licenses/AUTHORS +0 -0
- {jsonpatch-1.43.dist-info → jsonpatch-1.44.dist-info}/licenses/LICENSE +0 -0
- {jsonpatch-1.43.dist-info → jsonpatch-1.44.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
jsonpatch.py,sha256=4fsloqOO4Bjt2r8KIxdugLC0KYQyrXz3cPeQ2aLPCPU,58897
|
|
2
|
+
jsonpatch_cli.py,sha256=Vavn3OY4KrowXNTRDbgsNPcd9vTGLkIgz0Hr6Uwr5mk,6480
|
|
3
|
+
jsonpatch-1.44.dist-info/licenses/AUTHORS,sha256=hOtEnBGbfDegKjzMDEl5vuVJyczbI2PlYE2ho4LjGNQ,140
|
|
4
|
+
jsonpatch-1.44.dist-info/licenses/LICENSE,sha256=Q5PrZzP6HjZ_QXabOC9PG-e_Da6x4kPtkrP12Lr9I28,1481
|
|
5
|
+
jsonpatch-stubs/__init__.pyi,sha256=5fzpfmr8rAGOlRRwToKtdu7lIh1QMpxql5eEBs1KRKc,5357
|
|
6
|
+
jsonpatch-1.44.dist-info/METADATA,sha256=C2rxMRGT34fBQuy9TzisMaZEQ6rT5d4td4Eofve9q4g,4287
|
|
7
|
+
jsonpatch-1.44.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
8
|
+
jsonpatch-1.44.dist-info/entry_points.txt,sha256=aY9ormBVRZHHDaAeMcdqTBwZ-ax7GvBTSQ33I75xtZM,98
|
|
9
|
+
jsonpatch-1.44.dist-info/top_level.txt,sha256=AGmziZtf5TSFAtbhYlhDGjQg1POmwzF9HwLdbzPkoio,40
|
|
10
|
+
jsonpatch-1.44.dist-info/RECORD,,
|
jsonpatch-stubs/__init__.pyi
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
# also accepts arbitrary Mapping / Sequence types, which a recursive JSON type
|
|
10
10
|
# would reject.
|
|
11
11
|
|
|
12
|
-
from collections.abc import Callable, Iterable, Iterator, Mapping
|
|
12
|
+
from collections.abc import Callable, Iterable, Iterator, Mapping
|
|
13
|
+
from types import MappingProxyType
|
|
13
14
|
from typing import Any, ClassVar
|
|
14
15
|
|
|
15
16
|
# Re-exported, as jsonpatch.py imports them and users rely on that, e.g. to
|
|
@@ -57,7 +58,7 @@ class PatchOperation:
|
|
|
57
58
|
pointer_cls: type[JsonPointer]
|
|
58
59
|
location: str
|
|
59
60
|
pointer: JsonPointer
|
|
60
|
-
operation:
|
|
61
|
+
operation: dict[str, Any]
|
|
61
62
|
def __init__(self, operation: _Operation, pointer_cls: type[JsonPointer] = ...) -> None: ...
|
|
62
63
|
def apply(self, obj: Any) -> Any: ...
|
|
63
64
|
def __hash__(self) -> int: ...
|
|
@@ -92,12 +93,12 @@ class CopyOperation(PatchOperation): ...
|
|
|
92
93
|
class JsonPatch:
|
|
93
94
|
json_dumper: ClassVar[Callable[..., str]]
|
|
94
95
|
json_loader: ClassVar[Callable[..., Any]]
|
|
95
|
-
operations: ClassVar[
|
|
96
|
+
operations: ClassVar[MappingProxyType[str, type[PatchOperation]]]
|
|
96
97
|
pointer_cls: type[JsonPointer]
|
|
97
|
-
patch:
|
|
98
|
+
patch: list[dict[str, Any]]
|
|
98
99
|
def __init__(self, patch: Iterable[_Operation], pointer_cls: type[JsonPointer] = ...) -> None: ...
|
|
99
100
|
def __bool__(self) -> bool: ...
|
|
100
|
-
def __iter__(self) -> Iterator[
|
|
101
|
+
def __iter__(self) -> Iterator[dict[str, Any]]: ...
|
|
101
102
|
def __hash__(self) -> int: ...
|
|
102
103
|
def __eq__(self, other: object) -> bool: ...
|
|
103
104
|
def __ne__(self, other: object) -> bool: ...
|
jsonpatch.py
CHANGED
|
@@ -55,7 +55,7 @@ _EXACT_MATCH_LIMIT = 500 ** 2
|
|
|
55
55
|
|
|
56
56
|
# Will be parsed by setup.py to determine package metadata
|
|
57
57
|
__author__ = 'Stefan Kögl <stefan@skoegl.net>'
|
|
58
|
-
__version__ = '1.
|
|
58
|
+
__version__ = '1.44'
|
|
59
59
|
__website__ = 'https://github.com/stefankoegl/python-json-patch'
|
|
60
60
|
__license__ = 'BSD-3-Clause'
|
|
61
61
|
|
|
@@ -373,7 +373,8 @@ class PatchOperation(object):
|
|
|
373
373
|
except TypeError:
|
|
374
374
|
raise InvalidJsonPatch("Invalid 'path'", op=operation)
|
|
375
375
|
|
|
376
|
-
|
|
376
|
+
# Setters update operation members, even when the input is read-only.
|
|
377
|
+
self.operation = operation if isinstance(operation, dict) else dict(operation)
|
|
377
378
|
|
|
378
379
|
def _from_pointer(self):
|
|
379
380
|
"""Builds the pointer of the 'from' member like __init__ builds the
|
|
@@ -791,7 +792,7 @@ class JsonPatch(object):
|
|
|
791
792
|
if isinstance(patch, (str, bytes, Mapping)):
|
|
792
793
|
raise InvalidJsonPatch("Document is expected to be sequence of operations")
|
|
793
794
|
try:
|
|
794
|
-
self.patch =
|
|
795
|
+
self.patch = list(patch)
|
|
795
796
|
except TypeError:
|
|
796
797
|
raise InvalidJsonPatch("Document is expected to be sequence of operations")
|
|
797
798
|
|
|
@@ -799,7 +800,7 @@ class JsonPatch(object):
|
|
|
799
800
|
# is correct by retrieving each patch element.
|
|
800
801
|
# Much of the validation is done in the initializer
|
|
801
802
|
# though some is delayed until the patch is applied.
|
|
802
|
-
for op in self.patch:
|
|
803
|
+
for index, op in enumerate(self.patch):
|
|
803
804
|
# We're only checking for strings in the following check
|
|
804
805
|
# for two reasons:
|
|
805
806
|
#
|
|
@@ -815,6 +816,10 @@ class JsonPatch(object):
|
|
|
815
816
|
op=op)
|
|
816
817
|
|
|
817
818
|
self._get_operation(op)
|
|
819
|
+
# Keep validation errors tied to the original input, but expose
|
|
820
|
+
# concrete, JSON-serializable operation dictionaries on success.
|
|
821
|
+
if not isinstance(op, dict):
|
|
822
|
+
self.patch[index] = dict(op)
|
|
818
823
|
|
|
819
824
|
def __str__(self):
|
|
820
825
|
"""str(self) -> self.to_string()"""
|
jsonpatch-1.43.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
jsonpatch.py,sha256=zvcCUHmwJlvO-N6Us1x9MbFr3yDlAIDwQ9UI9naakRY,58552
|
|
2
|
-
jsonpatch_cli.py,sha256=Vavn3OY4KrowXNTRDbgsNPcd9vTGLkIgz0Hr6Uwr5mk,6480
|
|
3
|
-
jsonpatch-1.43.dist-info/licenses/AUTHORS,sha256=hOtEnBGbfDegKjzMDEl5vuVJyczbI2PlYE2ho4LjGNQ,140
|
|
4
|
-
jsonpatch-1.43.dist-info/licenses/LICENSE,sha256=Q5PrZzP6HjZ_QXabOC9PG-e_Da6x4kPtkrP12Lr9I28,1481
|
|
5
|
-
jsonpatch-stubs/__init__.pyi,sha256=6J9-1EYqLQBCCAuEI7nhIP_DW5zpm3zRWdGMlnFWAqo,5315
|
|
6
|
-
jsonpatch-1.43.dist-info/METADATA,sha256=aP_SW3YwB4xYnasRgvkYbflg12ztJBxX9BQ5VmHH5Ck,4287
|
|
7
|
-
jsonpatch-1.43.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
8
|
-
jsonpatch-1.43.dist-info/entry_points.txt,sha256=aY9ormBVRZHHDaAeMcdqTBwZ-ax7GvBTSQ33I75xtZM,98
|
|
9
|
-
jsonpatch-1.43.dist-info/top_level.txt,sha256=AGmziZtf5TSFAtbhYlhDGjQg1POmwzF9HwLdbzPkoio,40
|
|
10
|
-
jsonpatch-1.43.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|