A module that simplifies working with conditions through filtering. For example: determining whether a text is a link
Project description
What's new in 0.0.4-beta?
- Added keywords
- Added classifiers (Like operating system, language, etc.)
- Added "beta" to version name
DataSifter - Add filters to your code
With the DataSifter module, you can use filters for your conditions in your code.
Without using DataSifter:
import re
text = "Hello Python!"
if bool(re.match(r"^((https?|ftp|file)://)?(www\.)?([-A-Za-z0-9+&@#/%?=~_|!:,.;]*)$", text, re.IGNORECASE)):
print("Text is link")
else:
print("Text isn't link")
👎 Why write long RegExp patterns, if you can:
Using DataSifter:
import DataSifter as ds
text = "pypi.org"
if ds.is_url(text):
print("Text is link")
else:
print("Text isn't link)
All possible filters and what is specified in them:
is_url(
text: str
) -> bool
contains(
text: str,
what_contains: str | dict
) -> bool
regexp_matches(
text: str,
pattern: str,
ignore_case: bool = True
) -> bool
in_range(
value: int,
minimum: int,
maximum: int
) -> bool
length(
value: str | int,
length: int
) -> bool
length_is(
value: str | int,
length: int,
condition: str #(Constant from Module)
) -> bool
Constants
1. EQUALS (==)
2. LOWER (<)
3. GREATER (>)
4. LOWER_OR_EQUALS (<=)
5. GREATER_OR_EQUALS (>=)
6. NOT_EQUALS (!=)
Example of work with constants:
import DataSifter as ds
text = "Hello Python!"
if ds.length_is(text, 5, GREATER_OR_EQUALS):
print("Text greater or equals then 5")
else:
print("Text lower then 5")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
datasifter-0.0.4.1b0.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file datasifter-0.0.4.1b0.tar.gz
.
File metadata
- Download URL: datasifter-0.0.4.1b0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4ad6c39b8f2b8810bc326475b2f41d801854ef50675c2e7832f314998d130c8 |
|
MD5 | f61436d312fd4eee119f396f32c10f31 |
|
BLAKE2b-256 | f865ab5de729255f2b5485868b76604ecc190132802dc8066dcce059dd917731 |
File details
Details for the file datasifter-0.0.4.1b0-py3-none-any.whl
.
File metadata
- Download URL: datasifter-0.0.4.1b0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0ee9fa6dd1803a08afd10ec14ef0b6784cd6023d04c37565760427a742e9b01 |
|
MD5 | b1b7840270d6d3f6494305b7c03021a0 |
|
BLAKE2b-256 | 9cc2020f5f9221052c17353ed9e282a55042328a5c7b40b535d3e577a71f1db5 |