Coverage for src / lexigram / admin / settings / panel / utils.py: 0%
6 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-11 02:25 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-11 02:25 +0800
1"""Shared utility functions for the settings panel."""
3from __future__ import annotations
5from typing import Any
8def map_config_node_type(node: Any) -> str:
9 """Map a ConfigNode class name to a SettingDefinition storage type string.
11 Args:
12 node: Any object whose class name follows the ``*Node`` convention.
14 Returns:
15 Lowercase type string (``"string"``, ``"int"``, ``"bool"``,
16 ``"enum"``, or ``"secret"``).
17 """
18 _type_map: dict[str, str] = {
19 "StringNode": "string",
20 "IntNode": "int",
21 "BooleanNode": "bool",
22 "EnumNode": "enum",
23 "SecretNode": "secret",
24 }
25 return _type_map.get(node.__class__.__name__, "string")
28__all__ = ["map_config_node_type"]