persidict 0.32.7__tar.gz → 0.32.8__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.
Potentially problematic release.
This version of persidict might be problematic. Click here for more details.
- {persidict-0.32.7 → persidict-0.32.8}/PKG-INFO +1 -1
- {persidict-0.32.7 → persidict-0.32.8}/pyproject.toml +1 -1
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/file_dir_dict.py +5 -17
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/safe_chars.py +1 -2
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/write_once_dict.py +1 -0
- {persidict-0.32.7 → persidict-0.32.8}/README.md +0 -0
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/.DS_Store +0 -0
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/__init__.py +0 -0
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/jokers.py +0 -0
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/overlapping_multi_dict.py +0 -0
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/persi_dict.py +0 -0
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/s3_dict.py +0 -0
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/safe_str_tuple.py +0 -0
- {persidict-0.32.7 → persidict-0.32.8}/src/persidict/safe_str_tuple_signing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: persidict
|
|
3
|
-
Version: 0.32.
|
|
3
|
+
Version: 0.32.8
|
|
4
4
|
Summary: Simple persistent key-value store for Python. Values are stored as files on a disk or as S3 objects on AWS cloud.
|
|
5
5
|
Keywords: persistence,dicts,distributed,parallel
|
|
6
6
|
Author: Vlad (Volodymyr) Pavlov
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "persidict"
|
|
7
|
-
version = "0.32.
|
|
7
|
+
version = "0.32.8"
|
|
8
8
|
description = "Simple persistent key-value store for Python. Values are stored as files on a disk or as S3 objects on AWS cloud."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -139,23 +139,9 @@ class FileDirDict(PersiDict):
|
|
|
139
139
|
def __len__(self) -> int:
|
|
140
140
|
""" Get the number of key-value pairs in the dictionary."""
|
|
141
141
|
|
|
142
|
-
num_files = 0
|
|
143
142
|
suffix = "." + self.file_type
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
while stack:
|
|
147
|
-
path = stack.pop()
|
|
148
|
-
try:
|
|
149
|
-
with os.scandir(path) as it:
|
|
150
|
-
for entry in it:
|
|
151
|
-
if entry.is_dir(follow_symlinks=False):
|
|
152
|
-
stack.append(entry.path)
|
|
153
|
-
elif entry.is_file(follow_symlinks=False) and entry.name.endswith(suffix):
|
|
154
|
-
num_files += 1
|
|
155
|
-
except PermissionError:
|
|
156
|
-
continue
|
|
157
|
-
|
|
158
|
-
return num_files
|
|
143
|
+
return sum(1 for _, _, files in os.walk(self._base_dir)
|
|
144
|
+
for f in files if f.endswith(suffix))
|
|
159
145
|
|
|
160
146
|
|
|
161
147
|
def clear(self) -> None:
|
|
@@ -174,6 +160,7 @@ class FileDirDict(PersiDict):
|
|
|
174
160
|
len(os.listdir(subdir_name)) == 0 ):
|
|
175
161
|
os.rmdir(subdir_name)
|
|
176
162
|
|
|
163
|
+
|
|
177
164
|
def _build_full_path(self
|
|
178
165
|
, key:SafeStrTuple
|
|
179
166
|
, create_subdirs:bool=False
|
|
@@ -424,7 +411,8 @@ class FileDirDict(PersiDict):
|
|
|
424
411
|
to_return.append(key_to_return)
|
|
425
412
|
|
|
426
413
|
if "values" in result_type:
|
|
427
|
-
|
|
414
|
+
full_path = os.path.join(dir_name, f)
|
|
415
|
+
value_to_return = self._read_from_file(full_path)
|
|
428
416
|
to_return.append(value_to_return)
|
|
429
417
|
|
|
430
418
|
if len(result_type) == 1:
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import string
|
|
2
|
-
from copy import deepcopy
|
|
3
2
|
|
|
4
3
|
SAFE_CHARS_SET = set(string.ascii_letters + string.digits + "()_-~.=")
|
|
5
4
|
SAFE_STRING_MAX_LENGTH = 254
|
|
6
5
|
|
|
7
6
|
def get_safe_chars() -> set[str]:
|
|
8
7
|
"""Return a set of allowed characters."""
|
|
9
|
-
return
|
|
8
|
+
return SAFE_CHARS_SET.copy()
|
|
10
9
|
|
|
11
10
|
def replace_unsafe_chars(a_str:str, replace_with:str) -> str :
|
|
12
11
|
""" Replace unsafe (special) characters with allowed (safe) ones."""
|
|
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
|