fix: resolve CI/CD test failures and linting issues
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
"""Utilities for flattening and unflattening nested dictionaries."""
|
"""Utilities for flattening and unflattening nested dictionaries."""
|
||||||
|
|
||||||
import re
|
from typing import Any, Dict, List
|
||||||
from collections.abc import MutableMapping
|
|
||||||
from typing import Any, Dict, List, Tuple
|
|
||||||
|
|
||||||
|
|
||||||
def flatten_dict(data: Dict[str, Any], parent_key: str = "", sep: str = ".") -> Dict[str, Any]:
|
def flatten_dict(data: Dict[str, Any], parent_key: str = "", sep: str = ".") -> Dict[str, Any]:
|
||||||
@@ -104,7 +102,6 @@ def _split_key(key: str, sep: str) -> List[str]:
|
|||||||
def _set_nested(d: Any, parts: List[str], value: Any) -> None:
|
def _set_nested(d: Any, parts: List[str], value: Any) -> None:
|
||||||
"""Set a value in a nested structure, creating intermediate dicts or lists as needed."""
|
"""Set a value in a nested structure, creating intermediate dicts or lists as needed."""
|
||||||
current = d
|
current = d
|
||||||
path = [] # Track the path to enable modification at the right level
|
|
||||||
|
|
||||||
for i, part in enumerate(parts[:-1]):
|
for i, part in enumerate(parts[:-1]):
|
||||||
if isinstance(current, list):
|
if isinstance(current, list):
|
||||||
@@ -137,7 +134,7 @@ def _set_nested(d: Any, parts: List[str], value: Any) -> None:
|
|||||||
current[part] = {}
|
current[part] = {}
|
||||||
current = current[part]
|
current = current[part]
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Cannot traverse through non-dict/list object")
|
raise ValueError("Cannot traverse through non-dict/list object")
|
||||||
|
|
||||||
last_part = parts[-1]
|
last_part = parts[-1]
|
||||||
if isinstance(current, list):
|
if isinstance(current, list):
|
||||||
|
|||||||
Reference in New Issue
Block a user