MDANSE
MDANSE copied to clipboard
[ENHANCEMENT] Use modern abstract functionality
Is your feature request related to a problem? Please describe.
Currently, several abstract classes do not use @abstractmethod to highlight these abstractions and thus cannot verify whether child classes correctly implement them.
Describe the solution you'd like Implementation of abstract methods.
Describe alternatives you've considered N/A
Additional context
Example code
from abc import ABC, ABCMeta, abstractmethod
class Geoff(metaclass=ABCMeta):
def __init__(self):
self.x = 7
def calculate(self):
raise NotImplementedError()
class SubGeoff(Geoff):
...
q = SubGeoff()
print(q.x)
class GeoffAbs(metaclass=ABCMeta):
def __init__(self):
self.x = 7
@abstractmethod
def calculate(self):
raise NotImplementedError()
class SubGeoffAbs(GeoffAbs):
...
w = SubGeoffAbs()
print(w.x)
$ python tmp.py
7
Traceback (most recent call last):
File "/home/jacob/tmp.py", line 29, in <module>
w = SubGeoffAbs()
TypeError: Can't instantiate abstract class SubGeoffAbs with abstract method calculate