Package lib :: Package text :: Module string
[hide private]
[frames] | no frames]

Module string

source code

Module for building documentation.

Functions [hide private]
str
human_readable_list(data, conjunction='and')
Convert the list/array object into a human readable list.
source code
str
strip_lead(text)
Strip the leading whitespace from the given text.
source code
 
to_docstring(data)
Convert the text to that of a docstring, dependent on the text level.
source code
Variables [hide private]
  TITLE = 3
  SECTION = 2
  SUBSECTION = 1
  PARAGRAPH = 0
  LIST = 10
  __package__ = 'lib.text'

Imports: deepcopy


Function Details [hide private]

human_readable_list(data, conjunction='and')

source code 

Convert the list/array object into a human readable list.

This formats and returns a list, with the last element prefixed with the qualifier.

Parameters:
  • data (list of str) - The list or array object to convert.
  • conjunction (str) - The conjunction to add to the list.
Returns: str
The formatted list.

strip_lead(text)

source code 

Strip the leading whitespace from the given text.

Parameters:
  • text (str) - The text to strip the leading whitespace from.
Returns: str
The text with leading whitespace removed.

to_docstring(data)

source code 

Convert the text to that of a docstring, dependent on the text level.

Parameters:
  • data (list of lists of int and str) - The lists of constants and text to convert into a properly formatted docstring.