🔧 chore(validate.py): remove unnecessary contextlib.suppress block

The contextlib.suppress block was suppressing import errors, but it is no longer needed as the import errors are handled elsewhere in the code. Removing this block improves code readability and removes unnecessary complexity.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-07 01:34:14 -03:00
commit 93892df805

View file

@ -204,8 +204,9 @@ def create_class(code, class_name):
code_obj = compile(
ast.Module(body=[class_code], type_ignores=[]), "<string>", "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