# 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:
```python
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:
```python
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:
```python
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:
```python
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")
```
Raw data
{
"_id": null,
"home_page": "https://github.com/RREKONI/DataSifter",
"name": "datasifter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "filters, filter, datasift",
"author": "Rekoni",
"author_email": "nilka.gacha@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bb/76/cb2f23952011927803b33a7f43e41f0862c3ed93df52c7240d41c71fc3de/datasifter-0.0.5.1.tar.gz",
"platform": null,
"description": "# What's new in 0.0.5?\n+ Minor code optimization\n+ Clearer tooltips with code examples\n+ 3 new filters: \"file_is(), is_bad_words(), and is_request()\"\n+ There's a logo\n\n# DataSifter - Add filters to your code\n\nWith the DataSifter module, you can use filters for your conditions in your code.\n\n## Without using DataSifter:\n```python\nimport re\n\ntext = \"Hello Python!\"\n\nif bool(re.match(r\"^((https?|ftp|file)://)?(www\\.)?([-A-Za-z0-9+&@#/%?=~_|!:,.;]*)$\", text, re.IGNORECASE)):\n print(\"Text is link\")\nelse:\n print(\"Text isn't link\")\n```\n\n\ud83d\udc4e **Why** write long RegExp patterns, if you can:\n\n## Using DataSifter:\n```python\nimport DataSifter as ds\n\ntext = \"pypi.org\"\n\nif ds.is_url(text):\n print(\"Text is link\")\nelse:\n print(\"Text isn't link)\n```\n\n# All possible filters and what is specified in them:\n```python\nis_url(\n text: str\n) -> bool\n\ncontains(\n text: str,\n what_contains: str | dict\n) -> bool\n\nregexp_matches(\n text: str,\n pattern: str,\n ignore_case: bool = True\n) -> bool\n\nin_range(\n value: int,\n minimum: int,\n maximum: int\n) -> bool\n\nlength(\n value: str | int,\n length: int\n) -> bool\n\nlength_is(\n value: str | int,\n length: int,\n condition: str # Constant from Module\n) -> bool\n\nfile_is(\n file: str, # Path to file\n format: str # Format without point, like \"png\"\n) -> bool\n\nis_bad_words(\n text: str,\n language_code: str = \"eng\" # Available: \"rus\", \"eng\"\n)\n\nis_request(\n url: str\n)\n```\n\n# Constants\n```\n1. EQUALS (==)\n2. LOWER (<)\n3. GREATER (>)\n4. LOWER_OR_EQUALS (<=)\n5. GREATER_OR_EQUALS (>=)\n6. NOT_EQUALS (!=)\n```\n\n# Example of work with constants:\n```python\nimport DataSifter as ds\n\ntext = \"Hello Python!\"\n\nif ds.length_is(text, 5, GREATER_OR_EQUALS):\n print(\"Text greater or equals then 5\")\nelse:\n print(\"Text lower then 5\")\n```\n",
"bugtrack_url": null,
"license": "GPL-3.0-only",
"summary": "A module that simplifies working with conditions through filtering. For example: determining whether a text is a link",
"version": "0.0.5.1",
"project_urls": {
"Homepage": "https://github.com/RREKONI/DataSifter",
"Repository": "https://github.com/RREKONI/DataSifter"
},
"split_keywords": [
"filters",
" filter",
" datasift"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1adbdb49870fe99d6290ccee0a7d61da030cab1c94c1b95994e8b7628430bac8",
"md5": "41e55abd01c295dabc4b2092bb224741",
"sha256": "0a1fff8c5546c5de9d7b8ab59c97b54867d781c6544e0d8f2d37475c150d1a9a"
},
"downloads": -1,
"filename": "datasifter-0.0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "41e55abd01c295dabc4b2092bb224741",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 4538,
"upload_time": "2024-07-10T00:05:05",
"upload_time_iso_8601": "2024-07-10T00:05:05.313336Z",
"url": "https://files.pythonhosted.org/packages/1a/db/db49870fe99d6290ccee0a7d61da030cab1c94c1b95994e8b7628430bac8/datasifter-0.0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bb76cb2f23952011927803b33a7f43e41f0862c3ed93df52c7240d41c71fc3de",
"md5": "9c20674564238dc9bb347cd43af4b5e3",
"sha256": "9a309ddee35f6e3b3e26ced0a359bea22a98a586dea1416b3f5a6d052c628036"
},
"downloads": -1,
"filename": "datasifter-0.0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "9c20674564238dc9bb347cd43af4b5e3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4108,
"upload_time": "2024-07-10T00:05:07",
"upload_time_iso_8601": "2024-07-10T00:05:07.111271Z",
"url": "https://files.pythonhosted.org/packages/bb/76/cb2f23952011927803b33a7f43e41f0862c3ed93df52c7240d41c71fc3de/datasifter-0.0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-10 00:05:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "RREKONI",
"github_project": "DataSifter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "datasifter"
}