Cleanup db_schema from_event constructors (#120803)

This commit is contained in:
J. Nick Koston 2024-06-29 07:49:16 -05:00 committed by GitHub
parent 6ed0960648
commit 852bb19223
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 36 deletions

View file

@ -1308,6 +1308,11 @@ class EventOrigin(enum.Enum):
"""Return the event."""
return self.value
@cached_property
def idx(self) -> int:
"""Return the index of the origin."""
return next((idx for idx, origin in enumerate(EventOrigin) if origin is self))
class Event(Generic[_DataT]):
"""Representation of an event within the bus."""