dbader / schedule

Python job scheduling for humans.
https://schedule.readthedocs.io/
MIT License
11.73k stars 959 forks source link

removed a pitfall where a class field was being defined outside the init #493

Closed NaelsonDouglas closed 2 years ago

NaelsonDouglas commented 2 years ago

The problem There was a class field being defined outside the class __init__ It might be problematic in some scenarios where the code tries to access the field before it is created. It also could hinder the understanding of the code due to the fact the class field definitions are scattered on the source instead of centralized into a single place.

This pitfall was detected automatically via Pylint, which triggered the warning code W0201 which is described here

The solution Refactored the code to create the field on the __init__