python-filewrap 0.2.8.2__tar.gz → 0.2.9.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.2.8.2 → python_filewrap-0.2.9.1}/PKG-INFO +5 -3
- {python_filewrap-0.2.8.2 → python_filewrap-0.2.9.1}/filewrap/__init__.py +17 -9
- {python_filewrap-0.2.8.2 → python_filewrap-0.2.9.1}/pyproject.toml +1 -1
- {python_filewrap-0.2.8.2 → python_filewrap-0.2.9.1}/LICENSE +0 -0
- {python_filewrap-0.2.8.2 → python_filewrap-0.2.9.1}/filewrap/py.typed +0 -0
- {python_filewrap-0.2.8.2 → python_filewrap-0.2.9.1}/readme.md +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-filewrap
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9.1
|
|
4
4
|
Summary: Python file wrappers.
|
|
5
|
-
Home-page: https://github.com/ChenyangGao/python-modules/tree/main/python-filewrap
|
|
6
5
|
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
7
|
Keywords: file,wrapper
|
|
8
8
|
Author: ChenyangGao
|
|
9
9
|
Author-email: wosiwujm@gmail.com
|
|
@@ -16,12 +16,14 @@ Classifier: Programming Language :: Python
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
20
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
21
|
Classifier: Topic :: Software Development
|
|
21
22
|
Classifier: Topic :: Software Development :: Libraries
|
|
22
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
24
|
Requires-Dist: python-asynctools (>=0.1.3)
|
|
24
25
|
Requires-Dist: python-property (>=0.0.3)
|
|
26
|
+
Project-URL: Homepage, https://github.com/ChenyangGao/python-modules/tree/main/python-filewrap
|
|
25
27
|
Project-URL: Repository, https://github.com/ChenyangGao/python-modules/tree/main/python-filewrap
|
|
26
28
|
Description-Content-Type: text/markdown
|
|
27
29
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# encoding: utf-8
|
|
3
3
|
|
|
4
4
|
__author__ = "ChenyangGao <https://chenyanggao.github.io>"
|
|
5
|
-
__version__ = (0, 2,
|
|
5
|
+
__version__ = (0, 2, 9)
|
|
6
6
|
__all__ = [
|
|
7
7
|
"SupportsRead", "SupportsReadinto", "SupportsWrite", "SupportsSeek",
|
|
8
8
|
"AsyncBufferedReader", "AsyncTextIOWrapper", "buffer_length",
|
|
@@ -120,19 +120,19 @@ class AsyncBufferedReader(BufferedReader):
|
|
|
120
120
|
|
|
121
121
|
@cached_property
|
|
122
122
|
def _flush(self, /):
|
|
123
|
-
return ensure_async(self.raw
|
|
123
|
+
return ensure_async(getattr(self.raw, "flush"), threaded=True)
|
|
124
124
|
|
|
125
125
|
@cached_property
|
|
126
126
|
def _read(self, /):
|
|
127
|
-
return ensure_async(self.raw
|
|
127
|
+
return ensure_async(getattr(self.raw, "read"), threaded=True)
|
|
128
128
|
|
|
129
129
|
@cached_property
|
|
130
130
|
def _readinto(self, /):
|
|
131
|
-
return ensure_async(self.raw
|
|
131
|
+
return ensure_async(getattr(self.raw, "readinto"), threaded=True)
|
|
132
132
|
|
|
133
133
|
@cached_property
|
|
134
134
|
def _readline(self, /):
|
|
135
|
-
return ensure_async(self.raw
|
|
135
|
+
return ensure_async(getattr(self.raw, "readline"), threaded=True)
|
|
136
136
|
|
|
137
137
|
@cached_property
|
|
138
138
|
def _seek(self, /):
|
|
@@ -842,10 +842,10 @@ def bio_chunk_iter(
|
|
|
842
842
|
use_readinto = False
|
|
843
843
|
if callable(bio):
|
|
844
844
|
read = bio
|
|
845
|
-
elif can_buffer and
|
|
845
|
+
elif can_buffer and hasattr(bio, "readinto"):
|
|
846
846
|
readinto = bio.readinto
|
|
847
847
|
use_readinto = True
|
|
848
|
-
elif
|
|
848
|
+
elif hasattr(bio, "read"):
|
|
849
849
|
read = bio.read
|
|
850
850
|
else:
|
|
851
851
|
readinto = bio.readinto
|
|
@@ -864,6 +864,8 @@ def bio_chunk_iter(
|
|
|
864
864
|
if size < chunksize:
|
|
865
865
|
del buf[size:]
|
|
866
866
|
length = readinto(buf)
|
|
867
|
+
if not length:
|
|
868
|
+
return
|
|
867
869
|
if callback:
|
|
868
870
|
callback(length)
|
|
869
871
|
if length < buffer_length(buf):
|
|
@@ -887,6 +889,8 @@ def bio_chunk_iter(
|
|
|
887
889
|
readsize = min(chunksize, size)
|
|
888
890
|
chunk = read(readsize)
|
|
889
891
|
length = buffer_length(chunk)
|
|
892
|
+
if not length:
|
|
893
|
+
return
|
|
890
894
|
if callback:
|
|
891
895
|
callback(length)
|
|
892
896
|
yield chunk
|
|
@@ -911,10 +915,10 @@ async def bio_chunk_async_iter(
|
|
|
911
915
|
use_readinto = False
|
|
912
916
|
if callable(bio):
|
|
913
917
|
read: Callable[[int], Awaitable[Buffer]] = ensure_async(bio, threaded=True)
|
|
914
|
-
elif can_buffer and
|
|
918
|
+
elif can_buffer and hasattr(bio, "readinto"):
|
|
915
919
|
readinto = ensure_async(bio.readinto, threaded=True)
|
|
916
920
|
use_readinto = True
|
|
917
|
-
elif
|
|
921
|
+
elif hasattr(bio, "read"):
|
|
918
922
|
read = ensure_async(bio.read, threaded=True)
|
|
919
923
|
else:
|
|
920
924
|
readinto = ensure_async(bio.readinto, threaded=True)
|
|
@@ -932,6 +936,8 @@ async def bio_chunk_async_iter(
|
|
|
932
936
|
if size < chunksize:
|
|
933
937
|
del buf[size:]
|
|
934
938
|
length = await readinto(buf)
|
|
939
|
+
if not length:
|
|
940
|
+
return
|
|
935
941
|
if callback:
|
|
936
942
|
await callback(length)
|
|
937
943
|
if length < buffer_length(buf):
|
|
@@ -955,6 +961,8 @@ async def bio_chunk_async_iter(
|
|
|
955
961
|
readsize = min(chunksize, size)
|
|
956
962
|
chunk = await read(readsize)
|
|
957
963
|
length = buffer_length(chunk)
|
|
964
|
+
if not length:
|
|
965
|
+
return
|
|
958
966
|
if callback:
|
|
959
967
|
await callback(length)
|
|
960
968
|
yield chunk
|
|
File without changes
|
|
File without changes
|
|
File without changes
|