bugdown: Fix ElementPair typing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-05-08 18:08:01 -07:00 committed by Tim Abbott
parent 6aaeab75bc
commit 32f3fd1c77

View File

@ -305,10 +305,13 @@ class ResultWithFamily(Generic[T]):
self.family = family
self.result = result
ElementPair = NamedTuple('ElementPair', [
('parent', Optional[Any]), # Recursive types are not fully supported yet
('value', Element)
])
class ElementPair:
parent: Optional["ElementPair"]
value: Element
def __init__(self, parent: Optional["ElementPair"], value: Element):
self.parent = parent
self.value = value
def walk_tree_with_family(root: Element,
processor: Callable[[Element], Optional[_T]]