From f2f6784363b8ad591308c9098905f9f5023caa16 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Wed, 19 Jul 2023 01:30:48 +0200 Subject: [PATCH] Annotations: Warn if the annotation does not annotate current topology --- birdvisu/annotations/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/birdvisu/annotations/__init__.py b/birdvisu/annotations/__init__.py index 667572c..ad07088 100644 --- a/birdvisu/annotations/__init__.py +++ b/birdvisu/annotations/__init__.py @@ -77,8 +77,14 @@ class AnnotatedTopology: raise ValueError('Annotator fakes its ID!') annotation.annotator_id = ann_id for v in annotation.for_vertex: + if v not in self.topology.vertices: + print(f'WARNING: vertex not in the topology, skipping. {ann_id=}, {v=}') + continue self.vertex_annotators[v].add(ann_id) for e in annotation.for_edge: + if e not in self.topology.edges: + print(f'WARNING: edge not in the topology, skipping. {ann_id=} {e}') + continue self.edge_annotators[e].add(ann_id) if annotation.for_topology is not None: self.global_annotators.add(ann_id)