Skip to main content

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.5?

  • Minor code optimization
  • Clearer tooltips with code examples
  • 3 new filters: "file_is(), is_bad_words(), and is_request()"
  • There's a logo

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

file_is(
    file: str,       # Path to file
    format: str     # Format without point, like "png"
) -> bool

is_bad_words(
    text: str,
    language_code: str = "eng"     # Available: "rus", "eng"
)

is_request(
    url: str
)

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


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

Uploaded Source

Built Distribution

datasifter-0.0.5-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file datasifter-0.0.5.tar.gz.

File metadata

  • Download URL: datasifter-0.0.5.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/10

File hashes

Hashes for datasifter-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ab00b216efe971fabec2467617db516795e592aa107aed499f94e9eeafe695d3
MD5 f1ccbfd11f9d487973abc533a87911ec
BLAKE2b-256 7f24abca39d5d282316cd445fe01af8f893d3334bc2d9fe8d2b0cd914c2ecf6f

See more details on using hashes here.

File details

Details for the file datasifter-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: datasifter-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/10

File hashes

Hashes for datasifter-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 34fecc1df3caea0979e5dcbe2559652954cd1f118817acf41e240c46c02f73d1
MD5 79c4fabfe209d433dd9dcba2c2f8bba7
BLAKE2b-256 7ca6f3b485ab053b49a7c62c5534208047d0669abcc6a2507abdb3df18e8d08b

See more details on using hashes here.

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