Open markf94 opened 4 years ago
Unfortunately you are right, we are working on a new schema for the individuals, but it is not ready yet. In the mean time you could use string style annotation.
from deap import creator
class Algo:
@staticmethod
def mate(individual: "creator.Individual"):
pass
Interesting. I did not know about string style annotation. Will give it a try and report back!
Unfortunately, I cannot annotate any arguments of type
deap.creator.Individual
when instantiating theIndividual
as part of a method on some class since thedeap.creator.Individual
class doesn't exist when the Python type checker runs.Example:
I'm aware that
deap
is more script rather than OOP based but I'm curious if other people have encountered this problem and what their workarounds are.This issue relates somewhat to #367 which is about type annotating the
deap
source code.