Add str to internal bytes buffer and if echo is True, echo contents to inner stream. :param s: String to write to the stream
(self, s: str)
| 419 | self.buffer = ByteBuf(self) |
| 420 | |
| 421 | def write(self, s: str) -> None: |
| 422 | """Add str to internal bytes buffer and if echo is True, echo contents to inner stream. |
| 423 | |
| 424 | :param s: String to write to the stream |
| 425 | """ |
| 426 | if not isinstance(s, str): |
| 427 | raise TypeError(f"write() argument must be str, not {type(s)}") |
| 428 | |
| 429 | if not self.pause_storage: |
| 430 | self.buffer.byte_buf += s.encode(encoding=self.encoding, errors=self.errors) |
| 431 | if self.echo: |
| 432 | self.inner_stream.write(s) |
| 433 | |
| 434 | def getvalue(self) -> str: |
| 435 | """Get the internal contents as a str.""" |
no outgoing calls