https://github.com/byte-sourcerer/functionalstream
https://github.com/byte-sourcerer/functionalstream
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/byte-sourcerer/functionalstream
- Owner: byte-sourcerer
- License: mit
- Created: 2020-07-12T04:00:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-27T06:09:23.000Z (over 5 years ago)
- Last Synced: 2025-08-22T08:23:41.503Z (6 months ago)
- Language: Python
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# functionalstream
## Installation
```shell script
pip install functionalstream
```
## Example
### Stream
```python
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
```python
from functionalstream import PathStream
video_paths = PathStream.from_path('./').filter_extension(extensions={".jpeg"})
```
### Pipeline
```python
from functionalstream.functions import increment
from functionalstream import Stream
# x = 3
x = Stream([increment] * 3).pipeline(0)
```