From a9b23e0611ae3f54c20014b5a030c4674732dd76 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Mon, 28 Oct 2024 14:33:06 +0200 Subject: [PATCH] code fixing for pre-commit --- NiChart_DLMUSE/__main__.py | 1 - NiChart_DLMUSE/utils.py | 14 ++++++++------ setup.py | 5 ++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index 8058f19..b012cc0 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -133,7 +133,6 @@ def main() -> None: print(args) print() - if len(os.listdir(out_dir)) != 0: print(f"Emptying output folder: {out_dir}...") os.system(f"rm -r {out_dir}/*") diff --git a/NiChart_DLMUSE/utils.py b/NiChart_DLMUSE/utils.py index 04d7072..f23825c 100644 --- a/NiChart_DLMUSE/utils.py +++ b/NiChart_DLMUSE/utils.py @@ -150,12 +150,14 @@ def dir_size(in_dir: str) -> int: def split_data(in_dir: str, N: int) -> list: """ - Splits the input data directory into subfolders of size. - N should be > 0 and the number of files in each subfolder should be > 0 as well. + Splits the input data directory into subfolders of size. + N should be > 0 and the number of files in each subfolder should be > 0 as well. """ assert N > 0 data_size = dir_size(in_dir) - no_files_in_folders = data_size // N if (data_size % N == 0) else (data_size // N) + 1 + no_files_in_folders = ( + data_size // N if (data_size % N == 0) else (data_size // N) + 1 + ) assert no_files_in_folders > 0 subfolders = [] @@ -179,15 +181,15 @@ def split_data(in_dir: str, N: int) -> list: def remove_subfolders(in_dir: str) -> None: """ - Removes all the split_* subolders from the input folder + Removes all the split_* subolders from the input folder """ os.system(f"rm -r {in_dir}/split_*") def merge_output_data(in_dir: str) -> None: """ - Takes all the results from the temp_working_fir and moves them into - the results/ subfolder in the output folder + Takes all the results from the temp_working_fir and moves them into + the results/ subfolder in the output folder """ os.system(f"mkdir {in_dir}/results") diff --git a/setup.py b/setup.py index d020ad4..d8c56a1 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,11 @@ from pathlib import Path -import setuptools from setuptools import find_packages, setup this_directory = Path(__file__).parent long_description = (this_directory / "README.md").read_text() -with open('requirements.txt') as f: +with open("requirements.txt") as f: required = f.read().splitlines() @@ -42,6 +41,6 @@ "nnunet", ], package_data={ - 'NiChart_DLMUSE': ['**/*.csv', '**/*.json'], + "NiChart_DLMUSE": ["**/*.csv", "**/*.json"], }, )