Functions
_strip_none
1
tuple[Any, bool]
▼
For ``X | None``, return ``(X, True)``. Else ``(tp, False)``.
_strip_none
1
tuple[Any, bool]
▼
def _strip_none(tp: Any) -> tuple[Any, bool]
Parameters
| Name | Type | Description |
|---|---|---|
tp |
Any |
Returns
tuple[Any, bool]
_map_type
1
dict[str, Any] | None
▼
Return a JSON Schema fragment for *tp*, or None to drop the field.
_map_type
1
dict[str, Any] | None
▼
def _map_type(tp: Any) -> dict[str, Any] | None
Parameters
| Name | Type | Description |
|---|---|---|
tp |
Any |
Returns
dict[str, Any] | None
_collect_enum_fields
1
dict[str, frozenset[str]]
▼
Harvest enum constraints from ``_VALID_S`` dataclass fields.
``_VALID_LOG_LEVE…
_collect_enum_fields
1
dict[str, frozenset[str]]
▼
def _collect_enum_fields(cls: type) -> dict[str, frozenset[str]]
Harvest enum constraints from_VALID_<NAME>Sdataclass fields.
_VALID_LOG_LEVELS → log_level.
Parameters
| Name | Type | Description |
|---|---|---|
cls |
type |
Returns
dict[str, frozenset[str]]
build_schema
1
dict[str, Any]
▼
Build a JSON Schema Draft 2020-12 document for a dataclass.
The schema is dete…
build_schema
1
dict[str, Any]
▼
def build_schema(cls: type = ServerConfig) -> dict[str, Any]
Build a JSON Schema Draft 2020-12 document for a dataclass.
The schema is deterministic: properties are sorted alphabetically so golden-snapshot tests stay stable across runs.
Parameters
| Name | Type | Description |
|---|---|---|
cls |
type |
Default:ServerConfig
|
Returns
dict[str, Any]
_toml_value
1
str
▼
Render a Python default as a TOML literal.
_toml_value
1
str
▼
def _toml_value(v: Any) -> str
Parameters
| Name | Type | Description |
|---|---|---|
v |
Any |
Returns
str
build_toml_template
1
str
▼
Emit a commented TOML template for *cls*, one field per line.
``pounce.toml`` …
build_toml_template
1
str
▼
def build_toml_template(cls: type = ServerConfig) -> str
Emit a commented TOML template for cls, one field per line.
pounce.tomlputs config keys at the top level (no section header) —
the loader in_config_file.pytreats the whole file as config.
Users who want[tool.pounce]for pyproject.toml can copy the same
commented lines under that heading.
Parameters
| Name | Type | Description |
|---|---|---|
cls |
type |
Default:ServerConfig
|
Returns
str
_is_set
1
bool
▼
Interpret ``REDACT_TO_BOOL`` — True when the field has a meaningful value.
_is_set
1
bool
▼
def _is_set(value: Any) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
bool
redacted_config_view
1
dict[str, Any]
▼
Return a redacted dict view of *cfg* suitable for ``/info`` or ``config show``.…
redacted_config_view
1
dict[str, Any]
▼
def redacted_config_view(cfg: ServerConfig) -> dict[str, Any]
Return a redacted dict view of cfg suitable for/info or config show.
EXPOSE fields keep their values; REDACT_TO_BOOL fields become
<field>_set: bool; every other field is omitted entirely.
Parameters
| Name | Type | Description |
|---|---|---|
cfg |
ServerConfig |
Returns
dict[str, Any]
_coerce_for_json
1
Any
▼
Coerce a ServerConfig value into JSON-serializable form.
_coerce_for_json
1
Any
▼
def _coerce_for_json(value: Any) -> Any
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Returns
Any
assert_allowlist_covers_config
0
list[str]
▼
Return a list of ServerConfig fields missing from INFO_ALLOWLIST.
Used by ``te…
assert_allowlist_covers_config
0
list[str]
▼
def assert_allowlist_covers_config() -> list[str]
Return a list of ServerConfig fields missing from INFO_ALLOWLIST.
Used bytests/unit/test_config_schema.pyto guarantee that adding a
new field to ServerConfig without updating the allowlist fails CI.
Returns
list[str]