fabricatio_diff.utils

Utils module for fabricatio_diff.

Attributes

SearchCapture

Capture instance for search blocks.

ReplaceCapture

Capture instance for replace blocks.

HashlineSetCapture

Capture instance for set_line blocks within a hashline-diff response.

HashlineRangeCapture

Capture instance for replace_lines blocks within a hashline-diff response.

HashlineInsertAfterCapture

Capture instance for insert_after blocks within a hashline-diff response.

HashlineReplaceCapture

Capture instance for replace blocks within a hashline-diff response.

Classes

Delimiters

Enum class representing delimiters used for search and replace operations.

HashLineType

The vocabulary of fenced block kinds used in hashline LLM responses.

HashlineDelimiters

Block delimiters for hashline LLM responses.

Module Contents

class fabricatio_diff.utils.Delimiters

Bases: enum.StrEnum

Enum class representing delimiters used for search and replace operations.

SEARCH_LEFT = '<<<<SEARCH'

Left delimiter for search blocks.

SEARCH_RIGHT = 'SEARCH<<<<'

Right delimiter for search blocks.

REPLACE_LEFT = '<<<<REPLACE'

Left delimiter for replace blocks.

REPLACE_RIGHT = 'REPLACE<<<<'

Right delimiter for replace blocks.

class fabricatio_diff.utils.HashLineType

Bases: enum.StrEnum

The vocabulary of fenced block kinds used in hashline LLM responses.

Each member corresponds to one op kind the LLM can emit. Delimiter strings in HashlineDelimiters are derived from the member names via f”<<<<{HashLineType.X}” and f”{HashLineType.X}<<<<”, so renaming a member here automatically updates every delimiter and capture.

SET = 'SET'

Single-line replace (set_line).

RANGE = 'RANGE'

Multi-line replace (replace_lines).

INSERT_AFTER = 'INSERT_AFTER'

Insert text after an anchored line (insert_after).

REPLACE = 'REPLACE'

Fuzzy text substitution (replace).

class fabricatio_diff.utils.HashlineDelimiters

Bases: enum.StrEnum

Block delimiters for hashline LLM responses.

Each pair wraps one op of the corresponding kind. All values are derived from HashLineType so the protocol vocabulary lives in one place.

SET_LEFT = '<<<<Instance of fabricatio_diff.utils.SET'

Left delimiter for a set_line op block.

SET_RIGHT = 'Instance of fabricatio_diff.utils.SET<<<<'

Right delimiter for a set_line op block.

RANGE_LEFT = '<<<<Instance of fabricatio_diff.utils.RANGE'

Left delimiter for a replace_lines op block.

RANGE_RIGHT = 'Instance of fabricatio_diff.utils.RANGE<<<<'

Right delimiter for a replace_lines op block.

INSERT_LEFT = '<<<<Instance of fabricatio_diff.utils.INSERT_AFTER'

Left delimiter for an insert_after op block.

INSERT_RIGHT = 'Instance of fabricatio_diff.utils.INSERT_AFTER<<<<'

Right delimiter for an insert_after op block.

REPLACE_LEFT = '<<<<Instance of fabricatio_diff.utils.REPLACE'

Left delimiter for a fuzzy replace op block.

REPLACE_RIGHT = 'Instance of fabricatio_diff.utils.REPLACE<<<<'

Right delimiter for a fuzzy replace op block.

fabricatio_diff.utils.SearchCapture

Capture instance for search blocks.

fabricatio_diff.utils.ReplaceCapture

Capture instance for replace blocks.

fabricatio_diff.utils.HashlineSetCapture

Capture instance for set_line blocks within a hashline-diff response.

fabricatio_diff.utils.HashlineRangeCapture

Capture instance for replace_lines blocks within a hashline-diff response.

fabricatio_diff.utils.HashlineInsertAfterCapture

Capture instance for insert_after blocks within a hashline-diff response.

fabricatio_diff.utils.HashlineReplaceCapture

Capture instance for replace blocks within a hashline-diff response.