Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from abc import ABC, abstractmethod 

2 

3 

4class BaseCalculator(ABC): 

5 """ 

6 Base class for calculators. 

7 

8 Attributes 

9 ---------- 

10 name : str 

11 human-readable calculator name 

12 """ 

13 

14 def __init__(self, name='BaseCalculator'): 

15 self.name = name 

16 

17 @abstractmethod 

18 def calculate_total(self): 

19 pass 

20 

21 @abstractmethod 

22 def calculate_change(self): 

23 pass 

24 

25 @property 

26 def sublattices(self): 

27 raise NotImplementedError()