MCPcopy Create free account
hub / github.com/GRAnimated/MinecraftLCE / flatten_nested_map

Function flatten_nested_map

tools/lint.py:363–373  ·  view source on GitHub ↗
(nested_map, prefix="")

Source from the content-addressed store, hash-verified

361 return class_map
362
363def flatten_nested_map(nested_map, prefix=""):
364 flattened = []
365 for key, value in nested_map.items():
366 if key in ("_classes", "_enums"):
367 for name in value:
368 path = prefix.rstrip("/")
369 flattened.append((name, path))
370 elif isinstance(value, dict):
371 new_prefix = f"{prefix}/{key}" if prefix else key
372 flattened.extend(flatten_nested_map(value, new_prefix))
373 return flattened
374
375def load_class_map_yaml(filename):
376 with open(filename, 'r', encoding='utf-8') as f:

Callers 1

compare_class_locationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected