multisplitby

Split an iterable into multiple using arbitrary predicates.
This package comes with a single function: multisplitby.multi_split_by.
For all lists values and predicates, the following conditions are always true:
1 + len(predicates) = len(list(multi_split_by(values, predicates)))
values == itertools.chain.from_iterable(multi_split_by(values, predicates))
Normal usage with one predicate:
>>> values = range(4)
>>> predicates = [lambda x: 2 < x]
>>> list(map(list, multi_split_by(values, predicates)))
[[0, 1, 2], [3]]
Normal usage with several predicates:
>>> values = range(9)
>>> predicates = [lambda x: 2 < x, lambda x: 4 < x, lambda x: 7 < x]
>>> list(map(list, multi_split_by(values, predicates)))
[[0, 1, 2], [3, 4], [5, 6, 7], [8]]
If no values are given, will result in |predicates| + 1 generators, all yielding empty lists.
>>> values = []
>>> predicates = [lambda x: 2 < x, lambda x: 4 < x, lambda x: 7 < x]
>>> list(map(list, multi_split_by(values, predicates)))
[[], [], [], []]
If no predicates are given, will result in a single generator that yields the original list:
>>> values = range(4)
>>> predicates = []
>>> list(map(list, multi_split_by(values, predicates)))
[[0, 1, 2, 3]]
Installation
Install from PyPI with:
$ pip install multisplitby
or get the latest code from GitHub with:
$ git clone https://github.com/cthoyt/multisplitby.git
$ cd multisplitby
$ pip install -e .
Metadata
Release files for multisplitby 0.0.1
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 | Actions |
|---|---|---|---|---|
| multisplitby-0.0.1.tar.gz | 5.6 kB | Without provenance | Details for multisplitby-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| multisplitby-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for multisplitby-0.0.1-py3-none-any.whl |
Total release size: 9.6 kB
Release files / multisplitby-0.0.1.tar.gz
| Download URL | multisplitby-0.0.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e40489fa174fd7afd28a895477e6eefc64d6cfd863cca6900530e436a40e356f
|
|
BLAKE2b-256 checksum How to use checksums |
2b2e595fef86e166573aef74de303a95f89c6d6e32df8f036dc4b97279758d62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Release files / multisplitby-0.0.1-py3-none-any.whl
| Download URL | multisplitby-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab9237c1366e0cd9eecc87cfa5c0330b4843dfcafe71408ea2d8864659f69897
|
|
BLAKE2b-256 checksum How to use checksums |
b18fa054cb80019076a42b2a2876b76aea0c48c44c2fefd86bc59782967fcc13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Security for multisplitby 0.0.1
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.