Skip to content

Commit 9e9ad61

Browse files
committed
Changed made after checking coding style.
1 parent d24166f commit 9e9ad61

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

monai/deploy/operators/publisher_operator.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
# See the License for the specific language governing permissions and
1010
# limitations under the License.
1111

12-
from os import path, makedirs
12+
import shutil
13+
from os import makedirs, path
1314
from pathlib import Path
1415
from shutil import copy
15-
import shutil
16+
1617
import monai.deploy.core as md
1718
from monai.deploy.core import DataPath, ExecutionContext, Image, InputContext, IOType, Operator, OutputContext
1819

@@ -34,10 +35,7 @@ def compute(self, op_input: InputContext, op_output: OutputContext, context: Exe
3435
raise ValueError("Expected a folder path for saved_image_folder input")
3536

3637
density_path, mask_path = self._find_density_and_mask_files(saved_images_folder)
37-
subs = {
38-
"DENSITY_FILE": path.basename(density_path),
39-
"MASK_FILE": path.basename(mask_path)
40-
}
38+
subs = {"DENSITY_FILE": path.basename(density_path), "MASK_FILE": path.basename(mask_path)}
4139

4240
app_output_folder = op_output.get().path
4341
publish_folder_name = "publish"
@@ -54,15 +52,17 @@ def compute(self, op_input: InputContext, op_output: OutputContext, context: Exe
5452
config_render_file.write(CONFIG_RENDER_TXT)
5553

5654
# Replace the file name in the CONFIG_META_TXT and save as config.meta
57-
config_meta_txt = CONFIG_META_TXT.replace("DENSITY_FILE", subs["DENSITY_FILE"]).replace("MASK_FILE", subs["MASK_FILE"])
55+
config_meta_txt = CONFIG_META_TXT.replace("DENSITY_FILE", subs["DENSITY_FILE"]).replace(
56+
"MASK_FILE", subs["MASK_FILE"]
57+
)
5858
with open(path.join(publish_folder_path, "config.meta"), "w") as config_meta_file:
5959
config_meta_file.write(config_meta_txt)
6060

6161
def _find_density_and_mask_files(self, folder_path):
6262
density_path = None
6363
mask_path = None
6464

65-
for matched_file in Path(folder_path).rglob('*'):
65+
for matched_file in Path(folder_path).rglob("*"):
6666
# Need to get the file name in str
6767
f_name = str(matched_file)
6868
if path.isfile(f_name):
@@ -77,6 +77,7 @@ def _find_density_and_mask_files(self, folder_path):
7777

7878
raise ValueError("Cannot find both density and mask nii.gz files.")
7979

80+
8081
CONFIG_META_TXT = """
8182
{
8283
"data": [
@@ -937,4 +938,4 @@ def _find_density_and_mask_files(self, folder_path):
937938
"mode": "CINEMATIC"
938939
}
939940
}
940-
"""
941+
"""

0 commit comments

Comments
 (0)