colawater.lib.attribute#

Functions for working with attribute values.

Examples

foo = None
foo = process(foo) # Returns "<Null>".

Module Contents#

Functions#

process(→ str)

Returns a human readable string representation of a nullable field value.

Attributes#

CSV_PROCESSING_MSG

Message text to display when the following output has been modified for CSV use.

colawater.lib.attribute.CSV_PROCESSING_MSG: str = 'Commas, leading and trailing whitespace, and quotation marks have been removed so this output...'#

Message text to display when the following output has been modified for CSV use.

colawater.lib.attribute.process(attr: Any | None, csv: bool = False) str#

Returns a human readable string representation of a nullable field value.

Turns a None value into "<Null>" and optionally strips leading and trailing whitespace, commas, and quotation marks for ease of use as a CSV.

Parameters:
  • attr (Optional[Union[Any]]) – The attribute value to be processed.

  • csv (bool) – Whether to apply CSV pre-processing.

Returns:

The processed attribute value.

Return type:

str