Functions
_apply_test
3
bool
▼
Apply a test to a value.
_apply_test
3
bool
▼
def _apply_test(value: Any, test_name: str, *args: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
|
test_name |
str |
|
*args |
Any |
Returns
bool
_test_callable
1
bool
▼
Test if value is callable.
_test_callable
1
bool
▼
def _test_callable(value: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
bool
_test_defined
1
bool
▼
Test if value is defined (not None and not the Undefined sentinel).
_test_defined
1
bool
▼
def _test_defined(value: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
bool
_test_divisible_by
2
bool
▼
Test if value is divisible by num.
_test_divisible_by
2
bool
▼
def _test_divisible_by(value: int, num: int) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
int |
|
num |
int |
Returns
bool
_test_eq
2
bool
▼
Test equality.
_test_eq
2
bool
▼
def _test_eq(value: Any, other: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
|
other |
Any |
Returns
bool
_test_even
1
bool
▼
Test if value is even.
_test_even
1
bool
▼
def _test_even(value: int) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
int |
Returns
bool
_test_ge
2
bool
▼
Test greater than or equal.
_test_ge
2
bool
▼
def _test_ge(value: Any, other: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
|
other |
Any |
Returns
bool
_test_gt
2
bool
▼
Test greater than.
_test_gt
2
bool
▼
def _test_gt(value: Any, other: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
|
other |
Any |
Returns
bool
_test_in
2
bool
▼
Test if value is in sequence.
_test_in
2
bool
▼
def _test_in(value: Any, seq: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
|
seq |
Any |
Returns
bool
_test_iterable
1
bool
▼
Test if value is iterable.
_test_iterable
1
bool
▼
def _test_iterable(value: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
bool
_test_le
2
bool
▼
Test less than or equal.
_test_le
2
bool
▼
def _test_le(value: Any, other: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
|
other |
Any |
Returns
bool
_test_lower
1
bool
▼
Test if string is lowercase.
_test_lower
1
bool
▼
def _test_lower(value: str) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
str |
Returns
bool
_test_lt
2
bool
▼
Test less than.
_test_lt
2
bool
▼
def _test_lt(value: Any, other: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
|
other |
Any |
Returns
bool
_test_mapping
1
bool
▼
Test if value is a mapping.
_test_mapping
1
bool
▼
def _test_mapping(value: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
bool
_test_ne
2
bool
▼
Test inequality.
_test_ne
2
bool
▼
def _test_ne(value: Any, other: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
|
other |
Any |
Returns
bool
_test_none
1
bool
▼
Test if value is None.
_test_none
1
bool
▼
def _test_none(value: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
bool
_test_number
1
bool
▼
Test if value is a number.
_test_number
1
bool
▼
def _test_number(value: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
bool
_test_odd
1
bool
▼
Test if value is odd.
_test_odd
1
bool
▼
def _test_odd(value: int) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
int |
Returns
bool
_test_sequence
1
bool
▼
Test if value is a sequence.
_test_sequence
1
bool
▼
def _test_sequence(value: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
bool
_test_string
1
bool
▼
Test if value is a string.
_test_string
1
bool
▼
def _test_string(value: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
bool
_test_upper
1
bool
▼
Test if string is uppercase.
_test_upper
1
bool
▼
def _test_upper(value: str) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
str |
Returns
bool
_test_match
2
bool
▼
Test if string matches regex pattern.
Used by rejectattr/selectattr for filter…
_test_match
2
bool
▼
def _test_match(value: Any, pattern: str) -> bool
Test if string matches regex pattern.
Used by rejectattr/selectattr for filtering by regex pattern.
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
|
pattern |
str |
Returns
bool
_test_hx_request
1
bool
▼
Test if value indicates an HTMX request.
Works with request objects that have …
_test_hx_request
1
bool
▼
def _test_hx_request(value: Any) -> bool
Test if value indicates an HTMX request.
Works with request objects that have a headers dict/attribute, or with boolean values directly.
Usage: {% if request is hx_request %} {# Render fragment for HTMX #} {% else %} {# Render full page #} {% end %}
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Request object with headers, or boolean value |
Returns
bool
_test_hx_target
2
bool
▼
Test if HTMX target matches expected element ID.
**Usage:**
{% if request is h…
_test_hx_target
2
bool
▼
def _test_hx_target(value: Any, target: str) -> bool
Test if HTMX target matches expected element ID.
Usage: {% if request is hx_target("user-list") %} {# Rendering into user-list element #} {% end %}
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Request object with headers, or string target value |
target |
str |
Expected target element ID |
Returns
bool
_test_hx_boosted
1
bool
▼
Test if request is HTMX-boosted.
Boosted requests are regular links/forms enha…
_test_hx_boosted
1
bool
▼
def _test_hx_boosted(value: Any) -> bool
Test if request is HTMX-boosted.
Boosted requests are regular links/forms enhanced by hx-boost="true".
Usage: {% if request is hx_boosted %} {# Progressive enhancement - AJAX navigation #} {% end %}
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Request object with headers, or boolean value |
Returns
bool