From 93892df8058e1e7ab45d16745b65f453e6a72942 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 7 Jul 2023 01:34:14 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(validate.py):=20remove=20u?= =?UTF-8?q?nnecessary=20contextlib.suppress=20block=20The=20contextlib.sup?= =?UTF-8?q?press=20block=20was=20suppressing=20import=20errors,=20but=20it?= =?UTF-8?q?=20is=20no=20longer=20needed=20as=20the=20import=20errors=20are?= =?UTF-8?q?=20handled=20elsewhere=20in=20the=20code.=20Removing=20this=20b?= =?UTF-8?q?lock=20improves=20code=20readability=20and=20removes=20unnecess?= =?UTF-8?q?ary=20complexity.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/utils/validate.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/utils/validate.py b/src/backend/langflow/utils/validate.py index 819a01c28..f8a9c1d1d 100644 --- a/src/backend/langflow/utils/validate.py +++ b/src/backend/langflow/utils/validate.py @@ -204,8 +204,9 @@ def create_class(code, class_name): code_obj = compile( ast.Module(body=[class_code], type_ignores=[]), "", "exec" ) - with contextlib.suppress(Exception): - exec(code_obj, exec_globals, locals()) + # This suppresses import errors + # with contextlib.suppress(Exception): + exec(code_obj, exec_globals, locals()) exec_globals[class_name] = locals()[class_name] # Return a function that imports necessary modules and creates an instance of the target class