Classes
CachedBlocksDict
8
▼
Dict wrapper that returns cached HTML for site-scoped blocks.
Used by Kida's block cache optimizat…
CachedBlocksDict
8
▼
Dict wrapper that returns cached HTML for site-scoped blocks.
Used by Kida's block cache optimization to intercept .get() calls from templates and return pre-rendered HTML for site-wide blocks (nav, footer, etc.).
Complexity: O(1) for lookups.
Methods
get
2
Any
▼
Intercept .get() calls to return cached HTML when available.
get
2
Any
▼
def get(self, key: str, default: Any = None) -> Any
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
|
default |
— |
Default:None
|
Returns
Any
setdefault
2
Any
▼
Preserve setdefault() behavior for block registration.
Kida templates use .set…
setdefault
2
Any
▼
def setdefault(self, key: str, default: Any = None) -> Any
Preserve setdefault() behavior for block registration.
Kida templates use .setdefault() to register their own block functions if not already overridden by a child template.
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
|
default |
— |
Default:None
|
Returns
Any
keys
0
set[str]
▼
Support .keys() iteration.
keys
0
set[str]
▼
def keys(self) -> set[str]
Returns
set[str]
copy
0
dict[str, Any]
▼
Support .copy() for embed/include operations.
copy
0
dict[str, Any]
▼
def copy(self) -> dict[str, Any]
Returns
dict[str, Any]
Internal Methods 4 ▼
__init__
4
▼
__init__
4
▼
def __init__(self, original: dict[str, Any] | None, cached: dict[str, str], cached_names: frozenset[str] | set[str], stats: dict[str, int] | None = None)
Parameters
| Name | Type | Description |
|---|---|---|
original |
— |
|
cached |
— |
|
cached_names |
— |
|
stats |
— |
Default:None
|
__getitem__
1
Any
▼
Support dict[key] access.
__getitem__
1
Any
▼
def __getitem__(self, key: str) -> Any
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
Returns
Any
__setitem__
2
▼
Support dict[key] = value assignment.
__setitem__
2
▼
def __setitem__(self, key: str, value: Any) -> None
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
|
value |
— |
__contains__
1
bool
▼
Support 'key in dict' checks.
__contains__
1
bool
▼
def __contains__(self, key: str) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
Returns
bool