A functional interface for python iterator
Project description
functionalstream
Installation
pip install functionalstream
Example
Stream
from functionalstream import Stream
# lst1 = [0, 6, 12, 18, 24]
lst1 = Stream(range(10)).filter(lambda x: x % 2 == 0).map(lambda x: x * 3).to_list()
# lst2 = [(1, 2), (3, 4)]
lst2 = Stream([(1,2), (3,4), (6,5)]).filter(lambda x, y: x < y, star=True).to_list()
# array = array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
array = Stream(range(10)).to_numpy_array(dtype=float)
# for function which has side effect
Stream(range(10)).apply(lambda x: print(x))
PathStream
from functionalstream import PathStream
video_paths = PathStream.from_path('./').filter_extension(extensions={".jpeg"})
Pipeline
from functionalstream.functions import increment
from functionalstream import Stream
# x = 3
x = Stream([increment] * 3).pipeline(0)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
functionalstream-0.1.8.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for functionalstream-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f2735ed290f71f70998d1f8d515b00ada5b5b583b44517e3327d059514195b7 |
|
MD5 | 2045f07f520dd52c59e467233b942b5d |
|
BLAKE2b-256 | 5993c01f90468ac9217d2919ce3a69286cdc153edbf1a93973d631120521143f |