shelfdb 3.1.0__tar.gz → 3.1.1__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.
Files changed (23) hide show
  1. {shelfdb-3.1.0 → shelfdb-3.1.1}/PKG-INFO +1 -1
  2. {shelfdb-3.1.0 → shelfdb-3.1.1}/pyproject.toml +1 -1
  3. {shelfdb-3.1.0 → shelfdb-3.1.1}/pyproject.toml.orig +1 -1
  4. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/shelf/query.py +1 -1
  5. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/shelf/storage.py +7 -3
  6. {shelfdb-3.1.0 → shelfdb-3.1.1}/LICENSE +0 -0
  7. {shelfdb-3.1.0 → shelfdb-3.1.1}/README.md +0 -0
  8. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/__init__.py +0 -0
  9. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/__main__.py +0 -0
  10. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/cli.py +0 -0
  11. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/client/__init__.py +0 -0
  12. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/client/client.py +0 -0
  13. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/protocol/__init__.py +0 -0
  14. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/protocol/demo_poc.py +0 -0
  15. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/protocol/protocol.py +0 -0
  16. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/protocol/query_result.py +0 -0
  17. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/protocol/server.py +0 -0
  18. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/protocol/session.py +0 -0
  19. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/protocol/write_admission.py +0 -0
  20. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/shelf/__init__.py +0 -0
  21. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/shelf/db.py +0 -0
  22. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/shelf/schema.py +0 -0
  23. {shelfdb-3.1.0 → shelfdb-3.1.1}/src/shelfdb/target.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shelfdb
3
- Version: 3.1.0
3
+ Version: 3.1.1
4
4
  Summary: A tiny database for Python
5
5
  Author: Nitipit Nontasuwan
6
6
  Author-email: Nitipit Nontasuwan <nitipit@gmail.com>
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "shelfdb"
7
- version = "3.1.0"
7
+ version = "3.1.1"
8
8
  description = "A tiny database for Python"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12,<3.15"
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "shelfdb"
7
- version = "3.1.0"
7
+ version = "3.1.1"
8
8
  description = "A tiny database for Python"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12,<3.15"
@@ -80,7 +80,7 @@ class ShelfQuery:
80
80
  def _load_items(self, items: Iterator[Item]) -> Iterator[Item]:
81
81
  for item in items:
82
82
  if item.value is UNDEF:
83
- if (value := self._store.get(item.key)) is not None:
83
+ if (value := self._store.get(item.key, UNDEF)) is not UNDEF:
84
84
  yield Item(item.key, value)
85
85
  else:
86
86
  yield item
@@ -166,11 +166,15 @@ class ShelfStore:
166
166
  ):
167
167
  self._handle = _ShelfHandle(tx, db)
168
168
 
169
- def get(self, key: str) -> Any | None:
170
- """Return the unpacked value for ``key`` when present."""
169
+ def get(self, key: str, default: Any = None) -> Any:
170
+ """Return the unpacked value, or ``default`` only when the key is absent.
171
+
172
+ A stored MessagePack null is a present value and always returns ``None``.
173
+ Callers needing to distinguish it from absence can supply a sentinel.
174
+ """
171
175
  value = self._handle.tx.get(key.encode(), db=self._handle.db)
172
176
  if value is None:
173
- return None
177
+ return default
174
178
  return unpackb(value)
175
179
 
176
180
  def put(self, key: str, value: Any) -> MutationResult:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes