y-crdt/ypy

y_py has no attribute `Y.Event`

kafonek opened this issue · 1 comments

y_py.pyi defines Event

ypy/y_py.pyi

Line 21 in d3387a5

Event = Union[YTextEvent, YArrayEvent, YMapEvent, YXmlTextEvent, YXmlElementEvent]
so it shows up when tab completing in Jupyter or an editor. However trying to use it will raise AttributeError: module 'y_py' has no attribute 'Event'

There is not a corresponding class in the actual API. This is used as an annotation to specify the events in observe_deep and hopefully provide some type narrowing support for strongly typed code analyzers.

But that is a pain I agree. We could specify the exhaustive union in observe_deep, but it might make the annotations less legible.