wildcard
========
This library is a fork of fnmatch
(https://docs.python.org/2/library/fnmatch.html) to implement \*\*
|PypiDownloads|
All documentation is identical to fnmatch except ``*`` , ``*`` is now
``**`` and ``*`` only affects the particular directory
https://docs.python.org/2/library/fnmatch.html
Install
-------
.. code:: bash
pip install pywildcard
Link pypi: https://pypi.python.org/pypi/pywildcard
Examples
--------
.. code:: python
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
~~~~~~~
.. code:: python
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
~~~~~~~~~~
.. code:: python
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
.. |PypiDownloads| image:: https://img.shields.io/pypi/dm/pywildcard.svg
:target: https://pypi.python.org/pypi/pywildcard
CHANGELOG
=========
1.0.8 (2015-11-26)
------------------
- update README.md
1.0.7 (2015-11-25)
------------------
- Add documentation
Raw data
{
"_id": null,
"home_page": "https://github.com/agalera/python-wildcard",
"name": "pywildcard",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "wildcard",
"author": "Firecarrot",
"author_email": "galerajimenez@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c2/d4/76fe6f50a6e18b112338a171ff05e787e47620ed68f8e422bac6317142c0/pywildcard-1.0.10.tar.gz",
"platform": "",
"description": "wildcard\n========\n\nThis library is a fork of fnmatch\n(https://docs.python.org/2/library/fnmatch.html) to implement \\*\\*\n\n|PypiDownloads|\n\nAll documentation is identical to fnmatch except ``*`` , ``*`` is now\n``**`` and ``*`` only affects the particular directory\n\nhttps://docs.python.org/2/library/fnmatch.html\n\nInstall\n-------\n\n.. code:: bash\n\n pip install pywildcard\n\nLink pypi: https://pypi.python.org/pypi/pywildcard\n\nExamples\n--------\n\n.. code:: python\n\n import pywildcard\n dirs = ['hello/world.py', 'hello/world.pyc', 'hello/world/other/folder/example.py']\n pywildcard.filter(dirs, 'hello/*')\n # ['hello/world.py', 'hello/world.pyc']\n\n pywildcard.filter(dirs, 'hello/*.py')\n # ['hello/world.py']\n\n pywildcard.filter(dirs, 'hello/**')\n # ['hello/world.py', 'hello/world.pyc', 'hello/world/other/folder/example.py']\n\n pywildcard.filter(dirs, 'hello/**.py')\n # ['hello/world.py', 'hello/world/other/folder/example.py']\n\nDiffs fnmatch & pywildcard\n--------------------------\n\nfnmatch\n~~~~~~~\n\n.. code:: python\n\n import re\n import fnmatch\n\n urls = ['example/l1/l2/test3-1.py',\n 'example/l1/test2-1.py',\n 'example/l1/test2-2.py',\n 'example/l1/l2/l3/test4-1.py']\n\n regex = fnmatch.translate('example/*')\n # 'example\\\\/.*\\\\Z(?ms)'\n re.findall(regex, \"\\n\".join(urls))\n # return ['example/l1/l2/test3-1.py\\nexample/l1/test2-1.py\\nexample/l1/test2-2.py\\nexample/l1/l2/l3/test4-1.py']\n\npywildcard\n~~~~~~~~~~\n\n.. code:: python\n\n import re\n import pywildcard\n\n urls = ['example/l1/l2/test3-1.py',\n 'example/l1/test2-1.py',\n 'example/l1/test2-2.py',\n 'example/l1/l2/l3/test4-1.py']\n\n regex = pywildcard.translate('example/**')\n # 'example/.*?$(?ms)'\n re.findall(regex, \"\\n\".join(urls))\n # return ['example/l1/l2/test3-1.py',\n # 'example/l1/test2-1.py',\n # 'example/l1/test2-2.py',\n # 'example/l1/l2/l3/test4-1.py']\n\nRunning the unit tests\n----------------------\n\n\\`\\`\\`bash # Check out the git repository. git clone\ngit@github.com:agalera/python-wildcard.git # Enter the directory. cd\npython-wildcard # Install pytest if you have not done already. pip\ninstall pytest # Run the tests pytest\n\n.. |PypiDownloads| image:: https://img.shields.io/pypi/dm/pywildcard.svg\n :target: https://pypi.python.org/pypi/pywildcard\n\n\nCHANGELOG\n=========\n\n1.0.8 (2015-11-26)\n------------------\n\n- update README.md\n\n1.0.7 (2015-11-25)\n------------------\n\n- Add documentation\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "A fork of fnmatch to implement **",
"version": "1.0.10",
"project_urls": {
"Homepage": "https://github.com/agalera/python-wildcard"
},
"split_keywords": [
"wildcard"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c2d476fe6f50a6e18b112338a171ff05e787e47620ed68f8e422bac6317142c0",
"md5": "d3f0d34f2c6985dca6b471dd9de0248a",
"sha256": "825f7dc4eac27fdb2f59052ccccf6e3cbbbc09e3c8b07c5021b2b841cccb6161"
},
"downloads": -1,
"filename": "pywildcard-1.0.10.tar.gz",
"has_sig": false,
"md5_digest": "d3f0d34f2c6985dca6b471dd9de0248a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3631,
"upload_time": "2019-04-01T08:31:58",
"upload_time_iso_8601": "2019-04-01T08:31:58.383125Z",
"url": "https://files.pythonhosted.org/packages/c2/d4/76fe6f50a6e18b112338a171ff05e787e47620ed68f8e422bac6317142c0/pywildcard-1.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-04-01 08:31:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "agalera",
"github_project": "python-wildcard",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pywildcard"
}