Utilities

Note

The documentation in this section is aimed at people wishing to contribute to blanco, and can be skipped if you are simply using the tool from the command line.

Time handling

blanco.parse_duration(duration)[source]

Parse human readable duration.

Parameters:duration (str) – Duration definition
Return type:int
Returns:Number of days in duration
Raises ValueError:
 Invalid value for duration

Text formatting

blanco._colourise(text, colour)[source]

Colour text, if possible.

Parameters:
  • text (str) – Text to colourise
  • colour (str) – Colour to display text in
Return type:

str

Returns:

Colourised text, if possible

blanco.success(text)[source]
blanco.fail(text)[source]
blanco.warn(text)[source]

Examples

Time handling

>>> parse_duration('4w')
28
>>> parse_duration('2 m')
56

Text formatting

>>> fail('Error!')
'Error!'
>>> success('Excellent')
'Excellent'
>>> warn('Ick')
'Ick'