Skip to content

Commit

Permalink
Lies to appease the type checker :/
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh committed Feb 25, 2024
1 parent e53a0ae commit d86f1b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lark/visitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ def _transform_tree(self, tree):
children = list(self._transform_children(tree.children))
return self._call_userfunc(tree, children)

def transform(self, tree: Union[Tree[_Leaf_T], _Leaf_T]) -> Optional[_Return_T]:
def transform(self, tree: Tree[_Leaf_T]) -> _Return_T:
"Transform the given tree, and return the final result"
res = list(self._transform_children([tree]))
if not res:
return
raise RuntimeError("Cannot discard the root node")
assert len(res) == 1
return res[0]

Expand Down

0 comments on commit d86f1b3

Please sign in to comment.