wildcard
This library is a fork of fnmatch (https://docs.python.org/2/library/fnmatch.html) to implement **
All documentation is identical to fnmatch except * , * is now ** and * only affects the particular directory
https://docs.python.org/2/library/fnmatch.html
Install
pip install pywildcard
Link pypi: https://pypi.python.org/pypi/pywildcard
Examples
import pywildcard
dirs = ['hello/world.py', 'hello/world.pyc', 'hello/world/other/folder/example.py']
pywildcard.filter(dirs, 'hello/*')
# ['hello/world.py', 'hello/world.pyc']
pywildcard.filter(dirs, 'hello/*.py')
# ['hello/world.py']
pywildcard.filter(dirs, 'hello/**')
# ['hello/world.py', 'hello/world.pyc', 'hello/world/other/folder/example.py']
pywildcard.filter(dirs, 'hello/**.py')
# ['hello/world.py', 'hello/world/other/folder/example.py']
Diffs fnmatch & pywildcard
fnmatch
import re
import fnmatch
urls = ['example/l1/l2/test3-1.py',
'example/l1/test2-1.py',
'example/l1/test2-2.py',
'example/l1/l2/l3/test4-1.py']
regex = fnmatch.translate('example/*')
# 'example\\/.*\\Z(?ms)'
re.findall(regex, "\n".join(urls))
# return ['example/l1/l2/test3-1.py\nexample/l1/test2-1.py\nexample/l1/test2-2.py\nexample/l1/l2/l3/test4-1.py']
pywildcard
import re
import pywildcard
urls = ['example/l1/l2/test3-1.py',
'example/l1/test2-1.py',
'example/l1/test2-2.py',
'example/l1/l2/l3/test4-1.py']
regex = pywildcard.translate('example/**')
# 'example/.*?$(?ms)'
re.findall(regex, "\n".join(urls))
# return ['example/l1/l2/test3-1.py',
# 'example/l1/test2-1.py',
# 'example/l1/test2-2.py',
# 'example/l1/l2/l3/test4-1.py']
Running the unit tests
```bash # Check out the git repository. git clone git@github.com:agalera/python-wildcard.git # Enter the directory. cd python-wildcard # Install pytest if you have not done already. pip install pytest # Run the tests pytest
CHANGELOG
1.0.8 (2015-11-26)
update README.md
1.0.7 (2015-11-25)
Add documentation
Metadata
Release files for pywildcard 1.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pywildcard-1.0.10.tar.gz | 3.6 kB | Without provenance | Details for pywildcard-1.0.10.tar.gz |
Release files / pywildcard-1.0.10.tar.gz
| Download URL | pywildcard-1.0.10.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
825f7dc4eac27fdb2f59052ccccf6e3cbbbc09e3c8b07c5021b2b841cccb6161
|
|
BLAKE2b-256 checksum How to use checksums |
c2d476fe6f50a6e18b112338a171ff05e787e47620ed68f8e422bac6317142c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.5
|
Security for pywildcard 1.0.10
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.