From 3b4d2a44585f6dac8056673e3684091767998368 Mon Sep 17 00:00:00 2001 From: Olivier DEBAUCHE Date: Sat, 29 Jun 2024 22:30:26 +0200 Subject: [PATCH] Fix SIM105 --- packages/syft/src/syft/serde/recursive.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/syft/src/syft/serde/recursive.py b/packages/syft/src/syft/serde/recursive.py index f009ea34299..aa53a615890 100644 --- a/packages/syft/src/syft/serde/recursive.py +++ b/packages/syft/src/syft/serde/recursive.py @@ -1,5 +1,6 @@ # stdlib from collections.abc import Callable +from contextlib import suppress from enum import Enum from enum import EnumMeta import sys @@ -313,10 +314,8 @@ def rs_proto2object(proto: _DynamicStructBuilder) -> Any: for load_user_code in CODE_RELOADER.values(): load_user_code() - try: + with suppress(Exception): # nosec class_type = getattr(sys.modules[".".join(module_parts)], klass) - except Exception: # nosec - pass if proto.fullyQualifiedName not in TYPE_BANK: raise Exception(f"{proto.fullyQualifiedName} not in TYPE_BANK")