protokolo.replace module

Code to find-and-insert in CHANGELOG.

protokolo.replace.insert_into_str(text: str, target: str, lineno: int) str[source]

Insert text into target after lineno. lineno is 1-indexed. lineno 0 means inserting at the very start of target.

A newline is automatically inserted after text if one is missing.

protokolo.replace.find_first_occurrence(text: str, source: str) int | None[source]

Return the line number (1-indexed) of the first occurrence of text in source.

Return None if no occurrence was found.