STY: fix flake8 errors

Fixed some flake8 errors and added a docstring to the PeriodicEvent
class.