iter_model 2.3.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.
- iter_model-2.3.0/LICENSE +19 -0
- iter_model-2.3.0/PKG-INFO +80 -0
- iter_model-2.3.0/README.md +60 -0
- iter_model-2.3.0/iter_model/__init__.py +2 -0
- iter_model-2.3.0/iter_model/async_iter.py +691 -0
- iter_model-2.3.0/iter_model/async_iter.pyi +161 -0
- iter_model-2.3.0/iter_model/async_utils.py +19 -0
- iter_model-2.3.0/iter_model/empty_iterator.py +18 -0
- iter_model-2.3.0/iter_model/sync_iter.py +527 -0
- iter_model-2.3.0/iter_model/sync_iter.pyi +143 -0
- iter_model-2.3.0/pyproject.toml +54 -0
iter_model-2.3.0/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2022 Volodymyr Borysiuk
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: iter_model
|
|
3
|
+
Version: 2.3.0
|
|
4
|
+
Summary: iter-model uses a method approach instead of individual functions to work with iterable objects.
|
|
5
|
+
Home-page: https://volodymyrbor.github.io/iter_model/
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: iterator,iterable
|
|
8
|
+
Author: volodymyrb
|
|
9
|
+
Author-email: volodymyr.borysiuk0@gmail.com
|
|
10
|
+
Requires-Python: >=3.10,<4.0
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Project-URL: Documentation, https://volodymyrbor.github.io/iter_model/
|
|
17
|
+
Project-URL: Repository, https://github.com/VolodymyrBor/iter_model
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://volodymyrbor.github.io/iter_model">
|
|
22
|
+
<img src="https://volodymyrbor.github.io/iter_model/img/iter_model-logos_transparent.png" alt="IterModel" width="300">
|
|
23
|
+
</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<a href="https://pypi.org/project/iter_model" target="_blank">
|
|
28
|
+
<img src="https://img.shields.io/pypi/pyversions/iter_model.svg?color=%2334D058" alt="Supported Python versions">
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://pypi.org/project/iter_model" target="_blank">
|
|
31
|
+
<img src="https://img.shields.io/pypi/v/iter_model?color=%2334D058&label=pypi%20package" alt="Package version">
|
|
32
|
+
</a>
|
|
33
|
+
<a href="https://github.com/VolodymyrBor/iter_model/actions/workflows/build.yml?branch=master" target="_blank">
|
|
34
|
+
<img src="https://github.com/VolodymyrBor/iter_model/actions/workflows/build.yml/badge.svg?branch=master" alt="Test">
|
|
35
|
+
</a>
|
|
36
|
+
|
|
37
|
+
[](https://shields.io/)
|
|
38
|
+
[](https://shields.io/)
|
|
39
|
+
[](https://shields.io/)
|
|
40
|
+
[](https://shields.io/)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
**iter_model** - provides a convenient API for interacting with iterable objects ([Iterable]).
|
|
45
|
+
iter_model uses a methods approach instead of individual functions.
|
|
46
|
+
|
|
47
|
+
iter_model also provides **async** analog of all methods.
|
|
48
|
+
This is useful when interacting with asynchronous iterable objects ([AsyncIterable]),
|
|
49
|
+
because python does not have ready functions for these cases.
|
|
50
|
+
|
|
51
|
+
Therefore, **iter_model** provides **SyncIter** class for [Iterable],
|
|
52
|
+
and **AsyncIter** for [AsyncIterable].
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Example
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from iter_model import SyncIter
|
|
60
|
+
|
|
61
|
+
it = SyncIter(range(10)) # SyncIter for sync iterables
|
|
62
|
+
result = (
|
|
63
|
+
it.where(lambda x: x % 2 == 0) # filter only odd values
|
|
64
|
+
.take(3) # take first 3 value
|
|
65
|
+
.map(lambda x: x ** 2) # square all values
|
|
66
|
+
)
|
|
67
|
+
print(result.to_list())
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Links
|
|
71
|
+
|
|
72
|
+
**Source code**: [github.com/VolodymyrBor/iter_model](https://github.com/VolodymyrBor/iter_model)
|
|
73
|
+
|
|
74
|
+
**Documentation**: [iter_model](https://volodymyrbor.github.io/iter_model/)
|
|
75
|
+
|
|
76
|
+
**Changelog**: [changelog](https://volodymyrbor.github.io/iter_model/changelog)
|
|
77
|
+
|
|
78
|
+
[Iterable]: https://docs.python.org/3/library/typing.html#typing.Iterable
|
|
79
|
+
[AsyncIterable]: https://docs.python.org/3/library/typing.html#typing.AsyncIterable
|
|
80
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://volodymyrbor.github.io/iter_model">
|
|
3
|
+
<img src="https://volodymyrbor.github.io/iter_model/img/iter_model-logos_transparent.png" alt="IterModel" width="300">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
<a href="https://pypi.org/project/iter_model" target="_blank">
|
|
9
|
+
<img src="https://img.shields.io/pypi/pyversions/iter_model.svg?color=%2334D058" alt="Supported Python versions">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://pypi.org/project/iter_model" target="_blank">
|
|
12
|
+
<img src="https://img.shields.io/pypi/v/iter_model?color=%2334D058&label=pypi%20package" alt="Package version">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://github.com/VolodymyrBor/iter_model/actions/workflows/build.yml?branch=master" target="_blank">
|
|
15
|
+
<img src="https://github.com/VolodymyrBor/iter_model/actions/workflows/build.yml/badge.svg?branch=master" alt="Test">
|
|
16
|
+
</a>
|
|
17
|
+
|
|
18
|
+
[](https://shields.io/)
|
|
19
|
+
[](https://shields.io/)
|
|
20
|
+
[](https://shields.io/)
|
|
21
|
+
[](https://shields.io/)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
**iter_model** - provides a convenient API for interacting with iterable objects ([Iterable]).
|
|
26
|
+
iter_model uses a methods approach instead of individual functions.
|
|
27
|
+
|
|
28
|
+
iter_model also provides **async** analog of all methods.
|
|
29
|
+
This is useful when interacting with asynchronous iterable objects ([AsyncIterable]),
|
|
30
|
+
because python does not have ready functions for these cases.
|
|
31
|
+
|
|
32
|
+
Therefore, **iter_model** provides **SyncIter** class for [Iterable],
|
|
33
|
+
and **AsyncIter** for [AsyncIterable].
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from iter_model import SyncIter
|
|
41
|
+
|
|
42
|
+
it = SyncIter(range(10)) # SyncIter for sync iterables
|
|
43
|
+
result = (
|
|
44
|
+
it.where(lambda x: x % 2 == 0) # filter only odd values
|
|
45
|
+
.take(3) # take first 3 value
|
|
46
|
+
.map(lambda x: x ** 2) # square all values
|
|
47
|
+
)
|
|
48
|
+
print(result.to_list())
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Links
|
|
52
|
+
|
|
53
|
+
**Source code**: [github.com/VolodymyrBor/iter_model](https://github.com/VolodymyrBor/iter_model)
|
|
54
|
+
|
|
55
|
+
**Documentation**: [iter_model](https://volodymyrbor.github.io/iter_model/)
|
|
56
|
+
|
|
57
|
+
**Changelog**: [changelog](https://volodymyrbor.github.io/iter_model/changelog)
|
|
58
|
+
|
|
59
|
+
[Iterable]: https://docs.python.org/3/library/typing.html#typing.Iterable
|
|
60
|
+
[AsyncIterable]: https://docs.python.org/3/library/typing.html#typing.AsyncIterable
|