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.0.tar.gz (9.0 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.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: k3fnmatch-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 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.0.tar.gz
Algorithm Hash digest
SHA256 68a4cd473a80d1280d8eb90d1bc727197928da7a6547fbb37adac850e8fd3d86
MD5 ae651b16e86971de91105e1cde33f035
BLAKE2b-256 be69cddf2c23e3880cd17f683b489bbf16ac4dd4f14d6e1a9f951091f70a137b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: k3fnmatch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf49255f60ad532183bd4f5bd99d4198de874ba89af86fc0bbcfcc3f95e33edb
MD5 7d2f772e166ac952123299c8dc38e8c6
BLAKE2b-256 c5e34cc29bc2bb75fdfda765cf6eea5a77c2c79c3a6d04edb2d87504ece7b253

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