-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Description
$ 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 NotImplementedErrorWhilst 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)
Metadata
Metadata
Assignees
Labels
No labels