Skip to content

Commit

Permalink
remove self._set_prop
Browse files Browse the repository at this point in the history
Signed-off-by: YunLiu <[email protected]>
  • Loading branch information
KumoLiu committed Feb 28, 2024
1 parent 5d561cb commit 3be3f85
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions bundle/python_bundle_workflow/scripts/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def __init__(self, dataset_dir: str = "."):
nib.save(n, os.path.join(dataset_dir, f"seg{i:d}.nii.gz"))

self._props = {}
self._set_props = {}
self.dataset_dir = dataset_dir

def initialize(self):
Expand All @@ -76,7 +75,7 @@ def finalize(self):
pass

def _set_property(self, name, property, value):
self._set_props[name] = value
self._props[name] = value

def _get_property(self, name, property):
"""
Expand All @@ -90,9 +89,6 @@ def _get_property(self, name, property):
value = None
if name in self._props:
value = self._props[name]
elif name in self._set_props:
value = self._set_props[name]
self._props[name] = value
else:
try:
value = getattr(self, f"get_{name}")()
Expand Down
6 changes: 1 addition & 5 deletions bundle/python_bundle_workflow/scripts/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def __init__(self, dataset_dir: str = "."):

# define buckets to store the generated properties and set properties
self._props = {}
self._set_props = {}
self.dataset_dir = dataset_dir

# besides the predefined properties, this bundle workflow can also provide `network`, `loss`, `optimizer`
Expand All @@ -91,7 +90,7 @@ def finalize(self):
set_determinism(None)

def _set_property(self, name, property, value):
self._set_props[name] = value
self._props[name] = value

def _get_property(self, name, property):
"""
Expand All @@ -105,9 +104,6 @@ def _get_property(self, name, property):
value = None
if name in self._props:
value = self._props[name]
elif name in self._set_props:
value = self._set_props[name]
self._props[name] = value
else:
try:
value = getattr(self, f"get_{name}")()
Expand Down

0 comments on commit 3be3f85

Please sign in to comment.