4.2. covid19_stats.engine module

This contains all the back-end functionality used by the CLI programs (see using_the_cli), and two fairly simple utility functions.

covid19_stats.engine.find_plausible_maxnum(maxnum)

Returns a default plausible limit, for the plotting of COVID-19 cumulative cases and deaths located in viz.

Parameters:

maxnum (int) – the maximum number.

Returns:

a new integer larger than maxnum, that provides a visually aesthetic upper limit for plotting.

Return type:

int

covid19_stats.engine.get_string_commas_num(num)

This is the secret-sauce of formatting integers as strings with commas for every 3 digits. For example, 1234 becomes “1,234”. I copied code from this location.

Parameters:

num (int) – input number.

Returns:

the nicely formatted output string representing an input number.

Type:

str

covid19_stats.engine.get_string_commas_num_float(num)

This is the secret-sauce of formatting floats as strings with commas for every 3 digits. For example, 1234.56 becomes “1,234.56”. I copied code from this other location.

Parameters:

num (float) – input number.

Returns:

the nicely formatted output string representing an input number.

Type:

str