Skip to main content

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.0.tar.gz (35.8 kB view details)

Uploaded Source

Built Distribution

younotyou-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: younotyou-0.1.0.tar.gz
  • Upload date:
  • Size: 35.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for younotyou-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6c89c0116286be0e79c4414e346cc960c9c4ae03484b28041977c6054652fdef
MD5 3f53941ffdece6c44f321a1d2af61093
BLAKE2b-256 48766a6127c09822eec298c62bb958a1807a032b7bf8ffa076d7146bc659306a

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: younotyou-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for younotyou-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6089c8cee527b215cefbc74230d039cab2630d37508542b70008b1b6710b01dd
MD5 8c8254a4f2171b47494e7b1e7200d103
BLAKE2b-256 4e22381daf4597441786c8584c6cde6431c505c2aa1bfb8e8026a0d6939be265

See more details on using hashes here.

Provenance

Supported by

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