Skip to main content

bracket_expansion

This library provides functions that allow you to define a string that contains brackets with numeric-ranges, and then expands that into a list of actual values.

There are two functions defined. The first function bracket_expansion will create a generator. You can then iterate through the generator.

The expansion supports multiple brackets. See examples.

If you want to create a concrete list from the generate, there is a function called expand which will do this as a convenience.

Installation

$ pip install bracket_expansion

Usage

Simple example:

from bracket_expansion import bracket_expansion

for if_name in bracket_expansion("Ethernet[1-48]"):
    print(if_name)

Would result in the output:

Ethernet1
Ethernet2
Ethernet3
...
Ethernet48

Multiple brackets:

You can define multiple brackets in the expression:

from bracket_expansion import bracket_expansion

for if_name in bracket_expansion("Ethernet[1-2]/[1-10]"):
    print(if_name)

Would result in the output:

Ethernet1/1
Ethernet1/2
...
Ethernet1/10
Ethernet2/1
Ethernet2/2
...
Ethernet2/10

For more details see the bracket_expansion docstring.

Metadata

Release files for bracket-expansion 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bracket-expansion 1.0.0
File Size Uploaded Provenance
bracket_expansion-1.0.0.tar.gz 3.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bracket-expansion 1.0.0
File Interpreter ABI Platform
bracket_expansion-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / bracket_expansion-1.0.0.tar.gz

Download URL bracket_expansion-1.0.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a19c96d0bb011b9a4cf4aaebab36bbc6e3d34a2857b4fbfe435d860bfe65e0a1
BLAKE2b-256 checksum
How to use checksums
34c0dba08af1a7a119e0651e04f37312975014e0f600d36e3159bfbe38e2dba0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Release files / bracket_expansion-1.0.0-py3-none-any.whl

Download URL bracket_expansion-1.0.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e7f22979c87d44d2c78c074578f7e72470c1627251961527e0044fed9455070
BLAKE2b-256 checksum
How to use checksums
3f68d38019213ea5623660e3b5dbf2879a0ffc8011d65501f7b32fe793f7e87e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Security for bracket-expansion 1.0.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page