tinydantic 0.3.0__tar.gz → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinydantic
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A Pydantic-powered ODM (object-document mapper) for TinyDB
5
5
  Keywords: odm,pydantic,tinydb
6
6
  Author: Chris Wilson
@@ -50,7 +50,7 @@ license-files = [
50
50
  name = "tinydantic"
51
51
  readme = "README.md"
52
52
  requires-python = ">=3.10"
53
- version = "0.3.0"
53
+ version = "0.3.1"
54
54
 
55
55
  [project.urls]
56
56
  Changelog = "https://github.com/tinydantic/tinydantic/blob/main/CHANGELOG.md"
@@ -219,7 +219,7 @@ verbose = 2
219
219
  python_version = "3.10"
220
220
 
221
221
  [tool.pytest.ini_options]
222
- addopts = "--doctest-modules --doctest-glob '*.md' --ignore=docs/superpowers"
222
+ addopts = "--doctest-modules --doctest-glob '*.md'"
223
223
  doctest_optionflags = "NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL"
224
224
  filterwarnings = [
225
225
  # The queries.md "shadowing" section deliberately defines a field named
@@ -2,12 +2,15 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0 OR MIT
4
4
 
5
- """`tinydantic` is a simple Python object-document mapper (ODM) for the
6
- [TinyDB](https://tinydb.readthedocs.io/en/latest/) document database.
5
+ """A simple Python object-document mapper (ODM) for TinyDB.
6
+
7
+ `tinydantic` maps Python objects to and from documents stored in
8
+ the [TinyDB](https://tinydb.readthedocs.io/en/latest/) document
9
+ database.
7
10
 
8
11
  Attributes:
9
12
  __version__: The `tinydantic` package version.
10
- """ # noqa: D205
13
+ """
11
14
 
12
15
  from importlib import metadata
13
16
 
@@ -64,7 +64,7 @@ class DocumentNotFoundError(TinydanticError):
64
64
  """Requested document is not found."""
65
65
 
66
66
  def __init__(self) -> None:
67
- """Initializes an instance of this class."""
67
+ """Initialize with the "Document not found" message."""
68
68
  super().__init__("Document not found")
69
69
 
70
70
 
@@ -72,5 +72,5 @@ class DocumentIDRequiredError(TinydanticError):
72
72
  """Required document ID is missing."""
73
73
 
74
74
  def __init__(self) -> None:
75
- """Initializes an instance of this class."""
75
+ """Initialize with the "Document ID is required" message."""
76
76
  super().__init__("Document ID is required")
@@ -31,7 +31,7 @@ class YAMLStorage(Storage):
31
31
  create_dirs: bool = False,
32
32
  encoding: str | None = None,
33
33
  access_mode: str = "r+",
34
- **kwargs,
34
+ **kwargs: Any,
35
35
  ) -> None:
36
36
  """Create a new instance.
37
37
 
@@ -41,9 +41,14 @@ class YAMLStorage(Storage):
41
41
  Note: Using an access mode other than `r` or `r+` will probably
42
42
  lead to data loss or data corruption!
43
43
 
44
- :param path: Where to store the YAML data.
45
- :param access_mode: mode in which the file is opened (r, r+)
46
- :type access_mode: str
44
+ Args:
45
+ path: Where to store the YAML data.
46
+ create_dirs: Whether to create all missing parent
47
+ directories of the storage file.
48
+ encoding: The encoding used to open the storage file.
49
+ access_mode: Mode in which the file is opened (`r`, `r+`).
50
+ **kwargs: Additional keyword arguments passed to
51
+ `yaml.dump()` when writing data.
47
52
  """
48
53
  super().__init__()
49
54
 
@@ -74,9 +79,9 @@ class YAMLStorage(Storage):
74
79
  def read(self) -> dict[str, dict[str, Any]] | None:
75
80
  """Read data from storage.
76
81
 
77
- :return: A python dict containing the database data from
78
- storage.
79
- :rtype: dict[str, dict[str, Any]] | None
82
+ Returns:
83
+ A python dict containing the database data from storage,
84
+ or `None` if the storage file is empty.
80
85
  """
81
86
  # Get the file size by moving the cursor to the file end and
82
87
  # reading its location
File without changes
File without changes