MCPcopy
hub / github.com/pallets/click / BytesIOCopy

Class BytesIOCopy

src/click/testing.py:117–135  ·  view source on GitHub ↗

Patch ``io.BytesIO`` to let the written stream be copied to another. .. versionadded:: 8.2

Source from the content-addressed store, hash-verified

115
116
117class BytesIOCopy(io.BytesIO):
118 """Patch ``io.BytesIO`` to let the written stream be copied to another.
119
120 .. versionadded:: 8.2
121 """
122
123 copy_to: io.BytesIO
124
125 def __init__(self, copy_to: io.BytesIO) -> None:
126 super().__init__()
127 self.copy_to = copy_to
128
129 def flush(self) -> None:
130 super().flush()
131 self.copy_to.flush()
132
133 def write(self, b: ReadableBuffer) -> int:
134 self.copy_to.write(b)
135 return super().write(b)
136
137
138class StreamMixer:

Callers 3

__init__Method · 0.85

Calls

no outgoing calls

Tested by 3

__init__Method · 0.68