Skip to content

Commit

Permalink
docs: documented transforms chunk_events_by_key and merge_events_by_k…
Browse files Browse the repository at this point in the history
…eys (#99)
  • Loading branch information
ErikBjare committed Apr 2, 2021
1 parent 220ff70 commit 81dcb64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions aw_transform/chunk_events_by_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
def chunk_events_by_key(
events: List[Event], key: str, pulsetime: float = 5.0
) -> List[Event]:
"""
"Chunks" adjacent events together which have the same value for a key, and stores the
original events in the :code:`subevents` key of the new event.
"""
chunked_events: List[Event] = []
for event in events:
if key not in event.data:
Expand Down
6 changes: 5 additions & 1 deletion aw_transform/merge_events_by_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@


def merge_events_by_keys(events, keys) -> List[Event]:
# The result will be a list of events without timestamp since they are merged
"""
Sums the duration of all events which share a value for a key and returns a new event for each value.
.. note: The result will be a list of events without timestamp since they are merged.
"""
# Call recursively until all keys are consumed
if len(keys) < 1:
return events
Expand Down

0 comments on commit 81dcb64

Please sign in to comment.