verry.interval.Converter#

class verry.interval.Converter#

Bases: ABC, Generic

Provides numeric/numeric and numeric/string conversions.

abstractmethod fromfloat(value, strict=True)#

Convert the float to a number.

Raises:

ValueError – If strict is True and value cannot be converted without loss.

fromint(value, rounding)#

Convert the integer to a number with rounding taken into account.

This method is defined as fromstr(str(value), rounding) if not overloaded.

abstractmethod fromstr(value, rounding)#

Convert the string to a number with rounding taken into account.

Raises:

ValueError – If value does not represent a number.

tostr(value, rounding)#

Convert the number to a string with rounding taken into account.