firebird-base 2.0.2__tar.gz → 2.0.4__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 (21) hide show
  1. {firebird_base-2.0.2 → firebird_base-2.0.4}/.gitignore +2 -2
  2. firebird_base-2.0.4/PKG-INFO +102 -0
  3. firebird_base-2.0.4/README.md +50 -0
  4. {firebird_base-2.0.2 → firebird_base-2.0.4}/pyproject.toml +14 -8
  5. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/__about__.py +1 -1
  6. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/buffer.py +52 -54
  7. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/collections.py +125 -118
  8. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/config.py +107 -112
  9. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/hooks.py +54 -156
  10. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/logging.py +29 -25
  11. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/protobuf.py +52 -47
  12. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/signal.py +30 -21
  13. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/strconv.py +99 -97
  14. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/trace.py +70 -67
  15. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/types.py +112 -104
  16. firebird_base-2.0.2/PKG-INFO +0 -211
  17. firebird_base-2.0.2/README.md +0 -161
  18. {firebird_base-2.0.2 → firebird_base-2.0.4}/LICENSE +0 -0
  19. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/__init__.py +0 -0
  20. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/config_pb2.py +0 -0
  21. {firebird_base-2.0.2 → firebird_base-2.0.4}/src/firebird/base/config_pb2.pyi +0 -0
@@ -133,8 +133,8 @@ dmypy.json
133
133
  *.wpr
134
134
  *.wpu
135
135
 
136
- # Sphinx build
137
- docs/_build
136
+ # Doc build
137
+ docs/site
138
138
  docs/firebird-base.docset/
139
139
 
140
140
  # Other local files and directories
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.5
2
+ Name: firebird-base
3
+ Version: 2.0.4
4
+ Summary: Firebird base modules for Python
5
+ Project-URL: Home, https://github.com/FirebirdSQL/python3-base
6
+ Project-URL: Documentation, https://firebird-base.rtfd.io
7
+ Project-URL: Issues, https://github.com/FirebirdSQL/python3-base/issues
8
+ Project-URL: Funding, https://github.com/sponsors/pcisar
9
+ Project-URL: Source, https://github.com/FirebirdSQL/python3-base
10
+ Author-email: Pavel Cisar <pcisar@users.sourceforge.net>
11
+ License:
12
+ MIT License
13
+ ===========
14
+
15
+ Copyright (c) 2019 The Firebird Project (www.firebirdsql.org)
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
34
+ License-File: LICENSE
35
+ Keywords: Collections,Configuration,Firebird,Hooks,Logging,Protobuf,Signals,Trace
36
+ Classifier: Development Status :: 5 - Production/Stable
37
+ Classifier: Intended Audience :: Developers
38
+ Classifier: License :: OSI Approved :: MIT License
39
+ Classifier: Operating System :: MacOS
40
+ Classifier: Operating System :: Microsoft :: Windows
41
+ Classifier: Operating System :: POSIX :: Linux
42
+ Classifier: Programming Language :: Python :: 3 :: Only
43
+ Classifier: Programming Language :: Python :: 3.11
44
+ Classifier: Programming Language :: Python :: 3.12
45
+ Classifier: Programming Language :: Python :: 3.13
46
+ Classifier: Programming Language :: Python :: 3.14
47
+ Classifier: Programming Language :: Python :: 3.15
48
+ Classifier: Topic :: Software Development
49
+ Requires-Python: <4,>=3.11
50
+ Requires-Dist: protobuf~=5.29
51
+ Description-Content-Type: text/markdown
52
+
53
+ # firebird-base
54
+
55
+ ## Firebird base modules for Python
56
+
57
+ [![PyPI - Version](https://img.shields.io/pypi/v/firebird-base.svg)](https://pypi.org/project/firebird-base)
58
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/firebird-base.svg)](https://pypi.org/project/firebird-base)
59
+ [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
60
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/firebird-base)](https://pypi.org/project/firebird-base)
61
+ [![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/pypi/firebird-base)](https://libraries.io/pypi/firebird-base)
62
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/FirebirdSQL/python3-base)
63
+
64
+ `firebird-base` provides reusable Python modules used by the [Firebird Project](https://github.com/FirebirdSQL)
65
+ and other applications. The modules can be used independently of the Firebird database.
66
+
67
+ ## Installation
68
+
69
+ Requires Python `>=3.11,<4`.
70
+
71
+ ```console
72
+ pip install firebird-base
73
+ ```
74
+
75
+ Import the submodules you need, for example `import firebird.base.config`.
76
+
77
+ ## Documentation
78
+
79
+ For module guides and API details, see the [firebird-base documentation](https://firebird-base.readthedocs.io/).
80
+
81
+ ## Agent skill
82
+
83
+ The [firebird-base skill](skills/firebird-base/SKILL.md) provides guidance for using individual
84
+ modules. Download `firebird-base-<version>-skill.zip` from
85
+ [GitHub releases](https://github.com/FirebirdSQL/python3-base/releases) and extract its
86
+ `firebird-base/` directory into the skill directory used by your coding agent. You can also
87
+ copy or link the `skills/firebird-base` directory from this repository:
88
+
89
+ | Agent | User skill directory |
90
+ | --- | --- |
91
+ | [Codex](https://learn.chatgpt.com/docs/build-skills) | `~/.codex/skills/` |
92
+ | [Claude Code](https://code.claude.com/docs/en/skills) | `~/.claude/skills/` |
93
+ | [Gemini CLI](https://geminicli.com/docs/cli/using-agent-skills/) | `~/.agents/skills/` (also supports `~/.gemini/skills/`) |
94
+
95
+ ## Development
96
+
97
+ For the package map, dependencies, build and test workflow, and module maintenance notes,
98
+ see [development/README.md](development/README.md) and the other files in [`development/`](development/).
99
+
100
+ ## License
101
+
102
+ `firebird-base` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
@@ -0,0 +1,50 @@
1
+ # firebird-base
2
+
3
+ ## Firebird base modules for Python
4
+
5
+ [![PyPI - Version](https://img.shields.io/pypi/v/firebird-base.svg)](https://pypi.org/project/firebird-base)
6
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/firebird-base.svg)](https://pypi.org/project/firebird-base)
7
+ [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
8
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/firebird-base)](https://pypi.org/project/firebird-base)
9
+ [![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/pypi/firebird-base)](https://libraries.io/pypi/firebird-base)
10
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/FirebirdSQL/python3-base)
11
+
12
+ `firebird-base` provides reusable Python modules used by the [Firebird Project](https://github.com/FirebirdSQL)
13
+ and other applications. The modules can be used independently of the Firebird database.
14
+
15
+ ## Installation
16
+
17
+ Requires Python `>=3.11,<4`.
18
+
19
+ ```console
20
+ pip install firebird-base
21
+ ```
22
+
23
+ Import the submodules you need, for example `import firebird.base.config`.
24
+
25
+ ## Documentation
26
+
27
+ For module guides and API details, see the [firebird-base documentation](https://firebird-base.readthedocs.io/).
28
+
29
+ ## Agent skill
30
+
31
+ The [firebird-base skill](skills/firebird-base/SKILL.md) provides guidance for using individual
32
+ modules. Download `firebird-base-<version>-skill.zip` from
33
+ [GitHub releases](https://github.com/FirebirdSQL/python3-base/releases) and extract its
34
+ `firebird-base/` directory into the skill directory used by your coding agent. You can also
35
+ copy or link the `skills/firebird-base` directory from this repository:
36
+
37
+ | Agent | User skill directory |
38
+ | --- | --- |
39
+ | [Codex](https://learn.chatgpt.com/docs/build-skills) | `~/.codex/skills/` |
40
+ | [Claude Code](https://code.claude.com/docs/en/skills) | `~/.claude/skills/` |
41
+ | [Gemini CLI](https://geminicli.com/docs/cli/using-agent-skills/) | `~/.agents/skills/` (also supports `~/.gemini/skills/`) |
42
+
43
+ ## Development
44
+
45
+ For the package map, dependencies, build and test workflow, and module maintenance notes,
46
+ see [development/README.md](development/README.md) and the other files in [`development/`](development/).
47
+
48
+ ## License
49
+
50
+ `firebird-base` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
@@ -22,6 +22,8 @@ classifiers = [
22
22
  "Programming Language :: Python :: 3.11",
23
23
  "Programming Language :: Python :: 3.12",
24
24
  "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Programming Language :: Python :: 3.15",
25
27
  "Operating System :: POSIX :: Linux",
26
28
  "Operating System :: Microsoft :: Windows",
27
29
  "Operating System :: MacOS",
@@ -54,6 +56,11 @@ packages = ["src/firebird"]
54
56
  dependencies = [
55
57
  ]
56
58
 
59
+ [tool.hatch.envs.default.scripts]
60
+ build-config-proto = "protoc -I../protobuf --python_out=src --pyi_out=src firebird/base/config.proto"
61
+ build-test-proto = "protoc -Itests --python_out=./tests --pyi_out=./tests base_test.proto"
62
+ build-skill = "python scripts/build_skill.py"
63
+
57
64
  [tool.hatch.envs.hatch-test]
58
65
  extra-args = ["-vv"]
59
66
  dependencies = [
@@ -62,22 +69,21 @@ dependencies = [
62
69
  ]
63
70
 
64
71
  [[tool.hatch.envs.hatch-test.matrix]]
65
- python = ["3.11", "3.12", "3.13"]
72
+ python = ["3.11", "3.12", "3.13", "3.14", "3.15"]
66
73
 
67
74
  [tool.hatch.envs.doc]
68
75
  detached = false
69
- platforms = ["linux"]
70
76
  dependencies = [
71
- "Sphinx==7.2.6",
72
- "sphinx-bootstrap-theme>=0.8.1",
73
- "sphinx-autodoc-typehints>=1.24.0",
77
+ "zensical",
78
+ "mkdocstrings-python",
74
79
  "doc2dash>=3.0.0"
75
80
  ]
76
81
  [tool.hatch.envs.doc.scripts]
77
- build = "cd docs ; make html"
82
+ build = "cd docs && zensical build {args}"
83
+ serve = "cd docs && zensical serve {args}"
78
84
  docset = [
79
- "cd docs ; doc2dash -u https://firebird-base.readthedocs.io/en/latest/ -f -i ./_static/fb-favicon.png -n firebird-base ./_build/html/",
80
- "cd docs; VERSION=`hatch version` ; tar --exclude='.DS_Store' -cvzf ../dist/firebird-base-$VERSION-docset.tgz firebird-base.docset",
85
+ "cd docs ; doc2dash -u https://firebird-base.readthedocs.io/en/latest/ -f -i ./site/assets/fb-favicon.png -n firebird-base ./site/",
86
+ "cd docs; VERSION=$(python -c 'from firebird.base.__about__ import __version__; print(__version__)') && tar --exclude='.DS_Store' -cvzf ../dist/firebird-base-$VERSION-docset.tgz firebird-base.docset",
81
87
  ]
82
88
 
83
89
  [tool.ruff]
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "2.0.2"
4
+ __version__ = "2.0.4"
@@ -34,9 +34,7 @@
34
34
  # ______________________________________
35
35
 
36
36
 
37
- """Firebird Base - Memory buffer manager
38
-
39
- This module provides a `MemoryBuffer` class for managing raw memory buffers,
37
+ """This module provides a `MemoryBuffer` class for managing raw memory buffers,
40
38
  offering a convenient and consistent API for reading and writing various data types
41
39
  (integers of different sizes, strings with different termination/prefixing styles, raw bytes).
42
40
  It's particularly useful for tasks involving binary data serialization/deserialization,
@@ -44,12 +42,13 @@ such as implementing network protocols or handling custom file formats.
44
42
 
45
43
  The underlying memory storage can be customized via a `BufferFactory`. Two factories
46
44
  are provided:
45
+
47
46
  - `BytesBufferFactory`: Uses Python's built-in `bytearray`.
48
47
  - `CTypesBufferFactory`: Uses `ctypes.create_string_buffer` for potentially different
49
48
  memory characteristics or C-level interoperability.
50
49
 
51
- Example::
52
-
50
+ Example:
51
+ ```python
53
52
  from firebird.base.buffer import MemoryBuffer, ByteOrder
54
53
 
55
54
  # Create a buffer (default uses bytearray)
@@ -73,10 +72,9 @@ Example::
73
72
  print(f"Extra bytes: {extra}") # Output: Extra bytes: b'\\n\\x0b'
74
73
  print(f"Final position: {buf.pos}") # Output: Final position: 7
75
74
  print(f"Raw buffer: {buf.get_raw()}") # Output: Raw buffer: bytearray(b'\\x02\\x01\\x02Hi\\n\\x0b\\x00\\x00\\x00')
75
+ ```
76
76
  """
77
77
 
78
-
79
-
80
78
  from __future__ import annotations
81
79
 
82
80
  from ctypes import create_string_buffer, memset
@@ -102,22 +100,22 @@ class BufferFactory(Protocol): # pragma: no cover
102
100
  is bytes to specify a potentially different final size.
103
101
 
104
102
  Returns:
105
- The created mutable buffer object (e.g., `bytearray`, `ctypes.c_char_Array`).
103
+ The created mutable buffer object (e.g., [bytearray][] or a ctypes array of characters).
106
104
  """
107
105
  def clear(self, buffer: Any) -> None:
108
106
  """Fill the buffer entirely with null bytes (zeros).
109
107
 
110
- Argument:
108
+ Arguments:
111
109
  buffer: A memory buffer previously created by this factory's `create()` method.
112
110
  """
113
111
  def get_raw(self, buffer: Any) -> bytes | bytearray:
114
- """Return the buffer's content as a standard `bytes` or `bytearray`.
112
+ """Return the buffer's content as a standard [bytes][] or [bytearray][].
115
113
 
116
114
  This method is necessary to provide a consistent way to access the raw
117
115
  byte sequence, as the buffer object returned by `create` might be of a
118
- different type (e.g., `ctypes` arrays have a `.raw` attribute).
116
+ different type (e.g., [ctypes][] arrays have a `raw` attribute).
119
117
 
120
- Argument:
118
+ Arguments:
121
119
  buffer: A memory buffer previously created by this factory's `create()` method.
122
120
 
123
121
  Returns:
@@ -125,10 +123,10 @@ class BufferFactory(Protocol): # pragma: no cover
125
123
  """
126
124
 
127
125
  class BytesBufferFactory:
128
- """Buffer factory using Python's `bytearray` for storage."""
126
+ """Buffer factory using Python's [bytearray][] for storage."""
129
127
  def create(self, init_or_size: int | bytes, size: int | None=None) -> bytearray:
130
128
  """This function creates a mutable character buffer. The returned object is a
131
- `bytearray`.
129
+ [bytearray][].
132
130
 
133
131
  Arguments:
134
132
  init_or_size: Must be an integer which specifies the size of the array,
@@ -136,13 +134,13 @@ class BytesBufferFactory:
136
134
  size: Size of the array.
137
135
 
138
136
  Important:
139
- Although arguments are the same as for `ctypes.create_string_buffer`,
137
+ Although arguments are the same as for [ctypes.create_string_buffer][],
140
138
  the behavior is different when new buffer is initialized from bytes:
141
139
 
142
140
  1. If there are more bytes than specified `size`, this function copies only
143
- `size` bytes into new buffer. The `~ctypes.create_string_buffer` raises
141
+ `size` bytes into new buffer. The [ctypes.create_string_buffer][] raises
144
142
  an excpetion.
145
- 2. Unlike `~ctypes.create_string_buffer` when `size` is NOT specified,
143
+ 2. Unlike [ctypes.create_string_buffer][] when `size` is NOT specified,
146
144
  the buffer is NOT made one item larger than its length so that the last
147
145
  element in the array is a NUL termination character.
148
146
  """
@@ -161,10 +159,10 @@ class BytesBufferFactory:
161
159
  return buffer
162
160
 
163
161
  class CTypesBufferFactory:
164
- """Buffer factory using `ctypes.create_string_buffer` (array of c_char)."""
162
+ """Buffer factory using [ctypes.create_string_buffer][] (array of `c_char`)."""
165
163
  def create(self, init_or_size: int | bytes, size: int | None=None) -> bytearray:
166
- """This function creates a `ctypes` mutable character buffer. The returned object
167
- is an array of `ctypes.c_char`.
164
+ """This function creates a [ctypes][] mutable character buffer. The returned object
165
+ is an array of [ctypes.c_char][].
168
166
 
169
167
  Arguments:
170
168
  init_or_size: Must be an integer which specifies the size of the array,
@@ -172,13 +170,13 @@ class CTypesBufferFactory:
172
170
  size: Size of the array.
173
171
 
174
172
  Important:
175
- Although arguments are the same as for `ctypes.create_string_buffer`,
173
+ Although arguments are the same as for [ctypes.create_string_buffer][],
176
174
  the behavior is different when new buffer is initialized from bytes:
177
175
 
178
176
  1. If there are more bytes than specified `size`, this function copies only
179
- `size` bytes into new buffer. The `~ctypes.create_string_buffer` raises
177
+ `size` bytes into new buffer. The [ctypes.create_string_buffer][] raises
180
178
  an excpetion.
181
- 2. Unlike `~ctypes.create_string_buffer` when `size` is NOT specified,
179
+ 2. Unlike [ctypes.create_string_buffer][] when `size` is NOT specified,
182
180
  the buffer is NOT made one item larger than its length so that the last
183
181
  element in the array is a NUL termination character.
184
182
  """
@@ -194,7 +192,7 @@ class CTypesBufferFactory:
194
192
 
195
193
  Arguments:
196
194
  buffer: The ctypes buffer.
197
- init: The byte value to fill with (default 0).
195
+ init: The byte value to fill with.
198
196
  """
199
197
  memset(buffer, init, len(buffer))
200
198
  def get_raw(self, buffer: Any) -> bytes | bytearray:
@@ -230,19 +228,19 @@ class MemoryBuffer:
230
228
  def __init__(self, init: int | bytes, size: int | None=None, *,
231
229
  factory: type[BufferFactory]=BytesBufferFactory, eof_marker: int | None=None,
232
230
  max_size: int | Sentinel=UNLIMITED, byteorder: ByteOrder=ByteOrder.LITTLE):
233
- #: Buffer factory instance used by manager [default: `BytesBufferFactory`].
234
231
  self.factory: BufferFactory = factory()
235
- #: The memory buffer. The actual data type of buffer depends on `buffer factory`,
236
- #: but it must provide direct acces to cells, slices and length like `bytearray`.
232
+ "Buffer factory instance used by manager [default: `BytesBufferFactory`]."
237
233
  self.raw: bytearray = self.factory.create(init, size)
238
- #: Current position in buffer, i.e. the next read/writen byte would be at this position.
234
+ """The memory buffer. The actual data type of buffer depends on `buffer factory`,
235
+ but it must provide direct acces to cells, slices and length like `bytearray`."""
239
236
  self.pos: int = 0
240
- #: Value that indicates the end of data. Could be None.
237
+ "Current position in buffer, i.e. the next read/writen byte would be at this position."
241
238
  self.eof_marker: int = eof_marker
242
- #: The buffer couldn't grow beyond specified number of bytes [default: `.UNLIMITED`].
239
+ "Value that indicates the end of data. Could be None."
243
240
  self.max_size: int | Sentinel = max_size
244
- #: The byte order used to read/write numbers [default: `.LITTLE`].
241
+ "The buffer couldn't grow beyond specified number of bytes [default: `UNLIMITED`]."
245
242
  self.byteorder: ByteOrder = byteorder
243
+ "The byte order used to read/write numbers [default: `LITTLE`]."
246
244
  def _ensure_space(self, size: int) -> None:
247
245
  if len(self.raw) < self.pos + size:
248
246
  self.resize(self.pos + size)
@@ -282,7 +280,7 @@ class MemoryBuffer:
282
280
  return True
283
281
  return False
284
282
  def get_raw(self) -> bytes | bytearray:
285
- """Return the underlying buffer's content as `bytes` or `bytearray`.
283
+ """Return the underlying buffer's content as [bytes][] or [bytearray][].
286
284
 
287
285
  Use this method for generic access to the raw buffer content instead of
288
286
  accessing the `raw` attribute directly, as the type of `raw` can vary
@@ -321,7 +319,7 @@ class MemoryBuffer:
321
319
  size: Value size in bytes.
322
320
  signed: Write as signed or unsigned integer.
323
321
 
324
- Raise:
322
+ Raises:
325
323
  BufferError: If resizing is needed but exceeds `max_size`.
326
324
  """
327
325
  self.write(value.to_bytes(size, self.byteorder.value, signed=signed))
@@ -331,7 +329,7 @@ class MemoryBuffer:
331
329
  Arguments:
332
330
  value: The integer value to write.
333
331
 
334
- Raise:
332
+ Raises:
335
333
  BufferError: If resizing is needed but exceeds `max_size`.
336
334
  """
337
335
  self.write_number(value, 2)
@@ -341,7 +339,7 @@ class MemoryBuffer:
341
339
  Arguments:
342
340
  value: The integer value to write.
343
341
 
344
- Raise:
342
+ Raises:
345
343
  BufferError: If resizing is needed but exceeds `max_size`.
346
344
  """
347
345
  self.write_number(value, 4)
@@ -351,7 +349,7 @@ class MemoryBuffer:
351
349
  Arguments:
352
350
  value: The integer value to write.
353
351
 
354
- Raise:
352
+ Raises:
355
353
  BufferError: If resizing is needed but exceeds `max_size`.
356
354
  """
357
355
  self.write_number(value, 8)
@@ -360,10 +358,10 @@ class MemoryBuffer:
360
358
 
361
359
  Arguments:
362
360
  value: The string to write.
363
- encoding: Encoding to use (default: 'ascii').
364
- errors: Encoding error handling scheme (default: 'strict').
361
+ encoding: Encoding to use.
362
+ errors: Encoding error handling scheme.
365
363
 
366
- Raise:
364
+ Raises:
367
365
  BufferError: If resizing is needed but exceeds `max_size`.
368
366
  UnicodeEncodeError: If `value` cannot be encoded using `encoding`.
369
367
  """
@@ -374,10 +372,10 @@ class MemoryBuffer:
374
372
 
375
373
  Arguments:
376
374
  value: The string to write.
377
- encoding: Encoding to use (default: 'ascii').
378
- errors: Encoding error handling scheme (default: 'strict').
375
+ encoding: Encoding to use.
376
+ errors: Encoding error handling scheme.
379
377
 
380
- Raise:
378
+ Raises:
381
379
  BufferError: If resizing is needed but exceeds `max_size`.
382
380
  """
383
381
  value = value.encode(encoding, errors)
@@ -388,10 +386,10 @@ class MemoryBuffer:
388
386
 
389
387
  Arguments:
390
388
  value: The string to write.
391
- encoding: Encoding to use (default: 'ascii').
392
- errors: Encoding error handling scheme (default: 'strict').
389
+ encoding: Encoding to use.
390
+ errors: Encoding error handling scheme.
393
391
 
394
- Raise:
392
+ Raises:
395
393
  BufferError: If resizing is needed but exceeds `max_size`.
396
394
  """
397
395
  value = value.encode(encoding, errors)
@@ -404,7 +402,7 @@ class MemoryBuffer:
404
402
 
405
403
  Arguments:
406
404
  size: Number of bytes to read. If negative, reads all data from the
407
- current position to the end of the buffer (default: -1).
405
+ current position to the end of the buffer.
408
406
  Returns:
409
407
  The bytes read.
410
408
 
@@ -417,14 +415,14 @@ class MemoryBuffer:
417
415
  result = self.raw[self.pos: self.pos + size]
418
416
  self.pos += size
419
417
  return result
420
- def read_number(self, size: int, *, signed=False) -> int:
418
+ def read_number(self, size: int, *, signed: bool=False) -> int:
421
419
  """Read a number of `size` bytes from current position using `self.byteorder`.
422
420
 
423
421
  Advances the position by `size`.
424
422
 
425
423
  Arguments:
426
424
  size: The number of bytes representing the number.
427
- signed: Whether to interpret the bytes as a signed integer (default: False).
425
+ signed: Whether to interpret the bytes as a signed integer.
428
426
 
429
427
  Returns:
430
428
  The integer value read.
@@ -462,8 +460,8 @@ class MemoryBuffer:
462
460
  Advances the position past the null terminator.
463
461
 
464
462
  Arguments:
465
- encoding: Encoding to use for decoding (default: 'ascii').
466
- errors: Decoding error handling scheme (default: 'strict').
463
+ encoding: Encoding to use for decoding.
464
+ errors: Decoding error handling scheme.
467
465
 
468
466
  Returns:
469
467
  The decoded string (excluding the null terminator).
@@ -482,8 +480,8 @@ class MemoryBuffer:
482
480
  """Read Pascal string (1 byte length followed by string data).
483
481
 
484
482
  Arguments:
485
- encoding: Encoding to use for decoding (default: 'ascii').
486
- errors: Decoding error handling scheme (default: 'strict').
483
+ encoding: Encoding to use for decoding.
484
+ errors: Decoding error handling scheme.
487
485
 
488
486
  Returns:
489
487
  The decoded string.
@@ -497,8 +495,8 @@ class MemoryBuffer:
497
495
  """Read sized string (2 byte length followed by data).
498
496
 
499
497
  Arguments:
500
- encoding: Encoding to use for decoding (default: 'ascii').
501
- errors: Decoding error handling scheme (default: 'strict').
498
+ encoding: Encoding to use for decoding.
499
+ errors: Decoding error handling scheme.
502
500
 
503
501
  Returns:
504
502
  The decoded string.