in map_processor.py [0:0]
def apply_sync(fn: StreamFn, content: Iterable[_T]) -> list[_T]:
"""Applies a part function synchronously.
Args:
fn: the part function to apply to the content.
content: a collection of inputs/parts on which to apply the function.
Returns:
the content, with the function `fn` applied to each input/part.
"""
async def run_with_context():
async with context.context():
as_async = streams.stream_content(content)
return await streams.gather_stream(fn(as_async))
return asyncio.run(run_with_context())