tba-provider-corim-reference-memory 0.4.0.dev2__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.
- tba_provider_corim_reference_memory/__init__.py +38 -0
- tba_provider_corim_reference_memory/py.typed +1 -0
- tba_provider_corim_reference_memory-0.4.0.dev2.dist-info/METADATA +21 -0
- tba_provider_corim_reference_memory-0.4.0.dev2.dist-info/RECORD +5 -0
- tba_provider_corim_reference_memory-0.4.0.dev2.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
|
|
3
|
+
from tba_concrete_corim import CorimTag, parse_corim, parse_corim_tag, validate_corim_tag
|
|
4
|
+
from tba_contracts_identity.attestation import ReferenceIntegrityManifest
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CorimReferenceMemoryProvider:
|
|
8
|
+
provider_id = "corim-reference:memory"
|
|
9
|
+
persistence = "ephemeral-process-local"
|
|
10
|
+
|
|
11
|
+
def __init__(self):
|
|
12
|
+
self._tags: dict[str, CorimTag] = {}
|
|
13
|
+
self._manifests: dict[str, ReferenceIntegrityManifest] = {}
|
|
14
|
+
|
|
15
|
+
def publish(self, value: Mapping[str, object]) -> CorimTag:
|
|
16
|
+
tag = parse_corim_tag(value)
|
|
17
|
+
validate_corim_tag(tag)
|
|
18
|
+
identifier = str(tag.tag_identity)
|
|
19
|
+
if identifier in self._tags:
|
|
20
|
+
raise ValueError(f"CoRIM tag is immutable once published: {identifier}")
|
|
21
|
+
self._tags[identifier] = tag
|
|
22
|
+
self._manifests[identifier] = parse_corim(value)
|
|
23
|
+
return tag
|
|
24
|
+
|
|
25
|
+
def get(self, tag_identity: str) -> CorimTag:
|
|
26
|
+
try:
|
|
27
|
+
return self._tags[tag_identity]
|
|
28
|
+
except KeyError as exc:
|
|
29
|
+
raise LookupError(tag_identity) from exc
|
|
30
|
+
|
|
31
|
+
def resolve_manifest(self, tag_identity: str, /) -> ReferenceIntegrityManifest:
|
|
32
|
+
try:
|
|
33
|
+
return self._manifests[tag_identity]
|
|
34
|
+
except KeyError as exc:
|
|
35
|
+
raise LookupError(tag_identity) from exc
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
__all__ = ["CorimReferenceMemoryProvider"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-provider-corim-reference-memory
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: Non-durable in-memory CoRIM reference-material provider.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10,<3.15
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Requires-Dist: tba-concrete-corim (==0.4.0.dev2)
|
|
14
|
+
Requires-Dist: tba-contracts-identity (==0.4.0.dev2)
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# tba-provider-corim-reference-memory
|
|
18
|
+
|
|
19
|
+
Validated immutable process-local CoRIM reference material for tests and
|
|
20
|
+
development. It is non-durable and is not shared across workers.
|
|
21
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
tba_provider_corim_reference_memory/__init__.py,sha256=Vphp8fuVxGcxw4mlFYrEQloEOGRwdBz3L18sMI0LvQ0,1346
|
|
2
|
+
tba_provider_corim_reference_memory/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
3
|
+
tba_provider_corim_reference_memory-0.4.0.dev2.dist-info/METADATA,sha256=9n_x7lgSD5bOdlKPE9dwTD_b0wLtlrnugAbXvUTcHA0,835
|
|
4
|
+
tba_provider_corim_reference_memory-0.4.0.dev2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
|
|
5
|
+
tba_provider_corim_reference_memory-0.4.0.dev2.dist-info/RECORD,,
|