python-filewrap 0.3.0.1__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.
- {python_filewrap-0.3.0.1 → python_filewrap-0.3.1}/PKG-INFO +1 -1
- {python_filewrap-0.3.0.1 → python_filewrap-0.3.1}/filewrap/__init__.py +17 -7
- {python_filewrap-0.3.0.1 → python_filewrap-0.3.1}/pyproject.toml +1 -1
- {python_filewrap-0.3.0.1 → python_filewrap-0.3.1}/LICENSE +0 -0
- {python_filewrap-0.3.0.1 → python_filewrap-0.3.1}/filewrap/py.typed +0 -0
- {python_filewrap-0.3.0.1 → python_filewrap-0.3.1}/readme.md +0 -0
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
# encoding: utf-8
|
|
3
3
|
|
|
4
4
|
__author__ = "ChenyangGao <https://chenyanggao.github.io>"
|
|
5
|
-
__version__ = (0, 3,
|
|
5
|
+
__version__ = (0, 3, 1)
|
|
6
6
|
__all__ = [
|
|
7
7
|
"SupportsRead", "SupportsReadinto", "SupportsWrite", "SupportsSeek",
|
|
8
8
|
"AsyncBufferedReader", "AsyncTextIOWrapper", "buffer_length", "to_string_buffer",
|
|
9
|
-
"to_bytes_buffer", "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
9
|
+
"to_bytes_buffer", "to_bytes_view", "bio_chunk_iter", "bio_chunk_async_iter",
|
|
10
|
+
"bio_skip_iter", "bio_skip_async_iter", "bytes_iter", "bytes_async_iter",
|
|
11
|
+
"bytes_iter_skip", "bytes_async_iter_skip", "bytes_iter_to_reader",
|
|
12
|
+
"bytes_iter_to_async_reader", "bytes_to_chunk_iter", "bytes_to_chunk_async_iter",
|
|
13
|
+
"bytes_ensure_part_iter", "bytes_ensure_part_async_iter", "progress_bytes_iter",
|
|
14
|
+
"progress_bytes_async_iter", "copyfileobj", "copyfileobj_async", "bound_bytes_reader",
|
|
15
|
+
"bound_async_bytes_reader",
|
|
15
16
|
]
|
|
16
17
|
|
|
17
18
|
from array import array
|
|
@@ -847,6 +848,15 @@ def to_bytes_buffer(b: Buffer, /) -> bytes | bytearray | memoryview:
|
|
|
847
848
|
return view.tobytes()
|
|
848
849
|
|
|
849
850
|
|
|
851
|
+
def to_bytes_view(b: Buffer, /) -> memoryview:
|
|
852
|
+
view = memoryview(b)
|
|
853
|
+
if view.format == "B":
|
|
854
|
+
return view
|
|
855
|
+
if view.c_contiguous:
|
|
856
|
+
return view.cast("B")
|
|
857
|
+
return memoryview(view.tobytes())
|
|
858
|
+
|
|
859
|
+
|
|
850
860
|
def bio_chunk_iter(
|
|
851
861
|
bio: SupportsRead[Buffer] | SupportsReadinto | Callable[[int], Buffer],
|
|
852
862
|
/,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|