in src/latex2sympy2_extended/latex2sympy2.py [0:0]
def convert_interval(self, expr):
left_open = expr.L_PAREN() is not None or expr.L_GROUP() is not None or expr.L_PAREN_VISUAL() is not None
right_open = expr.R_PAREN() is not None or expr.R_GROUP() is not None or expr.R_PAREN_VISUAL() is not None
left = self.convert_expr(expr.expr()[0])
right = self.convert_expr(expr.expr()[1])
# It doesn't make sense to have interval which represents an empty set, in this case we treat it as a finite set
try:
if (left_open and right_open and right <= left) or (not left_open and not right_open and right < left):
return sympy.Tuple(left, right)
except Exception:
pass
return sympy.Interval(left, right, left_open=left_open, right_open=right_open)