tinystream 0.1.18__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tinystream-0.1.18/tinystream.egg-info → tinystream-1.0.0}/PKG-INFO +19 -18
- {tinystream-0.1.18 → tinystream-1.0.0}/README.md +17 -16
- {tinystream-0.1.18 → tinystream-1.0.0}/setup.py +1 -1
- {tinystream-0.1.18 → tinystream-1.0.0/tinystream.egg-info}/PKG-INFO +19 -18
- {tinystream-0.1.18 → tinystream-1.0.0}/LICENSE +0 -0
- {tinystream-0.1.18 → tinystream-1.0.0}/setup.cfg +0 -0
- {tinystream-0.1.18 → tinystream-1.0.0}/tests/test_opt.py +0 -0
- {tinystream-0.1.18 → tinystream-1.0.0}/tests/test_streams.py +0 -0
- {tinystream-0.1.18 → tinystream-1.0.0}/tinystream.egg-info/SOURCES.txt +0 -0
- {tinystream-0.1.18 → tinystream-1.0.0}/tinystream.egg-info/dependency_links.txt +0 -0
- {tinystream-0.1.18 → tinystream-1.0.0}/tinystream.egg-info/top_level.txt +0 -0
- {tinystream-0.1.18 → tinystream-1.0.0}/tinystream.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tinystream
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Yet another python streams library
|
|
5
|
-
Home-page: https://github.com/mreiche/
|
|
5
|
+
Home-page: https://github.com/mreiche/tinystream
|
|
6
6
|
Author: Mike Reiche
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
@@ -13,15 +13,13 @@ Dynamic: home-page
|
|
|
13
13
|
Dynamic: license-file
|
|
14
14
|
Dynamic: summary
|
|
15
15
|
|
|
16
|
-
[](https://github.com/mreiche/tinystream/actions/workflows/tests.yml)
|
|
17
|
+
[](https://app.codecov.io/github/mreiche/tinystream)
|
|
18
18
|
[](https://badge.fury.io/py/tinystream)
|
|
19
19
|
|
|
20
|
-
# tinystream
|
|
20
|
+
# tinystream
|
|
21
21
|
|
|
22
|
-
This is a
|
|
23
|
-
|
|
24
|
-
This package is released as `tinystream` at pypi.
|
|
22
|
+
This is a tiny, lightweight and simple Streams API inspired by Java Streams with support for type hinting.
|
|
25
23
|
|
|
26
24
|
## Basic API
|
|
27
25
|
|
|
@@ -30,14 +28,17 @@ from tinystream import Stream
|
|
|
30
28
|
|
|
31
29
|
stream = Stream([1, 2, 3, 4, 5]) # Stream.of_many(*), Stream.of_dict()
|
|
32
30
|
|
|
31
|
+
for item in stream:
|
|
32
|
+
pass
|
|
33
|
+
|
|
33
34
|
stream \
|
|
34
|
-
.map(lambda x: x + 1) \
|
|
35
|
-
.filter(lambda x: x > 2) \
|
|
36
|
-
.sorted(reverse=True) \
|
|
35
|
+
.map(lambda x: x + 1) \ # flatmap(), peek(), map_key(), map_kwargs(), map_keys()
|
|
36
|
+
.filter(lambda x: x > 2) \ # filter_key(), filter_type()
|
|
37
|
+
.sorted(reverse=True) \ # sort()
|
|
37
38
|
.reverse() \
|
|
38
39
|
.limit(2) \
|
|
39
|
-
.concat([4]) \
|
|
40
|
-
.sum()
|
|
40
|
+
.concat([4, 6]) \
|
|
41
|
+
.sum() # reduce(), max(), min(), collect(), count(), find()
|
|
41
42
|
```
|
|
42
43
|
|
|
43
44
|
## Aggregators
|
|
@@ -166,7 +167,7 @@ if char == "a":
|
|
|
166
167
|
|
|
167
168
|
### Opt usage
|
|
168
169
|
|
|
169
|
-
Get next value as `Opt`:
|
|
170
|
+
Get the next value as `Opt`:
|
|
170
171
|
|
|
171
172
|
```python
|
|
172
173
|
assert Stream((1, 2, 3, 4, 5)).next().present
|
|
@@ -206,11 +207,11 @@ data = {
|
|
|
206
207
|
]
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
# With tinystream
|
|
210
|
+
# With tinystream
|
|
210
211
|
for range_data in Opt(data).map_key("ranges").stream().map_kwargs(timedelta):
|
|
211
212
|
pass
|
|
212
213
|
|
|
213
|
-
#
|
|
214
|
+
# Vanilla Python
|
|
214
215
|
if "ranges" in data:
|
|
215
216
|
range_data: timedelta
|
|
216
217
|
for range_data in map(lambda x: timedelta(**x), data["ranges"]):
|
|
@@ -219,7 +220,7 @@ if "ranges" in data:
|
|
|
219
220
|
|
|
220
221
|
### Write better code with `Opt`
|
|
221
222
|
```python
|
|
222
|
-
# tinystream
|
|
223
|
+
# With tinystream
|
|
223
224
|
var = Opt(my_dict).kmap("key").filter(not_empty).get("default")
|
|
224
225
|
|
|
225
226
|
# Vanilla Python
|
|
@@ -229,7 +230,7 @@ var = my_dict["key"] if "key" in my_dict and not_empty(my_dict["key"]) else "def
|
|
|
229
230
|
|
|
230
231
|
## Comparison with other libraries
|
|
231
232
|
|
|
232
|
-
There are a couple of other
|
|
233
|
+
There are a couple of other implementations to fulfill similar requirements.
|
|
233
234
|
|
|
234
235
|
- https://github.com/vxgmichel/aiostream
|
|
235
236
|
- https://github.com/python-streamz/streamz
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
[](https://github.com/mreiche/tinystream/actions/workflows/tests.yml)
|
|
2
|
+
[](https://app.codecov.io/github/mreiche/tinystream)
|
|
3
3
|
[](https://badge.fury.io/py/tinystream)
|
|
4
4
|
|
|
5
|
-
# tinystream
|
|
5
|
+
# tinystream
|
|
6
6
|
|
|
7
|
-
This is a
|
|
8
|
-
|
|
9
|
-
This package is released as `tinystream` at pypi.
|
|
7
|
+
This is a tiny, lightweight and simple Streams API inspired by Java Streams with support for type hinting.
|
|
10
8
|
|
|
11
9
|
## Basic API
|
|
12
10
|
|
|
@@ -15,14 +13,17 @@ from tinystream import Stream
|
|
|
15
13
|
|
|
16
14
|
stream = Stream([1, 2, 3, 4, 5]) # Stream.of_many(*), Stream.of_dict()
|
|
17
15
|
|
|
16
|
+
for item in stream:
|
|
17
|
+
pass
|
|
18
|
+
|
|
18
19
|
stream \
|
|
19
|
-
.map(lambda x: x + 1) \
|
|
20
|
-
.filter(lambda x: x > 2) \
|
|
21
|
-
.sorted(reverse=True) \
|
|
20
|
+
.map(lambda x: x + 1) \ # flatmap(), peek(), map_key(), map_kwargs(), map_keys()
|
|
21
|
+
.filter(lambda x: x > 2) \ # filter_key(), filter_type()
|
|
22
|
+
.sorted(reverse=True) \ # sort()
|
|
22
23
|
.reverse() \
|
|
23
24
|
.limit(2) \
|
|
24
|
-
.concat([4]) \
|
|
25
|
-
.sum()
|
|
25
|
+
.concat([4, 6]) \
|
|
26
|
+
.sum() # reduce(), max(), min(), collect(), count(), find()
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
## Aggregators
|
|
@@ -151,7 +152,7 @@ if char == "a":
|
|
|
151
152
|
|
|
152
153
|
### Opt usage
|
|
153
154
|
|
|
154
|
-
Get next value as `Opt`:
|
|
155
|
+
Get the next value as `Opt`:
|
|
155
156
|
|
|
156
157
|
```python
|
|
157
158
|
assert Stream((1, 2, 3, 4, 5)).next().present
|
|
@@ -191,11 +192,11 @@ data = {
|
|
|
191
192
|
]
|
|
192
193
|
}
|
|
193
194
|
|
|
194
|
-
# With tinystream
|
|
195
|
+
# With tinystream
|
|
195
196
|
for range_data in Opt(data).map_key("ranges").stream().map_kwargs(timedelta):
|
|
196
197
|
pass
|
|
197
198
|
|
|
198
|
-
#
|
|
199
|
+
# Vanilla Python
|
|
199
200
|
if "ranges" in data:
|
|
200
201
|
range_data: timedelta
|
|
201
202
|
for range_data in map(lambda x: timedelta(**x), data["ranges"]):
|
|
@@ -204,7 +205,7 @@ if "ranges" in data:
|
|
|
204
205
|
|
|
205
206
|
### Write better code with `Opt`
|
|
206
207
|
```python
|
|
207
|
-
# tinystream
|
|
208
|
+
# With tinystream
|
|
208
209
|
var = Opt(my_dict).kmap("key").filter(not_empty).get("default")
|
|
209
210
|
|
|
210
211
|
# Vanilla Python
|
|
@@ -214,7 +215,7 @@ var = my_dict["key"] if "key" in my_dict and not_empty(my_dict["key"]) else "def
|
|
|
214
215
|
|
|
215
216
|
## Comparison with other libraries
|
|
216
217
|
|
|
217
|
-
There are a couple of other
|
|
218
|
+
There are a couple of other implementations to fulfill similar requirements.
|
|
218
219
|
|
|
219
220
|
- https://github.com/vxgmichel/aiostream
|
|
220
221
|
- https://github.com/python-streamz/streamz
|
|
@@ -14,7 +14,7 @@ setup(
|
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type="text/markdown",
|
|
16
16
|
version=VERSION,
|
|
17
|
-
url="https://github.com/mreiche/
|
|
17
|
+
url="https://github.com/mreiche/tinystream",
|
|
18
18
|
author="Mike Reiche",
|
|
19
19
|
py_modules=['tinystream'],
|
|
20
20
|
install_requires=[],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tinystream
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Yet another python streams library
|
|
5
|
-
Home-page: https://github.com/mreiche/
|
|
5
|
+
Home-page: https://github.com/mreiche/tinystream
|
|
6
6
|
Author: Mike Reiche
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
@@ -13,15 +13,13 @@ Dynamic: home-page
|
|
|
13
13
|
Dynamic: license-file
|
|
14
14
|
Dynamic: summary
|
|
15
15
|
|
|
16
|
-
[](https://github.com/mreiche/tinystream/actions/workflows/tests.yml)
|
|
17
|
+
[](https://app.codecov.io/github/mreiche/tinystream)
|
|
18
18
|
[](https://badge.fury.io/py/tinystream)
|
|
19
19
|
|
|
20
|
-
# tinystream
|
|
20
|
+
# tinystream
|
|
21
21
|
|
|
22
|
-
This is a
|
|
23
|
-
|
|
24
|
-
This package is released as `tinystream` at pypi.
|
|
22
|
+
This is a tiny, lightweight and simple Streams API inspired by Java Streams with support for type hinting.
|
|
25
23
|
|
|
26
24
|
## Basic API
|
|
27
25
|
|
|
@@ -30,14 +28,17 @@ from tinystream import Stream
|
|
|
30
28
|
|
|
31
29
|
stream = Stream([1, 2, 3, 4, 5]) # Stream.of_many(*), Stream.of_dict()
|
|
32
30
|
|
|
31
|
+
for item in stream:
|
|
32
|
+
pass
|
|
33
|
+
|
|
33
34
|
stream \
|
|
34
|
-
.map(lambda x: x + 1) \
|
|
35
|
-
.filter(lambda x: x > 2) \
|
|
36
|
-
.sorted(reverse=True) \
|
|
35
|
+
.map(lambda x: x + 1) \ # flatmap(), peek(), map_key(), map_kwargs(), map_keys()
|
|
36
|
+
.filter(lambda x: x > 2) \ # filter_key(), filter_type()
|
|
37
|
+
.sorted(reverse=True) \ # sort()
|
|
37
38
|
.reverse() \
|
|
38
39
|
.limit(2) \
|
|
39
|
-
.concat([4]) \
|
|
40
|
-
.sum()
|
|
40
|
+
.concat([4, 6]) \
|
|
41
|
+
.sum() # reduce(), max(), min(), collect(), count(), find()
|
|
41
42
|
```
|
|
42
43
|
|
|
43
44
|
## Aggregators
|
|
@@ -166,7 +167,7 @@ if char == "a":
|
|
|
166
167
|
|
|
167
168
|
### Opt usage
|
|
168
169
|
|
|
169
|
-
Get next value as `Opt`:
|
|
170
|
+
Get the next value as `Opt`:
|
|
170
171
|
|
|
171
172
|
```python
|
|
172
173
|
assert Stream((1, 2, 3, 4, 5)).next().present
|
|
@@ -206,11 +207,11 @@ data = {
|
|
|
206
207
|
]
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
# With tinystream
|
|
210
|
+
# With tinystream
|
|
210
211
|
for range_data in Opt(data).map_key("ranges").stream().map_kwargs(timedelta):
|
|
211
212
|
pass
|
|
212
213
|
|
|
213
|
-
#
|
|
214
|
+
# Vanilla Python
|
|
214
215
|
if "ranges" in data:
|
|
215
216
|
range_data: timedelta
|
|
216
217
|
for range_data in map(lambda x: timedelta(**x), data["ranges"]):
|
|
@@ -219,7 +220,7 @@ if "ranges" in data:
|
|
|
219
220
|
|
|
220
221
|
### Write better code with `Opt`
|
|
221
222
|
```python
|
|
222
|
-
# tinystream
|
|
223
|
+
# With tinystream
|
|
223
224
|
var = Opt(my_dict).kmap("key").filter(not_empty).get("default")
|
|
224
225
|
|
|
225
226
|
# Vanilla Python
|
|
@@ -229,7 +230,7 @@ var = my_dict["key"] if "key" in my_dict and not_empty(my_dict["key"]) else "def
|
|
|
229
230
|
|
|
230
231
|
## Comparison with other libraries
|
|
231
232
|
|
|
232
|
-
There are a couple of other
|
|
233
|
+
There are a couple of other implementations to fulfill similar requirements.
|
|
233
234
|
|
|
234
235
|
- https://github.com/vxgmichel/aiostream
|
|
235
236
|
- https://github.com/python-streamz/streamz
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|