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

Uploaded Source

Built Distribution

younotyou-0.0.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for younotyou-0.0.0.tar.gz
Algorithm Hash digest
SHA256 2e83bd9fef7b63e5b3441c427c19c08b56add609d2e756b1d87774dc3c48d678
MD5 79a9b5a17d2628696bd14d56cae26ae1
BLAKE2b-256 f8b0bebf6297412549c606d85240d23cb699753068515036fac5751df7d8ce3c

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: younotyou-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09b5106fac0e2f4d0e8fcff085997ac430edf8d2381bfe17bfcff548909653dc
MD5 a6a27fd98141de976518bd92a29d3632
BLAKE2b-256 11c9f1f0dd255168be59157f24744be1dece9d8c5ad0d020662dc004a1244af7

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