Files
nanobot/nanobot/utils/dict_keys.py
T
chengyongru a4d2430140 refactor: remove redundant comments and docstrings (#6527)
* refactor: remove redundant comments and docstrings

* fix(signal): annotate async context manager as a generator
2026-10-30 13:07:03 +08:00

16 lines
346 B
Python

from __future__ import annotations
from typing import Any
def get_camel_snake(
data: dict[str, Any],
camel: str,
snake: str,
default: Any = None,
) -> Any:
"""Prefer camelCase store keys, fall back to snake_case (asdict / hand-edits)."""
if camel in data:
return data[camel]
return data.get(snake, default)