Skip to content
Snippets Groups Projects
Commit 033f3050 authored by Maxim Gonchar's avatar Maxim Gonchar
Browse files

feat: Node, add labels iterator

parent 9a59e93e
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ from .logger import Logger, get_logger ...@@ -15,7 +15,7 @@ from .logger import Logger, get_logger
from .output import Output from .output import Output
from .iter import IsIterable from .iter import IsIterable
from .types import GraphT from .types import GraphT
from typing import Optional, List, Dict, Union, Callable, Any, Tuple from typing import Optional, List, Dict, Union, Callable, Any, Tuple, Generator
class Node(Legs): class Node(Legs):
_name: str _name: str
...@@ -214,6 +214,10 @@ class Node(Legs): ...@@ -214,6 +214,10 @@ class Node(Legs):
self._graph = graph self._graph = graph
self._graph.register_node(self) self._graph.register_node(self)
@property
def labels(self) -> Generator[Tuple[str,str], None, None]:
yield from self._label.items()
# #
# Methods # Methods
# #
...@@ -228,7 +232,7 @@ class Node(Legs): ...@@ -228,7 +232,7 @@ class Node(Legs):
raise ReconnectionError(input=inp, node=self, output=output) raise ReconnectionError(input=inp, node=self, output=output)
return inp return inp
def label(self, source): def label(self, source='text'):
# if self._label: # if self._label:
# kwargs.setdefault("name", self._name) # kwargs.setdefault("name", self._name)
# return self._label.format(*args, **kwargs) # return self._label.format(*args, **kwargs)
......
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