From b5b389b49a0648e2aeb705b00bad397612ed01ca Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 4 Mar 2024 23:39:46 +0100 Subject: Remove children() and __iter__ from Leaf because it messes with typecheck --- mdpoly/abc.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/mdpoly/abc.py b/mdpoly/abc.py index c291fdc..6ec1712 100644 --- a/mdpoly/abc.py +++ b/mdpoly/abc.py @@ -14,18 +14,7 @@ class Leaf(Protocol): name: str shape: Shape - def children(self) -> tuple: - """ Return an empty tuple. This is here to simplify recursive code on - expressions. """ - return tuple() - def __iter__(self): - """ Return an empty iterator. This is here to simplify recursive code - on expressions. """ - yield from iter(self.children()) - - -@runtime_checkable class Expr(Protocol): """ Binary tree to represent a mathematical expression. """ left: Self | Leaf @@ -105,7 +94,6 @@ class Expr(Protocol): yield from self.children() -@runtime_checkable class Rel(Protocol): """ Relation between two expressions. """ lhs: Expr -- cgit v1.2.1