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

Uploaded Source

Built Distribution

younotyou-0.0.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: younotyou-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 66f6b2d0ebe1044514a5315942569e5c720575dd5e2f70ea28b86402957c28b1
MD5 b2af78963ad540a5b84fddc60e748205
BLAKE2b-256 f47d5eca8e6a56326c3bed54c82b516b3cc365f2c28d005f510319b4c4d061ae

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: younotyou-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 afc79cd20b5e84bc258d01ff3db56ace511c529d4adce3038cc6ff06e3a2faed
MD5 9db3556a81eed7ddd9e51a148b9f79d5
BLAKE2b-256 0fe30fb1d38ca7738b722c26fc44cbcf7bfeef4c60514068362675ac5c662455

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