From 7c908b0be227f441bb4d60832882829316e769a2 Mon Sep 17 00:00:00 2001 From: Keelan Date: Wed, 28 Sep 2022 17:04:40 +0200 Subject: [PATCH] :sparkles: (Backend) tools.py updates --- server/services/tools.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/services/tools.py b/server/services/tools.py index b6b5d45c..31c9297b 100644 --- a/server/services/tools.py +++ b/server/services/tools.py @@ -1,4 +1,5 @@ import json +from latex2sympy2 import latex2sympy from datetime import datetime #this function converts a json file to a txt file (replacing duplicate backslashes with single ones) @@ -35,4 +36,14 @@ def get_date_time_type(dt: datetime): "timezone": "" } # print(payload) - return payload \ No newline at end of file + return payload + +def detectCorruptLatex(latexIn): + try: + latex2sympy(latexIn) + #print("passed latex test! "+ latexIn) + return True + except: + print("corrupt latex detected:" + latexIn) + return False + return False \ No newline at end of file