(timeline)
return timeline_event_map
Update the timeline event map from the timeline output.

    Non-commented timeline entries are parsed and the event timestamp is appended
    to the list of times an event label occurs.

    For example:
        3.5 "Phantom Flurry" sync /:Suzaku:32DD:/
        7.0 "Screams Of The Damned" sync /:Suzaku:32D2:/
        10.5 "Phantom Flurry" sync /:Suzaku:32DD:/

    Will create the following mapping:
        {
            '"Phantom Flurry" sync /:Suzaku:32DD:/': [3.5, 10.5],
            '"Screams Of The Damned" sync /:Suzaku:32D2:/': [7.0]
        }
Update the timeline event map from the timeline output.
Update the timeline event map from the timeline output .
def parse_timeline_events(timeline):
    """Update the timeline event map from the timeline output.

    Non-commented timeline entries are parsed and the event timestamp is appended
    to the list of times an event label occurs.

    For example:
        3.5 "Phantom Flurry" sync /:Suzaku:32DD:/
        7.0 "Screams Of The Damned" sync /:Suzaku:32D2:/
        10.5 "Phantom Flurry" sync /:Suzaku:32DD:/

    Will create the following mapping:
        {
            '"Phantom Flurry" sync /:Suzaku:32DD:/': [3.5, 10.5],
            '"Screams Of The Damned" sync /:Suzaku:32D2:/': [7.0]
        }
    """
    timeline_event_map = defaultdict(list)
    for line in timeline:
        # Ignore comments, alertall, hideall, etc by
        # only reading lines starting with a number
        if not line[0].isdigit():
            continue

        # Remove trailing comment, if any
        clean_line = line.split("#")[0]

        # Split the line into sections
        match = re.search(r'^(?P<time>[\d\.]+)\s+"(?P<label>.+)"\s+(?P<options>.+)', clean_line)
        if not match:
            continue

        event_time = float(match[1])
        label = '"{match[2]}" {match[3]}'.format(match=match)

        # Add the timestamp to the event's list of occurrences
        timeline_event_map[label].append(event_time)
    return timeline_event_map
def parse_timeline_events ( timeline ) : timeline_event_map = defaultdict ( list ) for line in timeline : # Ignore comments, alertall, hideall, etc by # only reading lines starting with a number if not line [ 0 ] . isdigit ( ) : continue # Remove trailing comment, if any clean_line = line . split ( "#" ) [ 0 ] # Split the line into sections match = re . search ( r'^(?P<time>[\d\.]+)\s+"(?P<label>.+)"\s+(?P<options>.+)' , clean_line ) if not match : continue event_time = float ( match [ 1 ] ) label = '"{match[2]}" {match[3]}' . format ( match = match ) # Add the timestamp to the event's list of occurrences timeline_event_map [ label ] . append ( event_time ) return timeline_event_map