ycleptic.src.stringthings module

Various string manipulation functions for ycleptic

ycleptic.src.stringthings.dict_to_rst_yaml_block(data: dict) str[source]

by ChatGPT 4o on 2025-06-15

ycleptic.src.stringthings.my_indent(text: str, indent: int = 4) str[source]
ycleptic.src.stringthings.oxford(a_list: list[str], conjunction: str = 'or')[source]

Returns a string with the elements of a_list joined by commas, with the last element preceded by the conjunction. If a_list is empty, returns an empty string. If a_list has one element, returns that element. If a_list has two elements, returns them joined by the conjunction. If a_list has three or more elements, returns all elements joined by commas, with the last element preceded by the conjunction.

Parameters:
  • a_list (list of str) – List of strings to join.

  • conjunction (str) – The conjunction to use before the last element (default is ‘or’).

Returns:

A string with the elements of a_list joined by commas, with the last element preceded by the conjunction.

Return type:

str

ycleptic.src.stringthings.raise_clean(ErrorInstance)[source]

Raises an error with a clean message showing no traceback.

Parameters:

ErrorInstance (Exception) – The exception instance to raise.