Skip to main content

Enhanced fnmatch with grouping regex and path transformation

Project description

k3fnmatch

Action-CI Documentation Status Package

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


Download files

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

Source Distribution

k3fnmatch-0.1.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k3fnmatch-0.1.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file k3fnmatch-0.1.1.tar.gz.

File metadata

  • Download URL: k3fnmatch-0.1.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for k3fnmatch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4c5bedc26fbbd7b88a29aa6ad8c74ba4398ab2fc7185ff8efa0c87543efed8b5
MD5 0fc5da59af5ae3defe17a6064e2b8e1a
BLAKE2b-256 32d66667aae4576ab2025ecf92970cd51d0def6ebc2adfaff0f87f4e04dd9014

See more details on using hashes here.

File details

Details for the file k3fnmatch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: k3fnmatch-0.1.1-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

Hashes for k3fnmatch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 554e9ea3f18a7ca16c3d3672ca4aca598c606d7e7d44523318d58f8728a44e1c
MD5 6146097f6f1da4bff73cc18a4f2d1a8d
BLAKE2b-256 3597ae61ee751f1150dec8199570ab578f8a4edf1c2f9b4d0376a0ae701659f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page