operators
operators
Functions
| Name | Description |
|---|---|
| contains | Check a in b. |
| endswith | Check a endswith b |
| isnone | Check a isnone. |
| not_contains | Check a not in b. |
| not_endswith | Check a not_endswith b. |
| not_isnone | Check a isnone. |
| not_startswith | Check a not startswith b. |
| startswith | Check a startswith b. |
contains
operators.contains(a, b)Check a in b.
from pyrulefilter.operators import contains
print(contains("hello", "hell"))
#> True
print(contains("heel", "hello"))
#> Falseendswith
operators.endswith(a, b)Check a endswith b
from pyrulefilter.operators import endswith
print(endswith("hello", "lo"))
#> True
print(endswith("hello", "elo"))
#> Falseisnone
operators.isnone(a, b=None)Check a isnone.
from pyrulefilter.operators import isnone
print(isnone("hello"))
#> False
print(isnone(None))
#> Truenot_contains
operators.not_contains(a, b)Check a not in b.
from pyrulefilter.operators import not_contains
print(not_contains("hello", "hell"))
#> False
print(not_contains("heel", "hello"))
#> Truenot_endswith
operators.not_endswith(a, b)Check a not_endswith b.
from pyrulefilter.operators import not_endswith
print(not_endswith("hello", "lo"))
#> False
print(not_endswith("hello", "elo"))
#> Truenot_isnone
operators.not_isnone(a, b=None)Check a isnone.
from pyrulefilter.operators import not_isnone
print(not_isnone("hello"))
#> True
print(not_isnone(None))
#> Falsenot_startswith
operators.not_startswith(a, b)Check a not startswith b.
from pyrulefilter.operators import not_startswith
print(not_startswith("hello", "hell"))
#> False
print(not_startswith("heel", "hello"))
#> Truestartswith
operators.startswith(a, b)Check a startswith b.
from pyrulefilter.operators import startswith
print(startswith("hello", "hell"))
#> True
print(startswith("heel", "hello"))
#> False