Skip to main content

A CLI tool to permutate with custom options by @yilmazhasan

Project description

Custom Permutation

Version 1.0.8

Python implementation for Custom Permutation.

Usage

Programmatic usage

from custom_permutation import CustomPermutation

CustomPermutation.generate(items=["a", "b", "c", "d"], includes=["a,1"], excludes=["c,2"])

Output:

[
    ['b', 'a', 'd', 'c'],
    ['c', 'a', 'b', 'd'],
    ['c', 'a', 'd', 'b'],
    ['d', 'a', 'b', 'c']
]

CLI usage

custom_permutation --items "a,b,c,d" -i "a,1" -x "c,2"

Output:

['b', 'a', 'd', 'c']
['c', 'a', 'b', 'd']
['c', 'a', 'd', 'b']
['d', 'a', 'b', 'c']

Installation

pip install custom_permutation

Set up locally for development

  1. Clone the repository

  2. Create and activate the virtural environment

    python -m venv .venv

    source venv_mysite/bin/activate

  3. Install requirements:

    pip install -r requirements.txt

  4. Run the app:

    python src/custom_permutation/app.py --items a,b,c,d -i a,0 -x c,1 -x a,2

Args Explained

--items a,b,c,d -i a,0 -x c,1 -x a,2

This indicates that:

  • We have four items ['a', 'b', 'c', 'd'].
  • We want a to be set at index 0.
  • We want neither c to be at index 1 nor a index 2.
  • Thus, the permutation will be generated based on the options below for each indexes:
[['a'], ['a', 'b', 'd'], ['a', 'b', 'd'], ['a', 'b', 'c', 'd']]

idx n must be a member in list such as:

  • idx 0 $\in$ ['a']
  • idx 1 $\in$ ['a', 'b', 'd']
  • idx 2 $\in$ ['a', 'b', 'd']
  • idx 3 $\in$ ['a', 'b', 'c', 'd']

The result would be four lists:

a,b,c,d
a,b,d,c
a,d,b,c
a,d,c,b

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

custom_permutation-1.0.8.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

custom_permutation-1.0.8-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file custom_permutation-1.0.8.tar.gz.

File metadata

  • Download URL: custom_permutation-1.0.8.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for custom_permutation-1.0.8.tar.gz
Algorithm Hash digest
SHA256 339b70e184bbe9e8ce7413502f9a2ed757f988022f746c8fa8b7ce665fb2fef5
MD5 0ec8f648456fa1f0e3b7b7b25c85023e
BLAKE2b-256 a402d0a617c2df8e2f10ebe3784903e52a7c1e54e7e39586fa82f9ba81f17769

See more details on using hashes here.

Provenance

The following attestation bundles were made for custom_permutation-1.0.8.tar.gz:

Publisher: publish-to-pypi.yaml on yilmazhasan/custom_permutation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file custom_permutation-1.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for custom_permutation-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 974bb79572443bb82e027926edf5947cce6694da434178a122d5b7e8d2b0ed43
MD5 bcb94289b9acfa4884ba80d32887bcf0
BLAKE2b-256 ea5b9d437e193511cfa3fb879894cad54274ef769a445c41a69d33fa9b456d9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for custom_permutation-1.0.8-py3-none-any.whl:

Publisher: publish-to-pypi.yaml on yilmazhasan/custom_permutation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page