suggest: also probe under 'key:' (None value) as empty parent — PyYAML parses 'resources:' as None, not {}
Browse files- suggest.py +6 -0
suggest.py
CHANGED
|
@@ -368,6 +368,12 @@ def _find_empty_mapping_paths(yaml_text: str) -> list[tuple[str, str, int]]:
|
|
| 368 |
walk(v, depth + 1, child_path)
|
| 369 |
elif isinstance(v, list):
|
| 370 |
walk_list(v, depth + 1, child_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 371 |
|
| 372 |
def walk_list(lst: list, depth: int, parent_path: str) -> None:
|
| 373 |
for i, item in enumerate(lst):
|
|
|
|
| 368 |
walk(v, depth + 1, child_path)
|
| 369 |
elif isinstance(v, list):
|
| 370 |
walk_list(v, depth + 1, child_path)
|
| 371 |
+
elif v is None:
|
| 372 |
+
# `key:` with no value (parses as None in PyYAML). Treat as
|
| 373 |
+
# potential empty mapping — probe under it. If the position
|
| 374 |
+
# is truly scalar (e.g. `image:`), the model's predictions
|
| 375 |
+
# will be diffuse/low-confidence and nothing surfaces.
|
| 376 |
+
results.append((child_path, k_str, depth + 1))
|
| 377 |
|
| 378 |
def walk_list(lst: list, depth: int, parent_path: str) -> None:
|
| 379 |
for i, item in enumerate(lst):
|