MCPcopy Create free account
hub / github.com/psf/cachecontrol / _safe_read

Method _safe_read

cachecontrol/filewrapper.py:110–121  ·  view source on GitHub ↗
(self, amt: int)

Source from the content-addressed store, hash-verified

108 return data
109
110 def _safe_read(self, amt: int) -> bytes:
111 data: bytes = self.__fp._safe_read(amt) # type: ignore[attr-defined]
112 if amt == 2 and data == b"\r\n":
113 # urllib executes this read to toss the CRLF at the end
114 # of the chunk.
115 return data
116
117 self.__buf.write(data)
118 if self.__is_fp_closed():
119 self._close()
120
121 return data

Callers

nothing calls this directly

Calls 2

__is_fp_closedMethod · 0.95
_closeMethod · 0.95

Tested by

no test coverage detected