Skip to content

collections.eventindex

EventIndex

Bases: SlottedDict[Event]

Index object through which events can be accessed.

This is a quite inefficient implementation, intended to be temporary pending the resolution of issue #2743. As most events are currently implicitly created, it requires loading the entire Anthology data.

Attributes:

Name Type Description
parent Anthology

The parent Anthology instance to which this index belongs.

reverse dict[AnthologyIDTuple, set[str]]

A mapping of volume IDs to a set of associated event IDs.

is_data_loaded bool

A flag indicating whether the index has been constructed.

by_volume

by_volume(volume)

Find events associated with a volume.

get_or_create_implicit_event

get_or_create_implicit_event(volume, venue_id, create=True)

Find and return the event implicitly defined by a venue tag on a given volume.

Volumes implicitly define events by a combination of their linked venue IDs and the year of the volume (f"{venue_id}-{volume.year}"). This function is used when loading the index and/or modifying data to find and, if necessary, instantiate these implicit events.

Parameters:

Name Type Description Default
volume Volume

The Volume that implicitly defines the event. Used to derive the year of the event, but also to connect it to the correct Collection.

required
venue_id str

The venue ID that implicitly defines the event.

required
create bool

If False, do not create the event if it doesn't exist yet.

True

Returns:

Type Description
Optional[Event]

The implicit event defined by the combination of venue_id and volume, or None if it doesn't exist and create was False.

load

load()

Load the entire Anthology data and build an index of events.

reset

reset()

Resets the index.