summaryrefslogtreecommitdiffstats
path: root/unit_trace/latest.py
diff options
context:
space:
mode:
Diffstat (limited to 'unit_trace/latest.py')
-rw-r--r--unit_trace/latest.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/unit_trace/latest.py b/unit_trace/latest.py
new file mode 100644
index 0000000..4abd3a2
--- /dev/null
+++ b/unit_trace/latest.py
@@ -0,0 +1,19 @@
1###############################################################################
2# Description
3###############################################################################
4
5# Enforce latest record
6
7###############################################################################
8# Public functions
9###############################################################################
10
11def latest(stream, latest):
12 for record in stream:
13 if record.record_type=="event":
14 if record.when > latest:
15 break
16 else:
17 yield record
18 else:
19 yield record