Functions
_bare_truthy_pattern
1
re.Pattern[str]
▼
Build a regex that matches ``{% if KEY %}`` / ``{% if not KEY %}``.
Matches ki…
_bare_truthy_pattern
1
re.Pattern[str]
▼
def _bare_truthy_pattern(key: str) -> re.Pattern[str]
Build a regex that matches{% if KEY %} / {% if not KEY %}.
Matches kidaif and elifstart tags with optional whitespace
trimming ({%-, -%}) and an optional not. Crucially, the
pattern requires the tag to end immediately after the identifier
(\s*-?%}) — that's what excludes {% if KEY is none %},
{% if KEY == X %}, {% if KEY and Y %}, etc.
Parameters
| Name | Type | Description |
|---|---|---|
key |
str |
Returns
re.Pattern[str]
check_defer_falsy_conditionals
1
list[ContractIssue]
▼
Flag bare ``{% if KEY %}`` conditionals on Suspense-deferred keys.
Only fires …
check_defer_falsy_conditionals
1
list[ContractIssue]
▼
def check_defer_falsy_conditionals(template_sources: dict[str, str]) -> list[ContractIssue]
Flag bare{% if KEY %}conditionals on Suspense-deferred keys.
Only fires whenKEYis explicitly declared as a defer key in the
same template (via__chirp_defer_pending__membership or the
is deferred test). One WARNINGper (template, key) pair.
Parameters
| Name | Type | Description |
|---|---|---|
template_sources |
dict[str, str] |
Returns
list[ContractIssue]