|
|
@ -22,7 +22,7 @@ indirections to iterating over all annotation of a particular vertex/edge. We
|
|
|
|
believe that the latter is less common operation, so this seems like a good
|
|
|
|
believe that the latter is less common operation, so this seems like a good
|
|
|
|
approach."""
|
|
|
|
approach."""
|
|
|
|
|
|
|
|
|
|
|
|
from .topo_v3 import TopologyV3, VertexID, Edge
|
|
|
|
from ..topo_v3 import TopologyV3, VertexID, Edge
|
|
|
|
from collections import defaultdict
|
|
|
|
from collections import defaultdict
|
|
|
|
from collections.abc import Hashable
|
|
|
|
from collections.abc import Hashable
|
|
|
|
from dataclasses import dataclass
|
|
|
|
from dataclasses import dataclass
|
|
|
@ -40,7 +40,7 @@ class AnnotatedTopology:
|
|
|
|
self.edge_annotators: dict[Edge, set['AnnotatorID']] = defaultdict(lambda: set())
|
|
|
|
self.edge_annotators: dict[Edge, set['AnnotatorID']] = defaultdict(lambda: set())
|
|
|
|
self.global_annotators: set['AnnotatorID'] = set()
|
|
|
|
self.global_annotators: set['AnnotatorID'] = set()
|
|
|
|
|
|
|
|
|
|
|
|
def run_annotator(self, ann_id) -> Annotator | None:
|
|
|
|
def run_annotator(self, ann_id) -> 'Annotator | None': # I hate python.
|
|
|
|
"""This creates and runs an :class:Annotator
|
|
|
|
"""This creates and runs an :class:Annotator
|
|
|
|
|
|
|
|
|
|
|
|
Note that we do only support running an Annotator based on its ID,
|
|
|
|
Note that we do only support running an Annotator based on its ID,
|
|
|
@ -88,7 +88,7 @@ class Annotation:
|
|
|
|
# Use of Any here means "something reasonable and stringifiable". We do not
|
|
|
|
# Use of Any here means "something reasonable and stringifiable". We do not
|
|
|
|
# know whether this can be specified reasonably.
|
|
|
|
# know whether this can be specified reasonably.
|
|
|
|
for_vertex: dict[VertexID, Any]
|
|
|
|
for_vertex: dict[VertexID, Any]
|
|
|
|
for_edge: dict[VertexID, Any]
|
|
|
|
for_edge: dict[Edge, Any]
|
|
|
|
for_topology: Any | None
|
|
|
|
for_topology: Any | None
|
|
|
|
|
|
|
|
|
|
|
|
class Annotator(ABC):
|
|
|
|
class Annotator(ABC):
|
|
|
|