summaryrefslogtreecommitdiffstats
path: root/rtemsspec/items.py
diff options
context:
space:
mode:
Diffstat (limited to 'rtemsspec/items.py')
-rw-r--r--rtemsspec/items.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/rtemsspec/items.py b/rtemsspec/items.py
index c0815256..8dbab199 100644
--- a/rtemsspec/items.py
+++ b/rtemsspec/items.py
@@ -430,6 +430,19 @@ class Item:
self._data = self._cache.load_data(self.file, self._uid)
+def create_unique_link(child: Item, parent: Item, data: Any) -> None:
+ """
+ Creates a unique link from the child to the parent item and vice versa
+ using the data for the link.
+ """
+ for item in parent.children(data["role"]):
+ if item.uid == child.uid:
+ break
+ else:
+ parent.add_link_to_child(Link(child, data))
+ child.add_link_to_parent(Link(parent, data))
+
+
class ItemTemplate(string.Template):
""" String template for item mapper identifiers. """
idpattern = "[a-zA-Z0-9._/-]+(:[a-zA-Z0-9._/-]+)?(:[^${}]*)?"