Skip to content

Commit

Permalink
bug: workaround for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
younesStrittmatter authored Dec 4, 2023
1 parent cb669f1 commit fe3375e
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/equation_tree/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1248,8 +1248,6 @@ def simplify(
>>> equation_tree.sympy_expr
(-c_1 + x_1)*(c_1 - x_1)
# it is good practice to define tests at the begining of a script and use them
# throughout the project
>>> equation_tree.simplify(
... operator_test=is_operator,
... function_test=is_function
Expand Down Expand Up @@ -1283,18 +1281,18 @@ def operator_test(x):
def operator_test(x):
return tmp_o(x) or x in self.operators

class TimeoutError(Exception):
pass
# class TimeoutError(Exception):
# pass

def timeout_handler(signum, frame):
raise TimeoutError("Function call timed out")
# def timeout_handler(signum, frame):
# raise TimeoutError("Function call timed out")

signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(SIMPLIFY_TIMEOUT)
# signal.signal(signal.SIGALRM, timeout_handler)
# signal.alarm(SIMPLIFY_TIMEOUT)
try:
simplified_equation = simplify(self.sympy_expr)
signal.alarm(0)
except TimeoutError:
# signal.alarm(0)
except:
simplified_equation = self.sympy_expr
if not check_functions(simplified_equation, function_test):
warnings.warn(
Expand Down

0 comments on commit fe3375e

Please sign in to comment.