Skip to content
Snippets Groups Projects
Commit 5badd0a2 authored by Robert Latta's avatar Robert Latta
Browse files

Changed update_service_hierarchy function to use defaultdict

parent f96e5f81
No related branches found
No related tags found
No related merge requests found
......@@ -36,16 +36,11 @@ def update_interfaces_to_services(services):
def update_service_hierarchy(records):
r = db.get_redis()
children_to_parents = {}
parents_to_children = {}
children_to_parents = defaultdict(list)
parents_to_children = defaultdict(list)
for relation in records:
parent_id = relation["parent_circuit_id"]
child_id = relation["child_circuit_id"]
if child_id not in children_to_parents:
children_to_parents[child_id] = []
if parent_id not in parents_to_children:
parents_to_children[parent_id] = []
parents_to_children[parent_id].append(relation)
children_to_parents[child_id].append(relation)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment