Enhanced fnmatch with grouping regex and path transformation
Project description
k3fnmatch
Enhanced fnmatch with grouping regex and path transformation
k3fnmatch is a component of pykit3 project: a python3 toolkit set.
Enhanced fnmatch with grouping regex and path transformation.
Provides:
- translate(): Enhanced fnmatch.translate() with grouping and ** support
- fnmap(): Transform paths using source and destination patterns
Examples: >>> import re >>> pattern = translate("**/*.md") >>> m = re.match(pattern, "foo/bar/doc.md") >>> len(m.groups()) >= 3 True
>>> fnmap("foo/bar.md", "**/*.md", "**/*-cn.md")
'foo/bar-cn.md'
Install
pip install k3fnmatch
Synopsis
>>> import re
>>> pattern = translate("**/*.md")
>>> m = re.match(pattern, "foo/bar/doc.md")
>>> len(m.groups()) >= 3
True
>>> fnmap("foo/bar.md", "**/*.md", "**/*-cn.md")
'foo/bar-cn.md'
Author
Zhang Yanpo (张炎泼) drdr.xp@gmail.com
Copyright and License
The MIT License (MIT)
Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file k3fnmatch-0.1.2.tar.gz.
File metadata
- Download URL: k3fnmatch-0.1.2.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c986530d4b22486b78667baf842dd80406868b8c585e954c3177c13e542329e
|
|
| MD5 |
b6a811af244f940f924c0f3f360e0305
|
|
| BLAKE2b-256 |
9e1fec2b09adb2cb580316ba8163dcb403b0351dfa787109a13f74abe8c49e9d
|
File details
Details for the file k3fnmatch-0.1.2-py3-none-any.whl.
File metadata
- Download URL: k3fnmatch-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e72e973a20be626f63b96e7a3d35494f9a6623489608517ecf17edcf6a90d770
|
|
| MD5 |
22d34d5d4f810ef001bc9dadcd9d2ce0
|
|
| BLAKE2b-256 |
eadaa4fe0051b660c353ba3d594a5bc2ac04d427692454142c930e44b4251550
|