Skip to main content

Bash-style brace expansion for Python

Project description

build-status-img

Implements Brace Expansion as described in bash(1), with the following limitations:

  • A pattern containing unbalanced braces will raise an UnbalancedBracesError exception. In bash, unbalanced braces will either be partly expanded or ignored.
  • A mixed-case character range like '{Z..a}' or '{a..Z}' will not include the characters []^_` between Z and a.

The braceexpand function returns an iterator over the expansions generated from a pattern.

Example:

>>> from braceexpand import braceexpand
>>> list(braceexpand('python{2.{5..7},3.{2,3}}'))
['python2.5', 'python2.6', 'python2.7', 'python3.2', 'python3.3']

Installation

Drop the braceexpand.py file into your project, or install the braceexpand package from pypi:

$ pip install braceexpand

License

braceexpand is licensed unter the MIT License. See the included file LICENSE for details.

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
braceexpand-0.1.tar.gz (5.3 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page