Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _add_color(tree, ancestor_is_built_in):
for item in tree:
module_name = item["name"].split(".")[0]
is_built_in = (
ancestor_is_built_in
or module_name in built_in
or module_name in built_in_deprecated
)
color = 1 if is_built_in else 0
if module_name in built_in_deprecated:
color = 2
item["color"] = color
if "children" in item:
_add_color(item["children"], is_built_in)