iter2
This library provides implementation of rich-iterator concept, inspired by Rust's std::iter::Iterator, Java's Stream and more-itertools library.
The original purpose of this tool was to be used within a REPL (primarily IPython) environment for processing streaming data.
The goal of v2.x is to build upon the 7 years of experience gained from the production use of v1.x, to factor out redundant functionality, and to create a well-typed public API.
Usage
iter2 - the main API of this library, behaves like builtin iter but creates an instance of iter2.interfaces.Iterator2.
iter2.interfaces - module with library specific interfaces like Iterator2 and Iterable2.
iter2.algo - module with all algorithms and their curried versions.
iter2.op - module with useful operators like nth_item, pipe and mapping_items.
iter2.box and iter2.option - modules with types of "boxed values" Box2 and Option2.
import typing as tp
from iter2 import iter2
DATA: tp.Sequence[tp.Tuple[str, int | float]] = ... # type: ignore
result: float | complex = (
iter2(DATA)
.filter_unpacked(lambda title, _: (
title.startswith('Static typing')
)) # Iterator2[tp.Tuple[str, int | float]]
.map_unpacked(lambda _, value: (
-value,
)) # Iterator2[int | float]
.filter_by_type(float) # Iterator2[float]
.apply_raw(
iter2.algo.find_max_value
) # Option2[float]
.value_or_else(lambda: 31337j) # float | complex
)
Metadata
Release files for iter2 2.0.1746745800
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| iter2-2.0.1746745800.tar.gz | 27.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iter2-2.0.1746745800-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 86.6 kB
Release files / iter2-2.0.1746745800.tar.gz
| Download URL | iter2-2.0.1746745800.tar.gz |
|---|---|
| Size | 27.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67b39db21177fdc85f654f395d80234c95ad59171c0733f164a0a2d8101c9a73
|
|
BLAKE2b-256 checksum How to use checksums |
b0c35584ed6e31f495a4325a99b5e16d3d19a7e9960c822c46f5be09e8e62589
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.2 Linux/6.8.0-57-generic
|
Release files / iter2-2.0.1746745800-py3-none-any.whl
| Download URL | iter2-2.0.1746745800-py3-none-any.whl |
|---|---|
| Size | 59.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bcc46897411b2b3aa5705faf976d19d3d7b46934c517ad29bd17907d4b761f3
|
|
BLAKE2b-256 checksum How to use checksums |
922b14ff18d744877194e6ff49dc3cb84d235af49e1382f82657d2048016d318
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.2 Linux/6.8.0-57-generic
|
Security for iter2 2.0.1746745800
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.