X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=type%2Frate.py;h=c365848fa0bd2eb1a34916ec5e8071348e0dffdc;hb=c6fca944b41f292b66efaba27ebf3fd0a37956b8;hp=64a472650242f863e24a02cd03cb44344db10a76;hpb=6ba90a1f30f1c0cf4df12fcd0c62181f29bc3668;p=python_utils.git diff --git a/type/rate.py b/type/rate.py index 64a4726..c365848 100644 --- a/type/rate.py +++ b/type/rate.py @@ -1,9 +1,13 @@ #!/usr/bin/env python3 +"""A class to represent a rate of change.""" + from typing import Optional class Rate(object): + """A class to represent a rate of change.""" + def __init__( self, multiplier: Optional[float] = None, @@ -28,9 +32,7 @@ class Rate(object): self.multiplier = 1.0 + percent_change / 100 count += 1 if count != 1: - raise Exception( - 'Exactly one of percentage, percent_change or multiplier is required.' - ) + raise Exception('Exactly one of percentage, percent_change or multiplier is required.') def apply_to(self, other): return self.__mul__(other)