Bash style brace expander.
Project description
Bracex
Bracex is a brace expanding library (à la Bash) for Python. Brace expanding is used to generate arbitrary strings.
$ echo {{a,b},c}d
ad bd cd
Bracex adds this ability to Python:
>>> bracex.expand(r'file-{{a,b},c}d.txt')
['file-ad.txt', 'file-bd.txt', 'file-cd.txt']
-
Why Bracex over other solutions?
Bracex actually follows pretty closely to how Bash processes braces. It is not a 1:1 implementation of how Bash handles braces, but generally, it follows very closely. Almost all of the test cases are run through Bash first, then our implementation is compared against the results Bash gives. There are a few cases where we have purposely deviated. For instance, we are not handling Bash's command line inputs, so we are not giving special meaning to back ticks and quotes at this time.
Install
$ pip install bracex
Documentation
Documentation is found here: https://facelessuser.github.io/bracex/.
License
MIT License
Copyright (c) 2018 - 2021 Isaac Muse
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
File details
Details for the file bracex-2.1.1.tar.gz
.
File metadata
- Download URL: bracex-2.1.1.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01f715cd0ed7a622ec8b32322e715813f7574de531f09b70f6f3b2c10f682425 |
|
MD5 | 43d4fc88823550525fdedbbacfa2ddcf |
|
BLAKE2b-256 | bb807118945282845f8dc337c45c7d9d171a9f86d0c7650ac7e65d60995691d2 |
File details
Details for the file bracex-2.1.1-py3-none-any.whl
.
File metadata
- Download URL: bracex-2.1.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64e2a6d14de9c8e022cf40539ac8468ba7c4b99550a2b05fc87fd20e392e568f |
|
MD5 | 4b232b79a5cecf1461efc66f5f9884cc |
|
BLAKE2b-256 | 0f50842c50df5f2b6811e2f3e3aa2b88d36bc5e4d950a6e9b5f74ccd5282e3f5 |