class documentation

class ColorizedDiffStream(BinaryIO):

Constructor: ColorizedDiffStream(output_stream)

View In Hierarchy

Stream wrapper that colorizes diff output line by line using Rich.

This class wraps a binary output stream and applies color formatting to diff output as it's written. It processes data line by line to enable streaming colorization without buffering the entire diff.

Static Method is_available Check if Rich is available for colorization.
Method __enter__ Context manager entry.
Method __exit__ Context manager exit.
Method __init__ Initialize the colorized stream wrapper.
Method __iter__ Iterator interface - not supported.
Method __next__ Iterator interface - not supported.
Method close Close the stream.
Method fileno Return the file descriptor.
Method flush Flush any remaining buffered content and the underlying stream.
Method isatty Check if the stream is a TTY.
Method read Read is not supported on this write-only stream.
Method readable This stream is not readable.
Method readline Read is not supported on this write-only stream.
Method readlines Read is not supported on this write-only stream.
Method seek Seek is not supported on this stream.
Method seekable This stream is not seekable.
Method tell Tell is not supported on this stream.
Method truncate Truncate is not supported on this stream.
Method writable This stream is writable.
Method write Write data to the stream, applying colorization.
Method writelines Write a list of lines to the stream.
Instance Variable buffer Undocumented
Instance Variable console Undocumented
Instance Variable output_stream Undocumented
Instance Variable text_wrapper Undocumented
Property closed Check if the stream is closed.
Method _colorize_and_write_line Apply color formatting to a single line and write it.
def is_available() -> bool:

Check if Rich is available for colorization.

Returns
boolTrue if Rich can be imported, False otherwise
def __enter__(self) -> ColorizedDiffStream:

Context manager entry.

def __exit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: object | None):

Context manager exit.

def __init__(self, output_stream: BinaryIO):

Initialize the colorized stream wrapper.

Parameters
output_stream:BinaryIOThe underlying binary stream to write to
def __iter__(self) -> ColorizedDiffStream:

Iterator interface - not supported.

def __next__(self) -> bytes:

Iterator interface - not supported.

def close(self):

Close the stream.

def fileno(self) -> int:

Return the file descriptor.

def flush(self):

Flush any remaining buffered content and the underlying stream.

def isatty(self) -> bool:

Check if the stream is a TTY.

def read(self, n: int = -1) -> bytes:

Read is not supported on this write-only stream.

def readable(self) -> bool:

This stream is not readable.

def readline(self, limit: int = -1) -> bytes:

Read is not supported on this write-only stream.

def readlines(self, hint: int = -1) -> list[bytes]:

Read is not supported on this write-only stream.

def seek(self, offset: int, whence: int = 0) -> int:

Seek is not supported on this stream.

def seekable(self) -> bool:

This stream is not seekable.

def tell(self) -> int:

Tell is not supported on this stream.

def truncate(self, size: int | None = None) -> int:

Truncate is not supported on this stream.

def writable(self) -> bool:

This stream is writable.

def write(self, data: bytes | Buffer) -> int:

Write data to the stream, applying colorization.

Parameters
data:bytes | BufferBytes to write
Returns
intNumber of bytes written
def writelines(self, lines: Iterable[bytes | Buffer]):

Write a list of lines to the stream.

Parameters
lines:Iterable[bytes | Buffer]Iterable of bytes to write
buffer: bytes =

Undocumented

console =

Undocumented

output_stream =

Undocumented

text_wrapper =

Undocumented

closed: bool =

Check if the stream is closed.

def _colorize_and_write_line(self, line_bytes: bytes):

Apply color formatting to a single line and write it.

Parameters
line_bytes:bytesThe line to colorize and write (as bytes)