Filter a list of strings and/or paths based on include and exclude patterns.
Project description
younotyou
Filter a list of strings and/or paths based on include and exclude patterns.
Installation
Install with:
pip install younotyou
Convenient one stop shop to include and exclude strings using glob style pattern matching.
Usage
Patterns can be literals or glob style wildcard strings.
Exclusion patterns override include patterns,
i.e. if an item matches an include pattern but also matches an exclude pattern, it will be excluded.
>>> from younotyou import younotyou >>> strings = ["thispattern", "aPaTtErN", "mypatterns"] >>> younotyou(strings, ["*pattern"]) ['thispattern'] >>> younotyou(strings, ["*pattern*"]) ['thispattern', 'mypatterns'] >>> younotyou(strings, ["*pattern*"], case_sensitive=False) ['thispattern', 'aPaTtErN', 'mypatterns'] >>> younotyou(strings, ["*pattern*"], ["my*", "*is*"], case_sensitive=False) ['aPaTtErN'] >>> younotyou(strings, exclude_patterns=["*PaT*"]) ['thispattern', 'mypatterns'] >>> younotyou(strings, exclude_patterns=["*PaT*"], case_sensitive=False) [] >>> younotyou(strings, include_patterns=["*PaT*"], exclude_patterns=["*PaT*"], case_sensitive=False) []
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
younotyou-0.1.1.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file younotyou-0.1.1.tar.gz
.
File metadata
- Download URL: younotyou-0.1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca5af471172a566866a31463882d8930b8d9a355a4d8302d8f76a6f0d2fd4a5b |
|
MD5 | 1cc020bf6b731cfbcf4e5e9b9a61e266 |
|
BLAKE2b-256 | a51cb9ede2fb1941a51a9031f440da17469607eaba717158520a90ec829c3fa1 |
Provenance
File details
Details for the file younotyou-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: younotyou-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f22e0d0b436a008c158e1a60bffef0c1d35bee8f2e2c35350e281e41b46076c |
|
MD5 | d89ec1181a709bc3d148428e1b4da89d |
|
BLAKE2b-256 | 77cbec94e81bf1013bd07a232e6913ea2d4c8e1e351d9fe7e144a969a4d91a4e |