jsonpit 4.4.7__tar.gz → 4.5.0__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.
- {jsonpit-4.4.7 → jsonpit-4.5.0}/API.md +1 -1
- {jsonpit-4.4.7 → jsonpit-4.5.0}/PKG-INFO +33 -16
- {jsonpit-4.4.7 → jsonpit-4.5.0}/README.md +32 -15
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/__init__.py +13 -1
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/exceptions.py +7 -0
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/history.py +4 -3
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/item.py +313 -64
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/store.py +452 -52
- {jsonpit-4.4.7 → jsonpit-4.5.0}/pyproject.toml +1 -1
- {jsonpit-4.4.7 → jsonpit-4.5.0}/.gitignore +0 -0
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/audit.py +0 -0
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/canonical.py +0 -0
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/changes.py +0 -0
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/cli.py +0 -0
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/config.py +0 -0
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/flags.py +0 -0
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/fs.py +0 -0
- {jsonpit-4.4.7 → jsonpit-4.5.0}/jsonpit/icons.py +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# jsonpit API Reference (v4.
|
|
1
|
+
# jsonpit API Reference (v4.5.0)
|
|
2
2
|
|
|
3
3
|
This document provides a foldable, searchable reference for the public `jsonpit` Python API. Designed for 100% C# JsonPit parity, zero third-party runtime dependencies, and Smalltalk-grade object-oriented architecture.
|
|
4
4
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: jsonpit
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.5.0
|
|
4
4
|
Summary: Daemon-free distributed storage over Cloud Drives for developers and AI agents — multi-process, immutable history, zero dependencies.
|
|
5
5
|
Author: Dr. Rainer Burkhardt
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -25,20 +25,24 @@ Description-Content-Type: text/markdown
|
|
|
25
25
|
> **Daemon-free distributed storage over Cloud Drives for developers and AI agents — multi-process, immutable history, zero dependencies.**
|
|
26
26
|
> *100% C# JsonPit Parity · Zero Third-Party Runtime Dependencies · Smalltalk-Grade Object-Oriented Architecture*
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
JsonPit change requests and release notes are centralized in the RAIkeep [`doc/`](https://github.com/Burkhardt/RAIkeep/tree/main/doc) directory under `JsonPit_...` filenames; they are not stored separately in this child repository.
|
|
29
|
+
|
|
30
|
+
JsonPit stores JSON documents with value history across processes, machines, and servers using [asynchronous persistence with eventual durability](https://github.com/Burkhardt/RAIkeep/blob/main/MANIFESTO.md#asynchronous-persistence-with-eventual-durability).
|
|
31
|
+
|
|
32
|
+
**CLI tools:** use `pits` (see [PitSeeder](https://github.com/Burkhardt/PitSeeder)) or [`jpit`](https://pypi.org/project/jsonpit/) to seed, export, inspect, and maintain JsonPits. Use [`amafu init`](https://github.com/Burkhardt/Amafu) to detect cloud drives and create the shared RAIkeep configuration.
|
|
29
33
|
|
|
30
34
|
The canonical **reference (lead) implementation** is C# `JsonPit` and the `pits` CLI in [RAIkeep](https://github.com/Burkhardt/RAIkeep). `jsonpit` is the pure-Python implementation engineered for 100% behavioral and physical storage parity with zero deviation.
|
|
31
35
|
|
|
32
36
|
---
|
|
33
37
|
|
|
34
|
-
## Cross-Tool & Cross-Language Version Alignment (`v4.
|
|
38
|
+
## Cross-Tool & Cross-Language Version Alignment (`v4.5.0`)
|
|
35
39
|
|
|
36
|
-
`jsonpit` and the `jpit` CLI are version-synchronized to **`v4.
|
|
40
|
+
`jsonpit` and the `jpit` CLI are version-synchronized to **`v4.5.0`** in direct lockstep with C# `JsonPit` in [RAIkeep](https://github.com/Burkhardt/RAIkeep).
|
|
37
41
|
|
|
38
42
|
### Why Harmonized Versioning is Essential:
|
|
39
43
|
- **Instant Compatibility Clarity:** Operators, DevOps pipelines, and autonomous AI agents immediately know whether `jpit` and `pits` share the exact same distributed protocol revision. If both tools report `4.4.x`, they guarantee identical master leasing rules, receipt mechanisms, 7-digit UTC timestamp parsing, and CR041 clean change file conventions.
|
|
40
44
|
- **Elimination of Multi-Language Matrix Confusion:** In heterogeneous environments (e.g. C# backend daemons paired with Python agent orchestrators and data science tooling), unified SemVer tags eliminate complex cross-compatibility lookup tables.
|
|
41
|
-
- **Joint Protocol Governance:** Architectural changes—such as CR040 anti-Read-Modify-Write rules, CR041 clean change file formatting, CR044 missing configuration diagnostics, CR047 strict patch validation, and [CR049](doc/CR/CR049_AIA_and_jsonpit_to_RAIkeep_Live-ID-Validation_and_Zip-Image-Import.md) live ID validation with 4-character change checksums—are certified across both languages under the exact same version milestone before release.
|
|
45
|
+
- **Joint Protocol Governance:** Architectural changes—such as CR040 anti-Read-Modify-Write rules, CR041 clean change file formatting, CR044 missing configuration diagnostics, CR047 strict patch validation, and [CR049](https://github.com/Burkhardt/jsonpit-python/blob/main/doc/CR/CR049_AIA_and_jsonpit_to_RAIkeep_Live-ID-Validation_and_Zip-Image-Import.md) live ID validation with 4-character change checksums—are certified across both languages under the exact same version milestone before release.
|
|
42
46
|
|
|
43
47
|
---
|
|
44
48
|
|
|
@@ -62,12 +66,32 @@ The canonical **reference (lead) implementation** is C# `JsonPit` and the `pits`
|
|
|
62
66
|
- **`PitItem`**: Polymorphic living entity. Emits pure sparse deltas without read-modify-write cycles (CR040).
|
|
63
67
|
- **`PitItems`**: Immutable fragment stack managing value history and accurate point-in-time state projection.
|
|
64
68
|
- **`JsonPitBase`**: Shared foundation for storage resolution, subscriber roles, and cloud synchronization.
|
|
69
|
+
- **`PitMaintenanceOptions` / `PitMaintenanceResult`**: Automated reconciliation, 10-minute receipt grace periods, and flag pruning (CR021/CR022).
|
|
70
|
+
- **`PitAudit` / `PitAuditEvent`**: Read-only durable recovery event inspection without acquiring leases or flags (CR003).
|
|
71
|
+
|
|
72
|
+
### 1. Core Replicated Storage Architecture
|
|
65
73
|
|
|
66
74
|
<p align="center">
|
|
67
|
-
<img src="https://raw.githubusercontent.com/Burkhardt/jsonpit-python/main/doc/uml/jsonpitCD.png" alt="jsonpit Class Diagram" width="
|
|
75
|
+
<img src="https://raw.githubusercontent.com/Burkhardt/jsonpit-python/main/doc/uml/jsonpitCD.png" alt="jsonpit Core Class Diagram" width="700"/>
|
|
68
76
|
</p>
|
|
69
77
|
|
|
70
|
-
>
|
|
78
|
+
<p align="center">
|
|
79
|
+
<em>Core Living Entity Model · Vector SVG: <a href="https://github.com/Burkhardt/jsonpit-python/blob/main/doc/uml/jsonpitCD.svg">jsonpitCD.svg</a></em>
|
|
80
|
+
</p>
|
|
81
|
+
|
|
82
|
+
### 2. Storage Maintenance & Event Recovery Audit Architecture
|
|
83
|
+
|
|
84
|
+
<p align="center">
|
|
85
|
+
<img src="https://raw.githubusercontent.com/Burkhardt/jsonpit-python/main/doc/uml/jsonpit_opsCD.png" alt="jsonpit Operations Class Diagram" width="700"/>
|
|
86
|
+
</p>
|
|
87
|
+
|
|
88
|
+
<p align="center">
|
|
89
|
+
<em>Maintenance & Recovery Audit · Vector SVG: <a href="https://github.com/Burkhardt/jsonpit-python/blob/main/doc/uml/jsonpit_opsCD.svg">jsonpit_opsCD.svg</a></em>
|
|
90
|
+
</p>
|
|
91
|
+
|
|
92
|
+
> 📖 **Architecture & Full API:**
|
|
93
|
+
> • For the complete unified architecture across all subsystems, see **[jsonpit_unifiedCD.svg](https://github.com/Burkhardt/jsonpit-python/blob/main/doc/uml/jsonpit_unifiedCD.svg)**.
|
|
94
|
+
> • For comprehensive method signatures, exception contracts, and protocol details, see **[API.md](https://github.com/Burkhardt/jsonpit-python/blob/main/API.md)**.
|
|
71
95
|
|
|
72
96
|
---
|
|
73
97
|
|
|
@@ -82,7 +106,7 @@ pipx install jsonpit
|
|
|
82
106
|
# (or via companion alias)
|
|
83
107
|
pipx install jpit
|
|
84
108
|
|
|
85
|
-
# Upgrade to the latest lockstep release (v4.
|
|
109
|
+
# Upgrade to the latest lockstep release (v4.5.0)
|
|
86
110
|
pipx upgrade jsonpit
|
|
87
111
|
# (or)
|
|
88
112
|
pipx upgrade jpit
|
|
@@ -247,7 +271,7 @@ To ensure 100% interoperability with C# `JsonPit`, this repository includes a de
|
|
|
247
271
|
- **7 Parity Suites (41 Cross-Engine Steps):** Covers persistence CRUD, CR041 clean change files, receipt grace periods, nested property tombstones, compaction/events archiving, process flag lifecycles, and split-master partition recovery.
|
|
248
272
|
|
|
249
273
|
For full suite descriptions, architecture diagrams, and certification tables, see:
|
|
250
|
-
👉 **[`doc/CROSS_ENGINE_PARITY_SPECIFICATION.md`](doc/CROSS_ENGINE_PARITY_SPECIFICATION.md)**
|
|
274
|
+
👉 **[`doc/CROSS_ENGINE_PARITY_SPECIFICATION.md`](https://github.com/Burkhardt/jsonpit-python/blob/main/doc/CROSS_ENGINE_PARITY_SPECIFICATION.md)**
|
|
251
275
|
|
|
252
276
|
```bash
|
|
253
277
|
# Run the full test battery (Unit Tests + 7 Cross-Engine Parity Suites):
|
|
@@ -256,10 +280,3 @@ python3 tests/run_all.py
|
|
|
256
280
|
# Run a specific declarative parity suite directly:
|
|
257
281
|
python3 -m tests.sequence_runner tests/suites/01_persistence_and_crud.json5
|
|
258
282
|
```
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## Heritage & Governance
|
|
263
|
-
|
|
264
|
-
Architected by **Rainer Burkhardt (`RAI`)** + **Adele (`7010`)**.
|
|
265
|
-
Governed by [`ADELE_SPIRIT.md`](ADELE_SPIRIT.md) and [`GEMINI.md`](GEMINI.md) and assisted by an LLM named Adele as an homage to the great Adele Goldberg.
|
|
@@ -3,20 +3,24 @@
|
|
|
3
3
|
> **Daemon-free distributed storage over Cloud Drives for developers and AI agents — multi-process, immutable history, zero dependencies.**
|
|
4
4
|
> *100% C# JsonPit Parity · Zero Third-Party Runtime Dependencies · Smalltalk-Grade Object-Oriented Architecture*
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
JsonPit change requests and release notes are centralized in the RAIkeep [`doc/`](https://github.com/Burkhardt/RAIkeep/tree/main/doc) directory under `JsonPit_...` filenames; they are not stored separately in this child repository.
|
|
7
|
+
|
|
8
|
+
JsonPit stores JSON documents with value history across processes, machines, and servers using [asynchronous persistence with eventual durability](https://github.com/Burkhardt/RAIkeep/blob/main/MANIFESTO.md#asynchronous-persistence-with-eventual-durability).
|
|
9
|
+
|
|
10
|
+
**CLI tools:** use `pits` (see [PitSeeder](https://github.com/Burkhardt/PitSeeder)) or [`jpit`](https://pypi.org/project/jsonpit/) to seed, export, inspect, and maintain JsonPits. Use [`amafu init`](https://github.com/Burkhardt/Amafu) to detect cloud drives and create the shared RAIkeep configuration.
|
|
7
11
|
|
|
8
12
|
The canonical **reference (lead) implementation** is C# `JsonPit` and the `pits` CLI in [RAIkeep](https://github.com/Burkhardt/RAIkeep). `jsonpit` is the pure-Python implementation engineered for 100% behavioral and physical storage parity with zero deviation.
|
|
9
13
|
|
|
10
14
|
---
|
|
11
15
|
|
|
12
|
-
## Cross-Tool & Cross-Language Version Alignment (`v4.
|
|
16
|
+
## Cross-Tool & Cross-Language Version Alignment (`v4.5.0`)
|
|
13
17
|
|
|
14
|
-
`jsonpit` and the `jpit` CLI are version-synchronized to **`v4.
|
|
18
|
+
`jsonpit` and the `jpit` CLI are version-synchronized to **`v4.5.0`** in direct lockstep with C# `JsonPit` in [RAIkeep](https://github.com/Burkhardt/RAIkeep).
|
|
15
19
|
|
|
16
20
|
### Why Harmonized Versioning is Essential:
|
|
17
21
|
- **Instant Compatibility Clarity:** Operators, DevOps pipelines, and autonomous AI agents immediately know whether `jpit` and `pits` share the exact same distributed protocol revision. If both tools report `4.4.x`, they guarantee identical master leasing rules, receipt mechanisms, 7-digit UTC timestamp parsing, and CR041 clean change file conventions.
|
|
18
22
|
- **Elimination of Multi-Language Matrix Confusion:** In heterogeneous environments (e.g. C# backend daemons paired with Python agent orchestrators and data science tooling), unified SemVer tags eliminate complex cross-compatibility lookup tables.
|
|
19
|
-
- **Joint Protocol Governance:** Architectural changes—such as CR040 anti-Read-Modify-Write rules, CR041 clean change file formatting, CR044 missing configuration diagnostics, CR047 strict patch validation, and [CR049](doc/CR/CR049_AIA_and_jsonpit_to_RAIkeep_Live-ID-Validation_and_Zip-Image-Import.md) live ID validation with 4-character change checksums—are certified across both languages under the exact same version milestone before release.
|
|
23
|
+
- **Joint Protocol Governance:** Architectural changes—such as CR040 anti-Read-Modify-Write rules, CR041 clean change file formatting, CR044 missing configuration diagnostics, CR047 strict patch validation, and [CR049](https://github.com/Burkhardt/jsonpit-python/blob/main/doc/CR/CR049_AIA_and_jsonpit_to_RAIkeep_Live-ID-Validation_and_Zip-Image-Import.md) live ID validation with 4-character change checksums—are certified across both languages under the exact same version milestone before release.
|
|
20
24
|
|
|
21
25
|
---
|
|
22
26
|
|
|
@@ -40,12 +44,32 @@ The canonical **reference (lead) implementation** is C# `JsonPit` and the `pits`
|
|
|
40
44
|
- **`PitItem`**: Polymorphic living entity. Emits pure sparse deltas without read-modify-write cycles (CR040).
|
|
41
45
|
- **`PitItems`**: Immutable fragment stack managing value history and accurate point-in-time state projection.
|
|
42
46
|
- **`JsonPitBase`**: Shared foundation for storage resolution, subscriber roles, and cloud synchronization.
|
|
47
|
+
- **`PitMaintenanceOptions` / `PitMaintenanceResult`**: Automated reconciliation, 10-minute receipt grace periods, and flag pruning (CR021/CR022).
|
|
48
|
+
- **`PitAudit` / `PitAuditEvent`**: Read-only durable recovery event inspection without acquiring leases or flags (CR003).
|
|
49
|
+
|
|
50
|
+
### 1. Core Replicated Storage Architecture
|
|
43
51
|
|
|
44
52
|
<p align="center">
|
|
45
|
-
<img src="https://raw.githubusercontent.com/Burkhardt/jsonpit-python/main/doc/uml/jsonpitCD.png" alt="jsonpit Class Diagram" width="
|
|
53
|
+
<img src="https://raw.githubusercontent.com/Burkhardt/jsonpit-python/main/doc/uml/jsonpitCD.png" alt="jsonpit Core Class Diagram" width="700"/>
|
|
46
54
|
</p>
|
|
47
55
|
|
|
48
|
-
>
|
|
56
|
+
<p align="center">
|
|
57
|
+
<em>Core Living Entity Model · Vector SVG: <a href="https://github.com/Burkhardt/jsonpit-python/blob/main/doc/uml/jsonpitCD.svg">jsonpitCD.svg</a></em>
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
### 2. Storage Maintenance & Event Recovery Audit Architecture
|
|
61
|
+
|
|
62
|
+
<p align="center">
|
|
63
|
+
<img src="https://raw.githubusercontent.com/Burkhardt/jsonpit-python/main/doc/uml/jsonpit_opsCD.png" alt="jsonpit Operations Class Diagram" width="700"/>
|
|
64
|
+
</p>
|
|
65
|
+
|
|
66
|
+
<p align="center">
|
|
67
|
+
<em>Maintenance & Recovery Audit · Vector SVG: <a href="https://github.com/Burkhardt/jsonpit-python/blob/main/doc/uml/jsonpit_opsCD.svg">jsonpit_opsCD.svg</a></em>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
> 📖 **Architecture & Full API:**
|
|
71
|
+
> • For the complete unified architecture across all subsystems, see **[jsonpit_unifiedCD.svg](https://github.com/Burkhardt/jsonpit-python/blob/main/doc/uml/jsonpit_unifiedCD.svg)**.
|
|
72
|
+
> • For comprehensive method signatures, exception contracts, and protocol details, see **[API.md](https://github.com/Burkhardt/jsonpit-python/blob/main/API.md)**.
|
|
49
73
|
|
|
50
74
|
---
|
|
51
75
|
|
|
@@ -60,7 +84,7 @@ pipx install jsonpit
|
|
|
60
84
|
# (or via companion alias)
|
|
61
85
|
pipx install jpit
|
|
62
86
|
|
|
63
|
-
# Upgrade to the latest lockstep release (v4.
|
|
87
|
+
# Upgrade to the latest lockstep release (v4.5.0)
|
|
64
88
|
pipx upgrade jsonpit
|
|
65
89
|
# (or)
|
|
66
90
|
pipx upgrade jpit
|
|
@@ -225,7 +249,7 @@ To ensure 100% interoperability with C# `JsonPit`, this repository includes a de
|
|
|
225
249
|
- **7 Parity Suites (41 Cross-Engine Steps):** Covers persistence CRUD, CR041 clean change files, receipt grace periods, nested property tombstones, compaction/events archiving, process flag lifecycles, and split-master partition recovery.
|
|
226
250
|
|
|
227
251
|
For full suite descriptions, architecture diagrams, and certification tables, see:
|
|
228
|
-
👉 **[`doc/CROSS_ENGINE_PARITY_SPECIFICATION.md`](doc/CROSS_ENGINE_PARITY_SPECIFICATION.md)**
|
|
252
|
+
👉 **[`doc/CROSS_ENGINE_PARITY_SPECIFICATION.md`](https://github.com/Burkhardt/jsonpit-python/blob/main/doc/CROSS_ENGINE_PARITY_SPECIFICATION.md)**
|
|
229
253
|
|
|
230
254
|
```bash
|
|
231
255
|
# Run the full test battery (Unit Tests + 7 Cross-Engine Parity Suites):
|
|
@@ -234,10 +258,3 @@ python3 tests/run_all.py
|
|
|
234
258
|
# Run a specific declarative parity suite directly:
|
|
235
259
|
python3 -m tests.sequence_runner tests/suites/01_persistence_and_crud.json5
|
|
236
260
|
```
|
|
237
|
-
|
|
238
|
-
---
|
|
239
|
-
|
|
240
|
-
## Heritage & Governance
|
|
241
|
-
|
|
242
|
-
Architected by **Rainer Burkhardt (`RAI`)** + **Adele (`7010`)**.
|
|
243
|
-
Governed by [`ADELE_SPIRIT.md`](ADELE_SPIRIT.md) and [`GEMINI.md`](GEMINI.md) and assisted by an LLM named Adele as an homage to the great Adele Goldberg.
|
|
@@ -3,10 +3,15 @@ jsonpit — Cloud-first, eventually-consistent replicated storage engine in pure
|
|
|
3
3
|
100% C# JsonPit parity · Zero third-party runtime dependencies.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
+
from .canonical import (
|
|
7
|
+
utcnow,
|
|
8
|
+
)
|
|
6
9
|
from .exceptions import (
|
|
7
10
|
JsonPitError,
|
|
11
|
+
ObjectDisposedError,
|
|
8
12
|
PitConcurrencyError,
|
|
9
13
|
PitCorruptError,
|
|
14
|
+
PitDisposedError,
|
|
10
15
|
PitInstanceConflictError,
|
|
11
16
|
PitNotFoundError,
|
|
12
17
|
ProtectedAttributeError,
|
|
@@ -24,18 +29,22 @@ from .history import PitItems
|
|
|
24
29
|
from .icons import Icons
|
|
25
30
|
from .item import PitItem
|
|
26
31
|
from .store import (
|
|
32
|
+
MutationTrackingMode,
|
|
27
33
|
Pit,
|
|
28
34
|
PitMaintenanceOptions,
|
|
29
35
|
PitMaintenanceResult,
|
|
30
36
|
PitStore,
|
|
37
|
+
TimeValue,
|
|
31
38
|
parse_and_validate_seed_payload,
|
|
32
39
|
)
|
|
33
40
|
|
|
34
|
-
__version__ = "4.
|
|
41
|
+
__version__ = "4.5.0"
|
|
35
42
|
|
|
36
43
|
__all__ = [
|
|
37
44
|
"Pit",
|
|
38
45
|
"PitStore",
|
|
46
|
+
"MutationTrackingMode",
|
|
47
|
+
"TimeValue",
|
|
39
48
|
"PitMaintenanceOptions",
|
|
40
49
|
"PitMaintenanceResult",
|
|
41
50
|
"parse_and_validate_seed_payload",
|
|
@@ -50,6 +59,8 @@ __all__ = [
|
|
|
50
59
|
"missing_configuration_diagnostic",
|
|
51
60
|
"Icons",
|
|
52
61
|
"JsonPitError",
|
|
62
|
+
"ObjectDisposedError",
|
|
63
|
+
"PitDisposedError",
|
|
53
64
|
"PitNotFoundError",
|
|
54
65
|
"PitCorruptError",
|
|
55
66
|
"PitConcurrencyError",
|
|
@@ -57,4 +68,5 @@ __all__ = [
|
|
|
57
68
|
"ProtectedAttributeError",
|
|
58
69
|
"StrictPatchValidationError",
|
|
59
70
|
"TombstoneError",
|
|
71
|
+
"utcnow",
|
|
60
72
|
]
|
|
@@ -33,3 +33,10 @@ class ProtectedAttributeError(JsonPitError, ValueError):
|
|
|
33
33
|
|
|
34
34
|
class StrictPatchValidationError(JsonPitError, ValueError):
|
|
35
35
|
"""CR047: Raised when --require-existing / --patch validation fails."""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ObjectDisposedError(JsonPitError):
|
|
39
|
+
"""Raised when accessing or mutating a disposed Pit instance."""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
PitDisposedError = ObjectDisposedError
|
|
@@ -91,7 +91,7 @@ class PitItems(Sequence[PitItem]):
|
|
|
91
91
|
|
|
92
92
|
@property
|
|
93
93
|
def history(self) -> tuple[PitItem, ...]:
|
|
94
|
-
return self._history
|
|
94
|
+
return tuple(frag.clone() for frag in self._history)
|
|
95
95
|
|
|
96
96
|
@property
|
|
97
97
|
def max_count(self) -> int:
|
|
@@ -191,13 +191,14 @@ class PitItems(Sequence[PitItem]):
|
|
|
191
191
|
# --- Sequence Interface ---
|
|
192
192
|
|
|
193
193
|
def __getitem__(self, index: int) -> PitItem: # type: ignore[override]
|
|
194
|
-
return self._history[index]
|
|
194
|
+
return self._history[index].clone()
|
|
195
195
|
|
|
196
196
|
def __len__(self) -> int:
|
|
197
197
|
return len(self._history)
|
|
198
198
|
|
|
199
199
|
def __iter__(self) -> Iterator[PitItem]:
|
|
200
|
-
|
|
200
|
+
for frag in self._history:
|
|
201
|
+
yield frag.clone()
|
|
201
202
|
|
|
202
203
|
def __repr__(self) -> str:
|
|
203
204
|
return f"<PitItems Key={self._key!r} Count={len(self._history)} MaxCount={self._max_count}>"
|