$ grep NotImplementedError -r telegram --exclude-dir=vendor -I --line-number
./telegram/ext/handler.py: raise NotImplementedError
./telegram/ext/basepersistence.py: raise NotImplementedError
./telegram/ext/basepersistence.py: raise NotImplementedError
./telegram/ext/basepersistence.py: raise NotImplementedError
./telegram/ext/basepersistence.py: raise NotImplementedError
./telegram/ext/basepersistence.py: raise NotImplementedError
./telegram/ext/basepersistence.py: raise NotImplementedError
./telegram/ext/basepersistence.py: raise NotImplementedError
./telegram/ext/basepersistence.py: raise NotImplementedError
./telegram/ext/filters.py: raise NotImplementedError
Whilst looking through the code I noticed a few occurrences where the docstring states that methods must be overwritten/implemented und corresponding checks are apparently in the tests. However Python provides the @abstractmethod decorator which we could use. We could either use the ABCMeta metaclass for this or I could implement this into the Python3 only branch where we could simple inherit ABC.
I think this change would make the code a bit more clear and prevents common pitfalls where one wants to inherit such classes but forgets to implement these methods (probably most common with BasePersistence)
Whilst looking through the code I noticed a few occurrences where the docstring states that methods must be overwritten/implemented und corresponding checks are apparently in the tests. However Python provides the
@abstractmethoddecorator which we could use. We could either use theABCMetametaclass for this or I could implement this into the Python3 only branch where we could simple inheritABC.I think this change would make the code a bit more clear and prevents common pitfalls where one wants to inherit such classes but forgets to implement these methods (probably most common with
BasePersistence)