python-filewrap 0.2.7__py3-none-any.whl → 0.2.7.1__py3-none-any.whl

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.
filewrap/__init__.py CHANGED
@@ -640,9 +640,9 @@ class AsyncTextIOWrapper(TextIOWrapper):
640
640
  if newline is None:
641
641
  text_new = CRE_NOT_UNIX_NEWLINES.sub("\n", text_new)
642
642
  self._text = ""
643
- return text_new
643
+ return text + text_new
644
644
 
645
- ls_parts = [text]
645
+ ls_parts: list[str] = []
646
646
  add_part = ls_parts.append
647
647
 
648
648
  def process_part(data, errors="strict", /) -> int:
@@ -719,14 +719,29 @@ class AsyncTextIOWrapper(TextIOWrapper):
719
719
  idx += 1
720
720
  return idx
721
721
  if size > 0:
722
- text = await self.read(size)
723
- stop = find_stop(text)
724
- if not stop or stop == len(text):
725
- return text
726
- self._text = text[stop:] + self._text
727
- return text[:stop]
722
+ if text := self._text:
723
+ if stop := find_stop(text):
724
+ stop = min(stop, size)
725
+ self._text = text[stop:]
726
+ return text[:stop]
727
+ elif size <= len(text):
728
+ self._text = text[size:]
729
+ return text[:size]
730
+ self._text = ""
731
+ size -= len(text)
732
+ text_new = await self.read(size)
733
+ stop = find_stop(text_new)
734
+ if not stop or stop == len(text_new):
735
+ return text + text_new
736
+ self._text = text_new[stop:] + self._text
737
+ return text + text_new[:stop]
728
738
  else:
729
- ls_part: list[str] = []
739
+ if text := self._text:
740
+ if stop := find_stop(text):
741
+ self._text = text[stop:]
742
+ return text[:stop]
743
+ self._text = ""
744
+ ls_part: list[str] = [text]
730
745
  add_part = ls_part.append
731
746
  while text := await self.read(READ_BUFSIZE):
732
747
  if stop := find_stop(text):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-filewrap
3
- Version: 0.2.7
3
+ Version: 0.2.7.1
4
4
  Summary: Python file wrappers.
5
5
  Home-page: https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-filewrap
6
6
  License: MIT
@@ -0,0 +1,7 @@
1
+ LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
+ filewrap/__init__.py,sha256=ryJJav0-5lRD1dRWj0X4cmbG0s5iFkEUuKnb2_zlgWo,60396
3
+ filewrap/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ python_filewrap-0.2.7.1.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
5
+ python_filewrap-0.2.7.1.dist-info/METADATA,sha256=8L9DoG8Ekp7TWINRaSZwid8OGO2Abbene6GGSbsRZD8,1362
6
+ python_filewrap-0.2.7.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
+ python_filewrap-0.2.7.1.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
- filewrap/__init__.py,sha256=TbfJycsmrFwMg9rW7Im4zE_xYMTOAoLlmtebxpEIBx4,59749
3
- filewrap/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- python_filewrap-0.2.7.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
5
- python_filewrap-0.2.7.dist-info/METADATA,sha256=29_Ni1VvcvBJKFisl6tIGhGEThQ7xbniu_C30Q63mWM,1360
6
- python_filewrap-0.2.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
- python_filewrap-0.2.7.dist-info/RECORD,,