scruby 0.12.0__py3-none-any.whl → 0.12.2__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.
Potentially problematic release.
This version of scruby might be problematic. Click here for more details.
scruby/db.py
CHANGED
|
@@ -11,7 +11,7 @@ import zlib
|
|
|
11
11
|
from collections.abc import Callable
|
|
12
12
|
from pathlib import Path as SyncPath
|
|
13
13
|
from shutil import rmtree
|
|
14
|
-
from typing import Any, Never, TypeVar, assert_never
|
|
14
|
+
from typing import Any, Literal, Never, TypeVar, assert_never
|
|
15
15
|
|
|
16
16
|
import orjson
|
|
17
17
|
from anyio import Path, to_thread
|
|
@@ -123,7 +123,7 @@ class Scruby[T]:
|
|
|
123
123
|
meta_json = meta.model_dump_json()
|
|
124
124
|
await meta_path.write_text(meta_json, "utf-8")
|
|
125
125
|
|
|
126
|
-
async def _counter_documents(self,
|
|
126
|
+
async def _counter_documents(self, step: Literal[1, -1]) -> None:
|
|
127
127
|
"""Asynchronous method for management of documents in metadata of collection.
|
|
128
128
|
|
|
129
129
|
This method is for internal use.
|
|
@@ -131,9 +131,7 @@ class Scruby[T]:
|
|
|
131
131
|
meta_path = await self._get_meta_path()
|
|
132
132
|
meta_json = await meta_path.read_text("utf-8")
|
|
133
133
|
meta: _Meta = self.__meta.model_validate_json(meta_json)
|
|
134
|
-
meta.counter_documents +=
|
|
135
|
-
if meta.counter_documents < 0:
|
|
136
|
-
meta.counter_documents = 0
|
|
134
|
+
meta.counter_documents += step
|
|
137
135
|
meta_json = meta.model_dump_json()
|
|
138
136
|
await meta_path.write_text(meta_json, "utf-8")
|
|
139
137
|
|
|
@@ -156,8 +154,6 @@ class Scruby[T]:
|
|
|
156
154
|
meta_json = meta_path.read_text("utf-8")
|
|
157
155
|
meta: _Meta = self.__meta.model_validate_json(meta_json)
|
|
158
156
|
meta.counter_documents += number
|
|
159
|
-
if meta.counter_documents < 0:
|
|
160
|
-
meta.counter_documents = 0
|
|
161
157
|
meta_json = meta.model_dump_json()
|
|
162
158
|
meta_path.write_text(meta_json, "utf-8")
|
|
163
159
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
scruby/__init__.py,sha256=GOVcjXmcOEDBbJQJDJlQq-x3M-VGJaMSN278EXsl2po,884
|
|
2
2
|
scruby/constants.py,sha256=3LZfcxcuRqwzoB0-iogLMjKBZRdxfWJmTbyPwVRhQgY,1007
|
|
3
|
-
scruby/db.py,sha256
|
|
3
|
+
scruby/db.py,sha256=-xNn0S2fcIQoar4fYk6ER2p7dlDIeUY-BAD6LLYtFFo,21733
|
|
4
4
|
scruby/errors.py,sha256=aHQri4LNcFVQrSHwjyzb1fL8O49SwjYEU4QgMOo4uyA,622
|
|
5
5
|
scruby/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
scruby-0.12.
|
|
7
|
-
scruby-0.12.
|
|
8
|
-
scruby-0.12.
|
|
9
|
-
scruby-0.12.
|
|
6
|
+
scruby-0.12.2.dist-info/METADATA,sha256=YK-ZgnJEcS7y0R27hh7GTlRSAexq5H9olStIQKZL7sc,10925
|
|
7
|
+
scruby-0.12.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
+
scruby-0.12.2.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
|
|
9
|
+
scruby-0.12.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|