Skip to content

Commit

Permalink
Add config key name function
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed Sep 30, 2024
1 parent a0f41eb commit 1cc771d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ai/backend/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,13 @@ def set_if_not_set(table: MutableMapping[str, Any], key_path: Tuple[str, ...], v
table = table[k]
if table.get(key_path[-1]) is None:
table[key_path[-1]] = value


def config_key_to_snake_case(o: Any) -> Any:
match o:
case dict():
return {humps.dekebabize(k): config_key_to_snake_case(v) for k, v in o.items()}
case list():
return [config_key_to_snake_case(i) for i in o]
case _:
return o

0 comments on commit 1cc771d

Please sign in to comment.