:py:mod:`bw_timex.helper_classes` ================================= .. py:module:: bw_timex.helper_classes Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: bw_timex.helper_classes.SetList bw_timex.helper_classes.TimeMappingDict bw_timex.helper_classes.InterDatabaseMapping .. py:class:: SetList A helper class for the mapping of the same/mapped activity in different (temporal) databases, composed of a list of sets, that hold can hold the set of tuples of (act_id, database). It is built by adding sets to the list, and returns the matching sets if one calls the an item from a set. Example: If the class instance is called my_setlist, my_setlist.add(set). .. py:method:: add(new_set: set) -> None This method adds a set to the SetList instance. :param new_set: :type new_set: a set to add to the SetList instance :rtype: None .. py:class:: TimeMappingDict(start_id=2, *args, **kwargs) Bases: :py:obj:`dict` .. autoapi-inheritance-diagram:: bw_timex.helper_classes.TimeMappingDict :parts: 1 :private-bases: A dictionary mapping (flow, timestamp) tuples to unique integer IDs. Initializes the dictionary with a starting ID. .. py:property:: reversed Returns a reversed version of the dictionary, updating it only if necessary. :returns: A reversed dictionary mapping unique IDs to (flow, timestamp) tuples. :rtype: dict .. py:method:: add(process_time_tuple, unique_id=None) Adds a new process_time_tuple to the dictionary. :param process_time_tuple: A tuple of (flow and timestamp) :type process_time_tuple: tuple :param unique_id: A unique ID for the tuple (default: None). :type unique_id: int, optional :returns: The assigned unique ID. :rtype: int .. py:class:: InterDatabaseMapping(*args, **kwargs) Bases: :py:obj:`dict` .. autoapi-inheritance-diagram:: bw_timex.helper_classes.InterDatabaseMapping :parts: 1 :private-bases: A dictionary of the form {id1:{database1: id1, database2: id2, ...}, id2: ...} that maps the same activity in different databases. Initialize self. See help(type(self)) for accurate signature. .. py:method:: find_match(id_, db_name) -> any Returns the matching ID in the given database for the given ID. .. py:method:: make_reciprocal() Internal method to make the mapping reciprocal.