python-filewrap 0.2.8.2__tar.gz → 0.2.9__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.1
2
2
  Name: python-filewrap
3
- Version: 0.2.8.2
3
+ Version: 0.2.9
4
4
  Summary: Python file wrappers.
5
5
  Home-page: https://github.com/ChenyangGao/python-modules/tree/main/python-filewrap
6
6
  License: MIT
@@ -2,7 +2,7 @@
2
2
  # encoding: utf-8
3
3
 
4
4
  __author__ = "ChenyangGao <https://chenyanggao.github.io>"
5
- __version__ = (0, 2, 8)
5
+ __version__ = (0, 2, 9)
6
6
  __all__ = [
7
7
  "SupportsRead", "SupportsReadinto", "SupportsWrite", "SupportsSeek",
8
8
  "AsyncBufferedReader", "AsyncTextIOWrapper", "buffer_length",
@@ -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
@@ -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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-filewrap"
3
- version = "0.2.8.2"
3
+ version = "0.2.9"
4
4
  description = "Python file wrappers."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"