deepdiff-rust 0.1.0__tar.gz → 0.1.1__tar.gz
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.
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/Cargo.lock +2 -2
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/Cargo.toml +1 -1
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/PKG-INFO +6 -6
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/README.md +5 -5
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-python/src/deepdiff.rs +0 -2
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/pyproject.toml +1 -1
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/__init__.pyi +5 -14
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/_callbacks.py +1 -4
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/_diff.py +6 -23
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/_dual.py +1 -1
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/_group_by.py +1 -3
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/_options.py +1 -5
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/_paths.py +1 -12
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/_view.py +6 -14
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/LICENSE +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/LICENSE-ONIX +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/Cargo.toml +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/examples/stack_frame_cost.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/datetime.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/datetime_tests.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/diff/array.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/diff/dispatch.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/diff/mod.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/diff/object.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/diff/options.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/diff/scalar.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/diff/set.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/diff/tests.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/error.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/ignore_order/distance.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/ignore_order/fxhash.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/ignore_order/hash.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/ignore_order/memo.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/ignore_order/mod.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/ignore_order/pairing.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/ignore_order/tests.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/lcs.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/lcs_tests.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/leaf.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/leaf_tests.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/lib.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/normalize.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/path.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/report.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/report_tests.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/test_support.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/unified_diff.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/unified_diff_tests.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/value.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/value_tests.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/tests/golden.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/tests/ignore_order_memory.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/tests/memory_footprint.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/tests/proptest_diff.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/tests/proptest_ignore_order.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-python/Cargo.toml +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-python/src/convert.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-python/src/errors.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-python/src/fast_path.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-python/src/guard.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-python/src/lib.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-python/src/verbose.rs +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/__init__.py +0 -0
- {deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/python/deepdiff_rust/py.typed +0 -0
|
@@ -103,7 +103,7 @@ dependencies = [
|
|
|
103
103
|
|
|
104
104
|
[[package]]
|
|
105
105
|
name = "deepdiff-core"
|
|
106
|
-
version = "0.1.
|
|
106
|
+
version = "0.1.1"
|
|
107
107
|
dependencies = [
|
|
108
108
|
"num-bigint",
|
|
109
109
|
"num-traits",
|
|
@@ -116,7 +116,7 @@ dependencies = [
|
|
|
116
116
|
|
|
117
117
|
[[package]]
|
|
118
118
|
name = "deepdiff-python"
|
|
119
|
-
version = "0.1.
|
|
119
|
+
version = "0.1.1"
|
|
120
120
|
dependencies = [
|
|
121
121
|
"deepdiff-core",
|
|
122
122
|
"num-bigint",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepdiff-rust
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -55,7 +55,7 @@ print(DeepDiff({"a": 1, "b": [1, 2]}, {"a": 2, "b": [1, 3]}))
|
|
|
55
55
|
From a local wheel (Windows / manylinux x86_64 abi3):
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
pip install --force-reinstall --no-deps path/to/deepdiff_rust-0.1.
|
|
58
|
+
pip install --force-reinstall --no-deps path/to/deepdiff_rust-0.1.1-*.whl
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
From source (Rust toolchain + Maturin):
|
|
@@ -157,7 +157,7 @@ value; maturin authenticates as user `__token__`.
|
|
|
157
157
|
3. Install and smoke-test:
|
|
158
158
|
|
|
159
159
|
```bash
|
|
160
|
-
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ deepdiff-rust==0.1.
|
|
160
|
+
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ deepdiff-rust==0.1.1
|
|
161
161
|
python -c "from deepdiff_rust import DeepDiff; print(DeepDiff({'a':1},{'a':2}))"
|
|
162
162
|
```
|
|
163
163
|
|
|
@@ -166,12 +166,12 @@ python -c "from deepdiff_rust import DeepDiff; print(DeepDiff({'a':1},{'a':2}))"
|
|
|
166
166
|
### Production release
|
|
167
167
|
|
|
168
168
|
1. Version in `pyproject.toml` and `[workspace.package]` must match the tag
|
|
169
|
-
without the leading `v` (e.g. `0.1.
|
|
169
|
+
without the leading `v` (e.g. `0.1.1` ↔ `v0.1.1`).
|
|
170
170
|
2. Push the tag (or run the workflow with target `pypi`):
|
|
171
171
|
|
|
172
172
|
```bash
|
|
173
|
-
git tag v0.1.
|
|
174
|
-
git push origin v0.1.
|
|
173
|
+
git tag v0.1.1
|
|
174
|
+
git push origin v0.1.1
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
3. After the job finishes: `pip install deepdiff-rust`.
|
|
@@ -21,7 +21,7 @@ print(DeepDiff({"a": 1, "b": [1, 2]}, {"a": 2, "b": [1, 3]}))
|
|
|
21
21
|
From a local wheel (Windows / manylinux x86_64 abi3):
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
pip install --force-reinstall --no-deps path/to/deepdiff_rust-0.1.
|
|
24
|
+
pip install --force-reinstall --no-deps path/to/deepdiff_rust-0.1.1-*.whl
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
From source (Rust toolchain + Maturin):
|
|
@@ -123,7 +123,7 @@ value; maturin authenticates as user `__token__`.
|
|
|
123
123
|
3. Install and smoke-test:
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
|
-
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ deepdiff-rust==0.1.
|
|
126
|
+
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ deepdiff-rust==0.1.1
|
|
127
127
|
python -c "from deepdiff_rust import DeepDiff; print(DeepDiff({'a':1},{'a':2}))"
|
|
128
128
|
```
|
|
129
129
|
|
|
@@ -132,12 +132,12 @@ python -c "from deepdiff_rust import DeepDiff; print(DeepDiff({'a':1},{'a':2}))"
|
|
|
132
132
|
### Production release
|
|
133
133
|
|
|
134
134
|
1. Version in `pyproject.toml` and `[workspace.package]` must match the tag
|
|
135
|
-
without the leading `v` (e.g. `0.1.
|
|
135
|
+
without the leading `v` (e.g. `0.1.1` ↔ `v0.1.1`).
|
|
136
136
|
2. Push the tag (or run the workflow with target `pypi`):
|
|
137
137
|
|
|
138
138
|
```bash
|
|
139
|
-
git tag v0.1.
|
|
140
|
-
git push origin v0.1.
|
|
139
|
+
git tag v0.1.1
|
|
140
|
+
git push origin v0.1.1
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
3. After the job finishes: `pip install deepdiff-rust`.
|
|
@@ -115,8 +115,6 @@ impl DeepDiff {
|
|
|
115
115
|
}
|
|
116
116
|
opts.type_groups = Some(Arc::new(groups));
|
|
117
117
|
}
|
|
118
|
-
// ponytail: filters drop findings after the diff instead of pruning it, so an
|
|
119
|
-
// excluded part still pairs under ignore_order; prune in the core if that matters.
|
|
120
118
|
let excluded = std::mem::take(&mut held.excluded);
|
|
121
119
|
let skip_error = Mutex::new(None);
|
|
122
120
|
let keep = |path: &[PathSegment]| {
|
|
@@ -10,8 +10,6 @@ class MaxDepthError(ValueError):
|
|
|
10
10
|
MAX_DEPTH_CEILING: int
|
|
11
11
|
|
|
12
12
|
class DeepDiff(dict[str, Any]):
|
|
13
|
-
"""A drop-in ``deepdiff.DeepDiff``: the differences between ``t1`` and ``t2`` as a dict."""
|
|
14
|
-
|
|
15
13
|
t1: Any
|
|
16
14
|
t2: Any
|
|
17
15
|
verbose_level: int
|
|
@@ -61,25 +59,19 @@ class DeepDiff(dict[str, Any]):
|
|
|
61
59
|
include_obj_callback_strict: Any | None = ...,
|
|
62
60
|
iterable_compare_func: Any | None = ...,
|
|
63
61
|
) -> None: ...
|
|
64
|
-
def to_dict(self, verbose_level: int | None = ...) -> dict[str, Any]:
|
|
65
|
-
"""The differences as a plain dict, with ``type_changes`` types as type objects."""
|
|
66
|
-
|
|
62
|
+
def to_dict(self, verbose_level: int | None = ...) -> dict[str, Any]: ...
|
|
67
63
|
def to_json(
|
|
68
64
|
self,
|
|
69
65
|
default_mapping: dict[type, Any] | None = ...,
|
|
70
66
|
force_use_builtin_json: bool = ...,
|
|
71
67
|
verbose_level: int | None = ...,
|
|
72
68
|
**kwargs: Any,
|
|
73
|
-
) -> str:
|
|
74
|
-
"""The differences as JSON; extra keyword arguments go to ``json.dumps``."""
|
|
75
|
-
|
|
69
|
+
) -> str: ...
|
|
76
70
|
@property
|
|
77
|
-
def affected_paths(self) -> set[str]:
|
|
78
|
-
"""The paths of every difference in this result."""
|
|
79
|
-
|
|
71
|
+
def affected_paths(self) -> set[str]: ...
|
|
80
72
|
@property
|
|
81
|
-
def affected_root_keys(self) -> set[Any]:
|
|
82
|
-
|
|
73
|
+
def affected_root_keys(self) -> set[Any]: ...
|
|
74
|
+
def pretty(self, prefix: Any = ...) -> str: ...
|
|
83
75
|
|
|
84
76
|
def diff_json(
|
|
85
77
|
a: str,
|
|
@@ -88,4 +80,3 @@ def diff_json(
|
|
|
88
80
|
max_depth: int | None = ...,
|
|
89
81
|
) -> str:
|
|
90
82
|
"""Diffs two JSON documents and returns a ``DeepDiff``-compatible JSON report string (``verbose_level=2`` shape)."""
|
|
91
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Callback helpers: Level and object-callback skip."""
|
|
2
2
|
|
|
3
3
|
from collections.abc import Mapping
|
|
4
4
|
|
|
@@ -6,8 +6,6 @@ from ._paths import _elements
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class Level:
|
|
9
|
-
"""Minimal DeepDiff-compatible level for operators and iterable_compare_func."""
|
|
10
|
-
|
|
11
9
|
__slots__ = ("t1", "t2", "_path")
|
|
12
10
|
|
|
13
11
|
def __init__(self, t1, t2, path="root"):
|
|
@@ -67,7 +65,6 @@ def compose_skip(
|
|
|
67
65
|
include_obj_callback=None,
|
|
68
66
|
include_obj_callback_strict=None,
|
|
69
67
|
):
|
|
70
|
-
"""Retain-filter skip plus DeepDiff object-callback branch of `_skip_this`."""
|
|
71
68
|
if not any(
|
|
72
69
|
(
|
|
73
70
|
exclude_obj_callback,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""DeepDiff result dict, drop-in for deepdiff.DeepDiff."""
|
|
2
2
|
|
|
3
3
|
import ast
|
|
4
4
|
import datetime
|
|
@@ -34,13 +34,10 @@ _NOT_PRESENT = object()
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def _root_key(path):
|
|
37
|
-
"""The key, index or attribute name right after `root` in a rendered path."""
|
|
38
37
|
rest = path[len("root"):]
|
|
39
38
|
if rest.startswith("."):
|
|
40
39
|
ends = [i for i in (rest.find(".", 1), rest.find("[")) if i > 0]
|
|
41
40
|
return rest[1 : min(ends, default=len(rest))]
|
|
42
|
-
# ponytail: tries each "]" until the key parses as a literal; a key whose
|
|
43
|
-
# repr is not a Python literal is skipped.
|
|
44
41
|
end = rest.find("]")
|
|
45
42
|
while end != -1:
|
|
46
43
|
try:
|
|
@@ -51,7 +48,6 @@ def _root_key(path):
|
|
|
51
48
|
|
|
52
49
|
|
|
53
50
|
class DeepDiff(dict):
|
|
54
|
-
"""A drop-in `deepdiff.DeepDiff`: the differences between `t1` and `t2` as a dict."""
|
|
55
51
|
|
|
56
52
|
def __init__(
|
|
57
53
|
self, t1, t2, *, ignore_order=False, max_depth=None, verbose_level=1, view="text",
|
|
@@ -80,7 +76,6 @@ class DeepDiff(dict):
|
|
|
80
76
|
self.t1 = t1
|
|
81
77
|
self.t2 = t2
|
|
82
78
|
self._native = None
|
|
83
|
-
self._bridge = None
|
|
84
79
|
self.tree = {}
|
|
85
80
|
super().__init__()
|
|
86
81
|
return
|
|
@@ -134,7 +129,6 @@ class DeepDiff(dict):
|
|
|
134
129
|
).to_dict(verbose_level)
|
|
135
130
|
)
|
|
136
131
|
self._native = None
|
|
137
|
-
self._bridge = None
|
|
138
132
|
self._finish_init(run_dual(self, t1, t2, native_factory))
|
|
139
133
|
return
|
|
140
134
|
skip = skip_filter(exclude_paths, include_paths, exclude_regex_paths, exclude_types)
|
|
@@ -145,7 +139,6 @@ class DeepDiff(dict):
|
|
|
145
139
|
include_obj_callback=include_obj_callback,
|
|
146
140
|
include_obj_callback_strict=include_obj_callback_strict,
|
|
147
141
|
)
|
|
148
|
-
self._bridge = None
|
|
149
142
|
self._native = _native.DeepDiff(
|
|
150
143
|
t1, t2, ignore_order=ignore_order, max_depth=max_depth, exclude_types=exclude_types,
|
|
151
144
|
ignore_private_variables=ignore_private_variables, skip=skip, use_enum_value=use_enum_value,
|
|
@@ -170,21 +163,16 @@ class DeepDiff(dict):
|
|
|
170
163
|
self._finish_init(self.to_dict())
|
|
171
164
|
|
|
172
165
|
def _finish_init(self, report):
|
|
173
|
-
"""Store text report, build `.tree`, and optionally switch to view='tree'."""
|
|
174
166
|
text = dict(report)
|
|
175
|
-
self.tree = build_tree(text
|
|
167
|
+
self.tree = build_tree(text)
|
|
176
168
|
if self.view == "tree":
|
|
177
169
|
super().__init__(tree_as_result(self.tree))
|
|
178
170
|
else:
|
|
179
171
|
super().__init__(text)
|
|
180
172
|
|
|
181
173
|
def to_dict(self, verbose_level=None):
|
|
182
|
-
"""The differences as a plain dict, with `type_changes` types as type objects."""
|
|
183
174
|
if self._native is None:
|
|
184
|
-
if self._bridge is not None:
|
|
185
|
-
return self._bridge.to_dict(verbose_level=self._level(verbose_level))
|
|
186
175
|
if getattr(self, "view", "text") == "tree":
|
|
187
|
-
# Rebuild a text-shaped dict from levels when asked.
|
|
188
176
|
out = {}
|
|
189
177
|
for key, levels in self.tree.items():
|
|
190
178
|
if key.endswith(("_added", "_removed")) and self._level(verbose_level) < 2:
|
|
@@ -220,13 +208,11 @@ class DeepDiff(dict):
|
|
|
220
208
|
return report
|
|
221
209
|
|
|
222
210
|
def to_json(self, default_mapping=None, force_use_builtin_json=False, verbose_level=None, **kwargs):
|
|
223
|
-
"""The differences as JSON; extra keyword arguments go to `json.dumps`."""
|
|
224
211
|
if default_mapping is not None:
|
|
225
212
|
raise NotImplementedError("default_mapping is not supported yet.")
|
|
226
213
|
if self._native is None:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return json.dumps(self.to_dict(verbose_level), **kwargs) if kwargs else json.dumps(self.to_dict(verbose_level))
|
|
214
|
+
data = self.to_dict(verbose_level)
|
|
215
|
+
return json.dumps(data, **kwargs) if kwargs else json.dumps(data)
|
|
230
216
|
text = self._native.to_json(self._level(verbose_level))
|
|
231
217
|
if self._native.deep_distance is not None:
|
|
232
218
|
report = json.loads(text)
|
|
@@ -236,7 +222,6 @@ class DeepDiff(dict):
|
|
|
236
222
|
|
|
237
223
|
@property
|
|
238
224
|
def affected_paths(self):
|
|
239
|
-
"""The paths of every difference in this result."""
|
|
240
225
|
paths = set()
|
|
241
226
|
for key, findings in self.items():
|
|
242
227
|
if key == "deep_distance":
|
|
@@ -251,7 +236,6 @@ class DeepDiff(dict):
|
|
|
251
236
|
|
|
252
237
|
@property
|
|
253
238
|
def affected_root_keys(self):
|
|
254
|
-
"""The root keys, indices or attribute names the differences sit under."""
|
|
255
239
|
report = self.to_dict(2)
|
|
256
240
|
keys = set()
|
|
257
241
|
for findings in report.values():
|
|
@@ -263,8 +247,7 @@ class DeepDiff(dict):
|
|
|
263
247
|
return keys
|
|
264
248
|
|
|
265
249
|
def pretty(self, prefix=None):
|
|
266
|
-
""
|
|
267
|
-
tree = getattr(self, "tree", None) or build_tree(self.to_dict(), self.verbose_level)
|
|
250
|
+
tree = getattr(self, "tree", None) or build_tree(self.to_dict())
|
|
268
251
|
return pretty_from_tree(tree, self.verbose_level, prefix)
|
|
269
252
|
|
|
270
253
|
def custom_report_result(self, report_type, level, extra_info=None):
|
|
@@ -275,7 +258,7 @@ class DeepDiff(dict):
|
|
|
275
258
|
payload.setdefault("new_value", level.t2)
|
|
276
259
|
bucket = getattr(self, "_walk_report", self).setdefault(report_type, {})
|
|
277
260
|
bucket[path] = payload
|
|
278
|
-
if self._native is None
|
|
261
|
+
if self._native is None:
|
|
279
262
|
self.setdefault(report_type, {})[path] = payload
|
|
280
263
|
|
|
281
264
|
def _report_result(self, report_type, change_level, local_tree=None):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""group_by: regroup a list of dicts before the diff."""
|
|
2
2
|
|
|
3
3
|
from collections.abc import Iterable, Mapping
|
|
4
4
|
from copy import deepcopy
|
|
@@ -16,7 +16,6 @@ def _add(result, key, row, sort_key):
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def _group(item, group_by, sort_key):
|
|
19
|
-
"""DeepDiff's `_group_iterable_to_dict`; raises `KeyError` or `ValueError` when it cannot."""
|
|
20
19
|
level1, level2 = group_by, None
|
|
21
20
|
if isinstance(group_by, (list, tuple)):
|
|
22
21
|
level1, level2 = group_by[0], group_by[1] if len(group_by) > 1 else None
|
|
@@ -39,7 +38,6 @@ def _group(item, group_by, sort_key):
|
|
|
39
38
|
|
|
40
39
|
|
|
41
40
|
def group_pair(t1, t2, group_by, group_by_sort_key):
|
|
42
|
-
"""`(t1, t2)` grouped, or both unchanged when either side cannot be grouped."""
|
|
43
41
|
if not group_by:
|
|
44
42
|
return t1, t2
|
|
45
43
|
sort_key = group_by_sort_key
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Normalization options passed through to the native DeepDiff."""
|
|
2
2
|
|
|
3
3
|
import datetime
|
|
4
4
|
import decimal
|
|
5
5
|
import fractions
|
|
6
6
|
import uuid
|
|
7
7
|
|
|
8
|
-
# deepdiff's `numbers` and `strings`, plus numpy scalars when numpy is importable.
|
|
9
8
|
_NUMBERS = [
|
|
10
9
|
int, float, complex, decimal.Decimal, fractions.Fraction,
|
|
11
10
|
datetime.datetime, datetime.date, datetime.timedelta, datetime.time,
|
|
@@ -31,7 +30,6 @@ _TRUNCATE_FROM = {"day": 0, "hour": 1, "minute": 2, "second": 3}
|
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
def _type_groups(groups, ignore_string_type_changes, ignore_numeric_type_changes, ignore_uuid_types):
|
|
34
|
-
"""`get_ignore_types_in_groups`: each group a tuple of types."""
|
|
35
33
|
if groups and isinstance(groups[0], type):
|
|
36
34
|
groups = [groups]
|
|
37
35
|
result = [
|
|
@@ -53,7 +51,6 @@ def native_options(
|
|
|
53
51
|
ignore_numeric_type_changes, ignore_string_type_changes, ignore_type_in_groups,
|
|
54
52
|
ignore_type_subclasses, truncate_datetime, ignore_uuid_types=False,
|
|
55
53
|
):
|
|
56
|
-
"""The native `DeepDiff` keyword arguments for these options."""
|
|
57
54
|
if significant_digits is not None and significant_digits < 0:
|
|
58
55
|
raise ValueError("significant_digits must be None or a non-negative integer")
|
|
59
56
|
if significant_digits is None and ignore_numeric_type_changes:
|
|
@@ -81,7 +78,6 @@ def native_options(
|
|
|
81
78
|
ignore_uuid_types,
|
|
82
79
|
)
|
|
83
80
|
if groups:
|
|
84
|
-
# ponytail: a u64 mask, so at most 64 groups.
|
|
85
81
|
def group_mask(cls):
|
|
86
82
|
return sum(
|
|
87
83
|
1 << i for i, group in enumerate(groups)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Path filters
|
|
1
|
+
"""Path filters over rendered DeepDiff path strings."""
|
|
2
2
|
|
|
3
3
|
import ast
|
|
4
4
|
import re
|
|
@@ -21,7 +21,6 @@ def _element(text, literal):
|
|
|
21
21
|
|
|
22
22
|
@cache
|
|
23
23
|
def _elements(path):
|
|
24
|
-
"""`root['a'][0].b` -> ('a', 0, 'b'); `*`/`**` become wildcard markers."""
|
|
25
24
|
out, i, n = [], 4, len(path)
|
|
26
25
|
while i < n:
|
|
27
26
|
j = i + 1
|
|
@@ -46,8 +45,6 @@ def _elements(path):
|
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
def _matches(pattern, target, prefix):
|
|
49
|
-
"""`pattern` matches `target`, or (`prefix`) some prefix of it."""
|
|
50
|
-
|
|
51
48
|
@cache
|
|
52
49
|
def go(p, t):
|
|
53
50
|
if p == len(pattern):
|
|
@@ -62,8 +59,6 @@ def _matches(pattern, target, prefix):
|
|
|
62
59
|
|
|
63
60
|
|
|
64
61
|
def _could_reach(pattern, target):
|
|
65
|
-
"""`target` is an ancestor of some path `pattern` matches."""
|
|
66
|
-
|
|
67
62
|
@cache
|
|
68
63
|
def go(p, t):
|
|
69
64
|
if t == len(target):
|
|
@@ -78,7 +73,6 @@ def _could_reach(pattern, target):
|
|
|
78
73
|
|
|
79
74
|
|
|
80
75
|
def _root_paths(paths):
|
|
81
|
-
"""deepdiff's `add_root_to_paths`: a bare key also means `root[key]`."""
|
|
82
76
|
result = set()
|
|
83
77
|
for path in paths:
|
|
84
78
|
if path.startswith("root"):
|
|
@@ -93,7 +87,6 @@ def _root_paths(paths):
|
|
|
93
87
|
|
|
94
88
|
|
|
95
89
|
def _split(paths):
|
|
96
|
-
"""(exact paths, glob patterns as element tuples), as deepdiff separates them."""
|
|
97
90
|
if not paths:
|
|
98
91
|
return set(), []
|
|
99
92
|
paths = {paths} if isinstance(paths, str) else set(paths)
|
|
@@ -115,9 +108,6 @@ def _regexes(items):
|
|
|
115
108
|
|
|
116
109
|
|
|
117
110
|
def skip_filter(exclude_paths, include_paths, exclude_regex_paths, exclude_types):
|
|
118
|
-
"""`skip(prefixes, typed)` for a finding: `prefixes` are its path's rendered
|
|
119
|
-
prefixes from `root`, `typed[k]` whether `prefixes[k]` holds an
|
|
120
|
-
`exclude_types` instance. `None` when nothing filters."""
|
|
121
111
|
ex_exact, ex_globs = _split(exclude_paths)
|
|
122
112
|
in_exact, in_globs = _split(include_paths)
|
|
123
113
|
regexes = _regexes(exclude_regex_paths)
|
|
@@ -141,7 +131,6 @@ def skip_filter(exclude_paths, include_paths, exclude_regex_paths, exclude_types
|
|
|
141
131
|
return typed
|
|
142
132
|
|
|
143
133
|
def skip_report(path):
|
|
144
|
-
# `_skip_report_for_include_glob`: a glob ancestor is walked, not reported.
|
|
145
134
|
if not in_globs or path in in_exact or any(p in path for p in in_exact):
|
|
146
135
|
return False
|
|
147
136
|
return not any(_matches(g, _elements(path), True) for g in in_globs)
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
"""pretty()
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
1
|
+
"""pretty() and view='tree' DiffLevel."""
|
|
4
2
|
|
|
5
3
|
|
|
6
4
|
class DiffLevel:
|
|
7
|
-
"""Minimal DeepDiff tree node: path, t1/t2, report_type."""
|
|
8
|
-
|
|
9
5
|
__slots__ = ("t1", "t2", "report_type", "_path", "additional")
|
|
10
6
|
|
|
11
7
|
def __init__(self, path, t1, t2, report_type):
|
|
@@ -85,8 +81,7 @@ def _level_from_finding(report_type, path, payload):
|
|
|
85
81
|
return DiffLevel(path, payload, payload, report_type)
|
|
86
82
|
|
|
87
83
|
|
|
88
|
-
def build_tree(report
|
|
89
|
-
"""text-report dict → {category: [DiffLevel, ...]} like DeepDiff.tree."""
|
|
84
|
+
def build_tree(report):
|
|
90
85
|
tree = {}
|
|
91
86
|
for report_type, findings in report.items():
|
|
92
87
|
if report_type == "deep_distance":
|
|
@@ -100,12 +95,11 @@ def build_tree(report: dict, verbose_level: int = 1) -> dict:
|
|
|
100
95
|
return tree
|
|
101
96
|
|
|
102
97
|
|
|
103
|
-
def tree_as_result(tree
|
|
104
|
-
"""DeepDiff view='tree' shape: category → list of DiffLevel."""
|
|
98
|
+
def tree_as_result(tree):
|
|
105
99
|
return {key: list(levels) for key, levels in tree.items()}
|
|
106
100
|
|
|
107
101
|
|
|
108
|
-
def pretty_from_tree(tree
|
|
102
|
+
def pretty_from_tree(tree, verbose_level=1, prefix=None):
|
|
109
103
|
forms = _PRETTY_V2 if verbose_level == 2 else _PRETTY
|
|
110
104
|
if prefix is None:
|
|
111
105
|
prefix = ""
|
|
@@ -115,12 +109,10 @@ def pretty_from_tree(tree: dict, verbose_level: int = 1, prefix=None) -> str:
|
|
|
115
109
|
template = forms.get(level.report_type, "")
|
|
116
110
|
if not template:
|
|
117
111
|
continue
|
|
118
|
-
type_t1 = type(level.t1).__name__
|
|
119
|
-
type_t2 = type(level.t2).__name__
|
|
120
112
|
line = template.format(
|
|
121
113
|
diff_path=level.path(),
|
|
122
|
-
type_t1=
|
|
123
|
-
type_t2=
|
|
114
|
+
type_t1=type(level.t1).__name__,
|
|
115
|
+
type_t2=type(level.t2).__name__,
|
|
124
116
|
val_t1=_fmt_val(level.t1),
|
|
125
117
|
val_t2=_fmt_val(level.t2),
|
|
126
118
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/examples/stack_frame_cost.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/ignore_order/distance.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/src/ignore_order/pairing.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/tests/ignore_order_memory.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepdiff_rust-0.1.0 → deepdiff_rust-0.1.1}/crates/deepdiff-core/tests/proptest_ignore_order.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|