Fix up TreeGrid typing information in places.

This commit is contained in:
Mike Auty
2018-03-08 01:20:55 +00:00
parent c605cbd182
commit 674394cd69
2 changed files with 5 additions and 7 deletions
+3 -3
View File
@@ -130,9 +130,9 @@ class TreeGrid(object, metaclass = ABCMeta):
@abstractmethod
def populate(self,
func: VisitorSignature = None,
initial_accumulator: typing.Any = None) \
-> typing.Generator[typing.Tuple[SimpleTypes, ...], None, None]:
"""Generator that returns the next available Node
initial_accumulator: typing.Any = None) -> None:
"""Populates the tree by consuming the TreeGrid's construction generator
Func is called on every node, so can be used to create output on demand
This is equivalent to a one-time visit.
"""
+2 -4
View File
@@ -168,8 +168,7 @@ class TreeGrid(interfaces.renderers.TreeGrid):
def populate(self,
func: interfaces.renderers.VisitorSignature = None,
initial_accumulator: typing.Any = None) \
-> typing.Generator[typing.Tuple[interfaces.renderers.SimpleTypes, ...], None, None]:
initial_accumulator: typing.Any = None) -> None:
"""Populates the tree by consuming the TreeGrid's construction generator
Func is called on every node, so can be used to create output on demand
@@ -190,7 +189,6 @@ class TreeGrid(interfaces.renderers.TreeGrid):
accumulator = func(treenode, accumulator)
self._row_count += 1
self._populated = True
return None
@property
def populated(self):
@@ -263,7 +261,7 @@ class TreeGrid(interfaces.renderers.TreeGrid):
_T = typing.TypeVar("_T")
def visit(self,
node: interfaces.renderers.TreeNode,
node: typing.Optional[interfaces.renderers.TreeNode],
function: typing.Callable[[interfaces.renderers.TreeNode, _T], _T],
initial_accumulator: _T = None,
sort_key: interfaces.renderers.ColumnSortKey = None):