Skip to content

Commit 6b2817e

Browse files
committed
fix format
Signed-off-by: YunLiu <[email protected]>
1 parent d1678b0 commit 6b2817e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

monai/bundle/workflows.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ def __init__(
118118
self.properties = properties[workflow_type]
119119
if "meta" in properties:
120120
self.properties.update(properties["meta"])
121-
except KeyError:
122-
raise ValueError(f"{workflow_type} not found in property file {properties_path}")
123-
except json.JSONDecodeError:
124-
raise ValueError(f"Error decoding JSON from property file {properties_path}")
121+
except KeyError as e:
122+
raise ValueError(f"{workflow_type} not found in property file {properties_path}") from e
123+
except json.JSONDecodeError as e:
124+
raise ValueError(f"Error decoding JSON from property file {properties_path}") from e
125125
else:
126126
if workflow_type == "train":
127127
self.properties = {**TrainProperties, **MetaProperties}
@@ -337,7 +337,6 @@ def _get_property(self, name: str, property: dict) -> Any:
337337
"""
338338
value = None
339339
id = self.properties.get(name, None).get(BundlePropertyConfig.ID, None)
340-
print(self.parser.config.keys(), self.parser.config["_meta_"], "*********")
341340
if name in self._set_props:
342341
value = self._set_props[name]
343342
self._props[name] = value
@@ -348,12 +347,12 @@ def _get_property(self, name: str, property: dict) -> Any:
348347
else:
349348
try:
350349
value = getattr(self, f"get_{name}")()
351-
except AttributeError:
350+
except AttributeError as e:
352351
if property[BundleProperty.REQUIRED]:
353352
raise ValueError(
354353
f"unsupported property '{name}' is required in the bundle properties,"
355354
f"need to implement a method 'get_{name}' to provide the property."
356-
)
355+
) from e
357356
self._props[name] = value
358357
return value
359358

0 commit comments

Comments
 (0)