pyuncommonkit 0.1.1__tar.gz → 0.1.2__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.
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/PKG-INFO +1 -1
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/pyproject.toml +1 -1
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/pyproject.toml.orig +1 -1
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/src/commonkit/keys.py +5 -4
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/src/commonkit/store.py +1 -1
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/LICENSE +0 -0
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/README.md +0 -0
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/src/commonkit/__init__.py +0 -0
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/src/commonkit/cache.py +0 -0
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/src/commonkit/read.py +0 -0
- {pyuncommonkit-0.1.1 → pyuncommonkit-0.1.2}/src/commonkit/shared.py +0 -0
|
@@ -42,10 +42,11 @@ from __future__ import annotations
|
|
|
42
42
|
import re
|
|
43
43
|
from collections.abc import Iterable
|
|
44
44
|
|
|
45
|
-
#: Segments are addressed by
|
|
45
|
+
#: Segments are addressed by a lowercase hex digest: 32 digits (md5) or 64 (BLAKE3,
|
|
46
|
+
#: contract §3.4); the length tells them apart, so one key still names one content. Every pattern here is used with
|
|
46
47
|
#: ``fullmatch``, never ``match`` with ``$``: ``$`` also matches before a final
|
|
47
48
|
#: newline, which let ``"...\n"`` through as a digest or token (contract §3.1).
|
|
48
|
-
_DIGEST_RE = re.compile(r"[0-9a-f]{32}")
|
|
49
|
+
_DIGEST_RE = re.compile(r"[0-9a-f]{32}|[0-9a-f]{64}")
|
|
49
50
|
|
|
50
51
|
#: Every other component is a bare lowercase token. Restrictive on purpose:
|
|
51
52
|
#: these become PATH components, and a key is the only thing standing between
|
|
@@ -110,7 +111,7 @@ class KeyScheme:
|
|
|
110
111
|
|
|
111
112
|
self._key_re = re.compile(
|
|
112
113
|
rf"{re.escape(self.domain)}:{re.escape(self.version)}:"
|
|
113
|
-
r"(?P<form>[a-z0-9]+):(?P<digest>[0-9a-f]{32}):"
|
|
114
|
+
r"(?P<form>[a-z0-9]+):(?P<digest>[0-9a-f]{32}|[0-9a-f]{64}):"
|
|
114
115
|
r"(?P<variant>[a-z0-9]+)")
|
|
115
116
|
|
|
116
117
|
# ------------------------------------------------------------- building
|
|
@@ -140,7 +141,7 @@ class KeyScheme:
|
|
|
140
141
|
"""The store key for one array. Raises on anything it cannot address."""
|
|
141
142
|
digest = str(digest).translate(_ASCII_LOWER)
|
|
142
143
|
if not _DIGEST_RE.fullmatch(digest):
|
|
143
|
-
raise ValueError(f"not
|
|
144
|
+
raise ValueError(f"not a 32- or 64-digit hex digest: {digest!r}")
|
|
144
145
|
form = self.default_form if form is None else str(form)
|
|
145
146
|
if form not in self.forms:
|
|
146
147
|
raise ValueError(
|
|
@@ -97,7 +97,7 @@ _NPY_MAGIC = b"\x93NUMPY"
|
|
|
97
97
|
#: The reaper's candidates (contract §9.4): ``{form}/{xx}/{digest}.{variant}.npy`` with
|
|
98
98
|
#: the shard equal to the digest's first two characters. Matched per path component.
|
|
99
99
|
_SHARD_RE = re.compile(r"[0-9a-f]{2}")
|
|
100
|
-
_SEGMENT_NAME_RE = re.compile(r"([0-9a-f]{2})[0-9a-f]{30}\.[a-z0-9]+\.npy")
|
|
100
|
+
_SEGMENT_NAME_RE = re.compile(r"([0-9a-f]{2})(?:[0-9a-f]{30}|[0-9a-f]{62})\.[a-z0-9]+\.npy")
|
|
101
101
|
|
|
102
102
|
#: An orphaned temporary file is swept once it is this old (contract §9.5). A writer
|
|
103
103
|
#: holds its ``.tmp`` for one ``np.save`` -- milliseconds -- so an hour old means the
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|