
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
MR Streams is a python utility for composing iterable map reduce filter chains
The goals of this library are relatively simple:
map
- applies functions to values in iterable with a built-in option for partial evaluation.
from operator import add
[*mr(range(10)).map(add, 1)]
>>[1,2,3,4,5,6,7,8,9,10]
filter
- applies a boolean function to values emitted in the chain. If the condition is true, the values are emitted further down the chain.
is_even = lambda x: x % 2 == 0
[*mr(range(10)).filter(is_even)]
>>[0, 2,4,6,8]
reduce
- reduce iterates through all objects and reduces them using a reduction function.
mr(range(10)).reduce(sum)
>> 45
take
- limits the number of values emitted in the stream.
[*mr(range(10)).take(3)]
>>[0,1,2]
tap
- applies a function passively to the stream without altering emitted values.
mr(range(4)).tap(print).reduce(sum)
>> 0
>> 1
>> 2
>> 3
>> 6
drain
- runs a no-op iteration that depletes the stream.
mr(range(4)).tap(print).drain()
>> 0
>> 1
>> 2
>> 3
chunk
- groups items in a stream into groups of size n
mr(range(4)).chunk(2).tap(print).drain()
>> [0,1]
>> [2,3]
FAQs
an anti-pythonic map reduce utility
We found that mr-streams demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.