More isinstance
This commit is contained in:
parent
bd58442912
commit
be932abcaa
@ -107,7 +107,7 @@ def futile_union_intersection_subtraction(n: parser.Node) -> Tuple[parser.Node,
|
|||||||
|
|
||||||
# selection and intersection of the same thing
|
# selection and intersection of the same thing
|
||||||
elif n.name == INTERSECTION:
|
elif n.name == INTERSECTION:
|
||||||
if n.left.name == SELECTION and n.left.child == n.right:
|
if n.left.name == SELECTION and isinstance(n.left, Unary) and n.left.child == n.right:
|
||||||
return n.left, 1
|
return n.left, 1
|
||||||
elif n.right.name == SELECTION and \
|
elif n.right.name == SELECTION and \
|
||||||
isinstance(n.right, Unary) and \
|
isinstance(n.right, Unary) and \
|
||||||
@ -128,7 +128,7 @@ def futile_union_intersection_subtraction(n: parser.Node) -> Tuple[parser.Node,
|
|||||||
# Subtraction of the same thing or with selection on the left child
|
# Subtraction of the same thing or with selection on the left child
|
||||||
elif n.name == DIFFERENCE and \
|
elif n.name == DIFFERENCE and \
|
||||||
isinstance(n, Binary) and \
|
isinstance(n, Binary) and \
|
||||||
(n.left == n.right or (n.left.name == SELECTION and n.left.child == n.right)):
|
(n.left == n.right or (n.left.name == SELECTION and isinstance(n.left, Unary) and n.left.child == n.right)):
|
||||||
return Unary(
|
return Unary(
|
||||||
SELECTION,
|
SELECTION,
|
||||||
'False',
|
'False',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user