Metadata-Version: 2.1
Name: younotyou
Version: 0.1.1
Summary: Filter a list of strings and/or paths based on include and exclude patterns.
Project-URL: Homepage, https://github.com/matt-manes/younotyou
Project-URL: Documentation, https://github.com/matt-manes/younotyou/tree/main/docs
Project-URL: Source code, https://github.com/matt-manes/younotyou/tree/main/src/younotyou
Author-email: Matt Manes <mattmanes@pm.me>
License-File: LICENSE.txt
Keywords: filter,filtering,fnmatch,match,path,patternmatching,string
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# younotyou

Filter a list of strings and/or paths based on include and exclude patterns.

## Installation

Install with:

<pre>
pip install younotyou
</pre>

Convenient one stop shop to include and exclude strings using glob style pattern matching.<br>


## Usage

Patterns can be literals or glob style wildcard strings.<br>
Exclusion patterns override include patterns,
i.e. if an item matches an include pattern but also matches an exclude pattern, it will be excluded.

<pre>
>>> 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)
[]
</pre>
