A custom combination generator
Project description
Custom Combination
Version 0.0.1
Python implementation for Custom Combination.
Usage
Programmatic usage
from custom_combination import CustomCombination
CustomCombination.generate(
items=[("a", 1), ("b", 2), ("c", 3), "d"],
pick=3,
min_picks=[("b", 1), ("a", 0)],
max_picks=[("a", 0)])
CLI usage
custom_combination --items "a,b,b,c,c,c,d" -pick 3 -minp "b,1" -maxp "a,0"
Output:
['b', 'c', 'd']
['b', 'c', 'c']
Set up locally for development
-
Clone the repository
git clone git@github.com:yilmazhasan/custom_combination.git -
Create and activate the virtural environment
python -m venv .venvsource .venv/bin/activate -
Install requirements:
pip install -r requirements.txt -
Run the app:
python src/custom_combination/app.py --items a,b,c,d -pick a,0 -minp b,1 -max a,0 -
Test the app:
pytest
Args Explained
--items "a,b,b,c,c,c,d" -pick 3 -min-picks b,1 -max-picks a,0
or shortly:
--items "a,b,b,c,c,c,d" -p 3 -minp b,1 -maxp a,0
This indicates that:
-
We have four items in the set
["a", "b", "c", "d"]but with different frequencies. -
Thus we have the list as
["a", "b", "b", "c", "c", "c", "d"] -
We want to generate combinations that have 3 items, which
-pick 3specifies. -
We want to pick at least:
- 1 occurrences of
"b"
- 1 occurrences of
-
We want to pick at max:
- 0 occurrences of
"a"
- 0 occurrences of
This indicates the list to generate from is:
["b", "b", "c", "c", "c", "d"] out of
["a", "b", "b", "c", "c", "c", "d"] as "a" is excluded.
Since "b" is to be included once, we need to select 2 more items from the list ["c", "c", "c", "d"], so we can select ["c", "c"] or ["c", "d"]
Expected output:
[
["b", "c", "c"],
["b", "c", "d"]
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file custom_combination-0.0.1.tar.gz.
File metadata
- Download URL: custom_combination-0.0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3df5c4ca28b75af318038e115745758f4b8c2988b8298b9670a6e5965e4a3879
|
|
| MD5 |
2f828ac5b73a345f5df8ed3b39488082
|
|
| BLAKE2b-256 |
1ec0f3397602afde35f13339882896de5204897679c2a7da5667fc4b3062acea
|
Provenance
The following attestation bundles were made for custom_combination-0.0.1.tar.gz:
Publisher:
publish-to-pypi.yaml on yilmazhasan/custom_combination
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
custom_combination-0.0.1.tar.gz -
Subject digest:
3df5c4ca28b75af318038e115745758f4b8c2988b8298b9670a6e5965e4a3879 - Sigstore transparency entry: 1803128993
- Sigstore integration time:
-
Permalink:
yilmazhasan/custom_combination@8acef1bc30b2ce1c027df3d83a2f52e17378efcc -
Branch / Tag:
refs/tags/0.0.1 - Owner: https://github.com/yilmazhasan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yaml@8acef1bc30b2ce1c027df3d83a2f52e17378efcc -
Trigger Event:
push
-
Statement type:
File details
Details for the file custom_combination-0.0.1-py3-none-any.whl.
File metadata
- Download URL: custom_combination-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8887b8eb04dbfba8643ed63b101aeae3bde384bff7fec8da4e5744ccf983eff
|
|
| MD5 |
851650cc9bcce84c23e96f652f1d7ff4
|
|
| BLAKE2b-256 |
abe31e917bac0db4d366d4ed840a497a8fe2737bb5be29aa3ac4ce3b654dc819
|
Provenance
The following attestation bundles were made for custom_combination-0.0.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yaml on yilmazhasan/custom_combination
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
custom_combination-0.0.1-py3-none-any.whl -
Subject digest:
c8887b8eb04dbfba8643ed63b101aeae3bde384bff7fec8da4e5744ccf983eff - Sigstore transparency entry: 1803129015
- Sigstore integration time:
-
Permalink:
yilmazhasan/custom_combination@8acef1bc30b2ce1c027df3d83a2f52e17378efcc -
Branch / Tag:
refs/tags/0.0.1 - Owner: https://github.com/yilmazhasan
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yaml@8acef1bc30b2ce1c027df3d83a2f52e17378efcc -
Trigger Event:
push
-
Statement type: