Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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:
.. code-block:: python
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:
.. code-block:: python
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.
.. code-block:: python
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:
.. code-block:: python
values = range(4) predicates = [] list(map(list, multi_split_by(values, predicates))) [[0, 1, 2, 3]]
Install from PyPI with:
.. code-block:: bash
$ pip install multisplitby
or get the latest code from GitHub <https://github.com/cthoyt/multisplitby>
_ with:
.. code-block:: bash
$ git clone https://github.com/cthoyt/multisplitby.git $ cd multisplitby $ pip install -e .
.. |build| image:: https://travis-ci.com/cthoyt/multisplitby.svg?branch=master :target: https://travis-ci.com/cthoyt/multisplitby
.. |coverage| image:: https://codecov.io/gh/cthoyt/multisplitby/branch/master/graph/badge.svg :target: https://codecov.io/gh/cthoyt/multisplitby
FAQs
Split an iterable into multiple using arbitrary predicates.
We found that multisplitby demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.