to_camel_case(snake_str: str) → str
Return a camel case version of a snake case string.
Args:
snake_str
(str): A snake case string.
Returns:
str
: A camel case version of a snake case string.
create_truncated_string(input: str, length: int) → str
Create a truncated version of input if it is longer than length. Will keep the rightmost characters and cut of the front if it is longer than allowed.
Args:
input
(str): The input string.length
(int): The allowed overall length.
Returns:
str
: A truncated string which has len() of length.
replace_text_in_file(file_path: str, text: str, replacement: str) → None
Replace all occurrences of text in a file with a replacement.
Args:
file_path
(str): The path to the file.text
(str): The text to find.replacement
(str): The replacement for text.
replace_item_in_list(
text: List[str],
matching_text: str,
replacement: str = '',
remove_empty: bool = False
) → List[str]
Replace the whole line which matches the given text with a replacement.
Args:
text
(List[str]): All text lines to replace lines within.text
(str): The text to find the line with.replacement
(str): The replacement for line.remove_empty
(bool): If true and the replacement for a line is empty, the line will be removed.
replace_text_area(
text: List[str],
start_occurence: str,
end_occurence: str,
replacement: str = ''
) → List[str]
Replace all occurrences of all text areas matching the parameters with a replacement. If the replacement for a line is empty, then the line will be removed.
Args:
text
(List[str]): All text lines to replace text within.start_occurence
(str): The starting line which matches the occurence for replacement text area.start_occurence
(str): The ending line which matches the occurence for replacement text area.replacement
(str): The replacement for text area.
capture_area_in_file(
file: TextIOWrapper,
start_line: str,
end_line: str,
map_fn: Optional[Callable[[str], str]] = None
) → List[str]
Capture an area of a textfile between a matching start line (exclusive) and the first line matching end_line (exclusive).
Args:
file
(TextIOWrapper): The text file to read from.start_line
(str): The line which triggers the capture (will not be part of the output)end_line
(str): The line which terminates the capture (will not be bart of the output)map_fn
(Optional[Callable[[str], str]], optional): An optional mapping function to transform captured lines. Defaults to None.
Returns:
List[str]
: A list of captured lines.
This file was automatically generated via lazydocs.