fitzzftw.patch.lines.PatchLine

class PatchLine[source]

Bases: object

Base class for structural patch lines.

This class serves as the foundation for all specialized line types within a patch (e.g., HeadLine, FileLine). It handles the initial sanitization of the raw input stream.

Public Data Attributes:

content

The cleaned content of the line without trailing newlines (ro).

orig_line

The original of the line without trailing newlines (ro).

has_trailing_whitespace

Public Methods:

__init__(raw_line)

Initializes a PatchLine instance by sanitizing the input.

__repr__()

Return repr(self).

Private Data Attributes:

_TRAIL_WS_RE

_has_trailing_whitespace

_content

_orig_line


__init__(raw_line)[source]

Initializes a PatchLine instance by sanitizing the input.

The raw line is stripped of trailing carriage returns and newlines. Additionally, it removes the specialized ‘No newline at end of file’ markers that can appear in Unified Diff format to ensure the content property contains only the actual text data.

Parameters:

raw_line (str) – The unmodified string read directly from the patch source.

property content: str

The cleaned content of the line without trailing newlines (ro).

Returns:

A string representing the text content of the line.

property orig_line: str

The original of the line without trailing newlines (ro).

Returns:

A string representing the text content of the line.