scruby 2.0.0__py3-none-any.whl → 2.0.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.
- scruby/db.py +2 -0
- scruby/mixins/collection.py +1 -1
- {scruby-2.0.0.dist-info → scruby-2.0.2.dist-info}/METADATA +30 -6
- {scruby-2.0.0.dist-info → scruby-2.0.2.dist-info}/RECORD +7 -7
- {scruby-2.0.0.dist-info → scruby-2.0.2.dist-info}/WHEEL +0 -0
- {scruby-2.0.0.dist-info → scruby-2.0.2.dist-info}/licenses/GPL-3.0-LICENSE +0 -0
- {scruby-2.0.0.dist-info → scruby-2.0.2.dist-info}/licenses/MIT-LICENSE +0 -0
scruby/db.py
CHANGED
|
@@ -255,6 +255,7 @@ class Scruby(
|
|
|
255
255
|
@staticmethod
|
|
256
256
|
def run(
|
|
257
257
|
db_root: str = "ScrubyDB",
|
|
258
|
+
hash_reduce_left: Literal[7, 6, 5] = 7,
|
|
258
259
|
max_workers: int | None = None,
|
|
259
260
|
plugins: list[Any] | None = None,
|
|
260
261
|
) -> None:
|
|
@@ -278,6 +279,7 @@ class Scruby(
|
|
|
278
279
|
raise AssertionError(msg)
|
|
279
280
|
|
|
280
281
|
ScrubyConfig.db_root = db_root
|
|
282
|
+
ScrubyConfig.HASH_REDUCE_LEFT = hash_reduce_left
|
|
281
283
|
ScrubyConfig.max_workers = max_workers
|
|
282
284
|
ScrubyConfig.plugins = plugins
|
|
283
285
|
ScrubyConfig.init_params()
|
scruby/mixins/collection.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scruby
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Asynchronous library for building and managing a hybrid database, by scheme of key-value.
|
|
5
5
|
Project-URL: Bug Tracker, https://github.com/kebasyaty/scruby/issues
|
|
6
6
|
Project-URL: Changelog, https://github.com/kebasyaty/scruby/blob/v2/CHANGELOG.md
|
|
@@ -89,13 +89,13 @@ Description-Content-Type: text/markdown
|
|
|
89
89
|
|
|
90
90
|
<img src="https://raw.githubusercontent.com/kebasyaty/scruby/v2/assets/attention.svg" alt="Attention">
|
|
91
91
|
<p>
|
|
92
|
-
<b>Parameter `ScrubyConfig.HASH_REDUCE_LEFT`:</b>
|
|
92
|
+
<b>Parameter `ScrubyConfig.HASH_REDUCE_LEFT - Scruby.run(hash_reduce_left = 7)`:</b>
|
|
93
93
|
<br>
|
|
94
|
-
|
|
94
|
+
7 = 16 branches in collection (is default) -> ~16000+ docs (for development).
|
|
95
95
|
<br>
|
|
96
96
|
6 = 256 branches in collection -> ~256000+ docs (for small projects).
|
|
97
97
|
<br>
|
|
98
|
-
|
|
98
|
+
5 = 4096 branches in collection -> ~4096000+ docs (for large projects).
|
|
99
99
|
</p>
|
|
100
100
|
|
|
101
101
|
<br>
|
|
@@ -207,7 +207,7 @@ The search effectiveness depends on the number of processor threads.
|
|
|
207
207
|
|
|
208
208
|
import anyio
|
|
209
209
|
from pydantic import Field
|
|
210
|
-
from scruby import Scruby,
|
|
210
|
+
from scruby import ReturnType, Scruby, ScrubyConfig, ScrubyModel
|
|
211
211
|
from pprint import pprint as pp
|
|
212
212
|
|
|
213
213
|
|
|
@@ -262,6 +262,18 @@ async def main() -> None:
|
|
|
262
262
|
else:
|
|
263
263
|
print("No Phone!")
|
|
264
264
|
|
|
265
|
+
# Return phone in JSON format
|
|
266
|
+
phone_details: str | None = phone_coll.find_one(
|
|
267
|
+
filter_fn=lambda doc: doc.model == "Galaxy A26",
|
|
268
|
+
return_type=ReturnType.JSON,
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
# Return phone in Dict format
|
|
272
|
+
phone_details: dict | None = phone_coll.find_one(
|
|
273
|
+
filter_fn=lambda doc: doc.model == "Galaxy A26",
|
|
274
|
+
return_type=ReturnType.DICT,
|
|
275
|
+
)
|
|
276
|
+
|
|
265
277
|
# Full database deletion
|
|
266
278
|
# Hint: The main purpose is tests
|
|
267
279
|
Scruby.napalm()
|
|
@@ -281,7 +293,7 @@ The search effectiveness depends on the number of processor threads.
|
|
|
281
293
|
import anyio
|
|
282
294
|
from typing import Annotated
|
|
283
295
|
from pydantic import Field
|
|
284
|
-
from scruby import Scruby,
|
|
296
|
+
from scruby import ReturnType, Scruby, ScrubyConfig, ScrubyModel
|
|
285
297
|
from pprint import pprint as pp
|
|
286
298
|
|
|
287
299
|
|
|
@@ -355,6 +367,18 @@ async def main() -> None:
|
|
|
355
367
|
else:
|
|
356
368
|
print("No cars!")
|
|
357
369
|
|
|
370
|
+
# Return cars in JSON format
|
|
371
|
+
car_list: str | None = car_coll.find_many(
|
|
372
|
+
filter_fn=lambda doc: doc.brand == "Mazda",
|
|
373
|
+
return_type=ReturnType.JSON,
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
# Return cars in Dict format
|
|
377
|
+
car_list: list[dict] | None = car_coll.find_many(
|
|
378
|
+
filter_fn=lambda doc: doc.brand == "Mazda",
|
|
379
|
+
return_type=ReturnType.DICT,
|
|
380
|
+
)
|
|
381
|
+
|
|
358
382
|
# Full database deletion
|
|
359
383
|
# Hint: The main purpose is tests
|
|
360
384
|
Scruby.napalm()
|
|
@@ -2,20 +2,20 @@ scruby/__init__.py,sha256=40UhjME7WRJ-kHmqju4tMx9t1t6Sq6-EtL1LwgbTbcA,1280
|
|
|
2
2
|
scruby/aggregation.py,sha256=NBFxQqyRqUG2KIuD9fbl4uzSHJWTaskjiZ1YNBa-Zbo,3575
|
|
3
3
|
scruby/cache.py,sha256=rwCnttMVTEjb813OGWFoMSu2likdqAvFw_9gRlcJGUA,3356
|
|
4
4
|
scruby/config.py,sha256=RzCk4oLO4LeTQEuNljWKh9QxQ-6-mXmUpn9AmlpISCU,3514
|
|
5
|
-
scruby/db.py,sha256=
|
|
5
|
+
scruby/db.py,sha256=np6WFjjlXrDnA5nwRDb7Nscwvvn4r2CXvydXnRWeSS0,10194
|
|
6
6
|
scruby/errors.py,sha256=lTWiHzyO5Es9Nkf7quODJjONGn6ifcL95qlpA4epQQM,1386
|
|
7
7
|
scruby/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
scruby/utils.py,sha256=ZwWxSyh_BAOQkXlIqXFOlX2lHVk9rfYGQiVqtTk8PpE,1865
|
|
9
9
|
scruby/mixins/__init__.py,sha256=nT79e80zXliuTGhR9CFosI2-3PQUCKwXbR7wPiFwgrU,669
|
|
10
|
-
scruby/mixins/collection.py,sha256=
|
|
10
|
+
scruby/mixins/collection.py,sha256=VrFadQimpWLHaNcmS-dl6CC94CiOE2w_crxewOdZfvQ,1741
|
|
11
11
|
scruby/mixins/count.py,sha256=asqDsKzjdZHiXybFYTSZje9yhum1atYkBzXddnC2Efw,2391
|
|
12
12
|
scruby/mixins/custom_task.py,sha256=MCelgM8GNBkO6INaWQ5h5NX53zrgV90QWIZDl8Ygmrw,1412
|
|
13
13
|
scruby/mixins/delete.py,sha256=7m7s1NKlFCgVPGyiGcWqXGD_0esgPckdTicl0WTT_Wo,4053
|
|
14
14
|
scruby/mixins/find.py,sha256=Wly-94cqnVizcw6YLfcog2ygxzSNrApEly_OjgG5pMk,8677
|
|
15
15
|
scruby/mixins/keys.py,sha256=vZ_TdLjq0YYinoXocyVKbGSDvf3esPzJe2bIw8nFZrA,9695
|
|
16
16
|
scruby/mixins/update.py,sha256=-gyPQrr358W5pPslI2ZTVAeP12IXvXqqxvt1dqSFmG0,4627
|
|
17
|
-
scruby-2.0.
|
|
18
|
-
scruby-2.0.
|
|
19
|
-
scruby-2.0.
|
|
20
|
-
scruby-2.0.
|
|
21
|
-
scruby-2.0.
|
|
17
|
+
scruby-2.0.2.dist-info/METADATA,sha256=2SotkEcbKEj0oY0tzmxNDc7nWCz4tdpR3XRlSznTyvQ,13009
|
|
18
|
+
scruby-2.0.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
19
|
+
scruby-2.0.2.dist-info/licenses/GPL-3.0-LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
20
|
+
scruby-2.0.2.dist-info/licenses/MIT-LICENSE,sha256=mS0Wz0yGNB63gEcWEnuIb_lldDYV0sjRaO-o_GL6CWE,1074
|
|
21
|
+
scruby-2.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|