pyannote-core
pyannote-core copied to clipboard
fix: fix type hint of Timeline.to_annotation
If generator is set to None, the function would raise an Exception in line 1067 when next(generator) is call on None. So I guess generator should never be None.
At first I only wanted to correct the duplicate None in the type hint, so I would update the type hint, if None is handled in any other way.
I guess what happened was, when the type hints were first added in the new line 921, it was first though of as a Generator with Generator[Label, None, None], which can also be expressed as Iterator[Label] (see typing.Generator).
Closing in favor of #96