Closed dreinon closed 3 years ago
All constraints inherit from the _Constraint
base class (https://github.com/tpaviot/ProcessScheduler/blob/master/processscheduler/base.py#L90).
I'm thinking about introducing a richer class hierarchy, that would be easier for the solver to adopt specific strategies.
Another thing to know, I faced many circular references issues while trying to run mypy on ProcessScheduler. Indeed, in order to get mypy properly executed, each module must imports all types.
To avoid circular references in type hints, I suggest following PEP 484
https://www.python.org/dev/peps/pep-0484/#forward-references
Thus the type hint could look like this:
def my_method(self, a_constraint: 'Constraint') -> None:
Have you read this already?
No.
Basically, importing the following can make forward references work out:
from __future__ import annotations
Although strings are totally duable. Closing the issue :smile:
I would like to specify with type hints if I return a ProcessScheduler constraint but I do not have access to Constraint class.