Error in EventsDict init with duplicated key events
When creating a EventsDict
from a list of Events with the same key, only the last one is stored:
EventsDict([
EventWindow('FOO', t_start='2035-01-01', t_end='2035-01-02'),
EventWindow('FOO', t_start='2035-01-03', t_end='2035-01-04'),
])
event | # | t_start | t_stop | |
---|---|---|---|---|
0 | FOO | - | 2035-01-03 | 2035-01-04 |
This is related to EventsDict.__init__()
that overwrite the event key:
def __init__(self, events, **kwargs):
self.data = {
event.key: event
for event in sorted(events, key=attrgetter('start'))
}
If a key is duplicated, the events should be stored in an EventsList
.
Catched by @nmanaud.
Edited by Benoit Seignovert