A Lazy Log-Processing Pipeline

medium
Unit 21 · Immutability0/3 to milestone

Build a pipeline of small generator functions that process log lines lazily (one at a time, never building lists):

  • read(lines): yields lines with trailing whitespace stripped, skipping blank ones
  • parse(lines): each line is LEVEL|service|message; yield dicts with those three keys (skip lines without exactly two |)
  • only(records, level): yield records with the given level
  • pipeline(lines, level): compose the three

The pipeline must be lazy: pulling one result must not consume the whole input.

#generators#iteration#laziness2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
A Lazy Log-Processing Pipeline · TechGradify