pyannote-core icon indicating copy to clipboard operation
pyannote-core copied to clipboard

fix: fix type hint of Timeline.to_annotation

Open lukasstorck opened this issue 1 year ago • 1 comments

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.

lukasstorck avatar May 14 '24 09:05 lukasstorck

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).

lukasstorck avatar May 29 '24 10:05 lukasstorck

Closing in favor of #96

hbredin avatar Jan 12 '25 20:01 hbredin