Skip to content

Commit fdf6f5e

Browse files
committed
no need to catch exceptions
1 parent 94f6710 commit fdf6f5e

File tree

1 file changed

+10
-16
lines changed
  • chebai/preprocessing/datasets

1 file changed

+10
-16
lines changed

chebai/preprocessing/datasets/base.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,24 +1149,18 @@ def load_processed_data(
11491149

11501150
# If both kind and filename are given, use filename
11511151
if kind is not None and filename is None:
1152-
try:
1153-
if self.use_inner_cross_validation and kind != "test":
1154-
filename = self.processed_file_names_dict[
1155-
f"fold_{self.fold_index}_{kind}"
1156-
]
1157-
else:
1158-
data_df = self.dynamic_split_dfs[kind]
1159-
return data_df.to_dict(orient="records")
1160-
except KeyError:
1161-
kind = f"{kind}"
1152+
if self.use_inner_cross_validation and kind != "test":
1153+
filename = self.processed_file_names_dict[
1154+
f"fold_{self.fold_index}_{kind}"
1155+
]
1156+
else:
1157+
data_df = self.dynamic_split_dfs[kind]
1158+
return data_df.to_dict(orient="records")
11621159

11631160
# If filename is provided
1164-
try:
1165-
return torch.load(
1166-
os.path.join(self.processed_dir, filename), weights_only=False
1167-
)
1168-
except FileNotFoundError:
1169-
raise FileNotFoundError(f"File {filename} doesn't exist")
1161+
return torch.load(
1162+
os.path.join(self.processed_dir, filename), weights_only=False
1163+
)
11701164

11711165
# ------------------------------ Phase: Raw Properties -----------------------------------
11721166
@property

0 commit comments

Comments
 (0)