From e9083b88087b937b3bbc4692ffc8fc47d7aa7f52 Mon Sep 17 00:00:00 2001 From: Johannes Schumann <johannes.schumann@fau.de> Date: Mon, 16 Aug 2021 18:15:42 +0200 Subject: [PATCH] YAPF --- km3buu/config.py | 4 +++- km3buu/environment.py | 3 +++ km3buu/jobcard.py | 4 +++- km3buu/tests/test_ctrl.py | 4 +++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/km3buu/config.py b/km3buu/config.py index 7b97282..25279ce 100644 --- a/km3buu/config.py +++ b/km3buu/config.py @@ -162,5 +162,7 @@ def read_default_media_compositions(): try: fpath = join(cfg.gseagen_path, "dat", GSEAGEN_MEDIA_COMPOSITION_FILE) except: - fpath = abspath(join(dirname(__file__), "../config/", GSEAGEN_MEDIA_COMPOSITION_FILE)) + fpath = abspath( + join(dirname(__file__), "../config/", + GSEAGEN_MEDIA_COMPOSITION_FILE)) return read_media_compositions(fpath) diff --git a/km3buu/environment.py b/km3buu/environment.py index 624a091..5bed273 100644 --- a/km3buu/environment.py +++ b/km3buu/environment.py @@ -25,17 +25,20 @@ log = get_logger(basename(__file__)) MIN_SINGULARITY_VERSION = "3.3" + def check_singularity_version(): # pragma: no cover if not is_singularity_version_greater(MIN_SINGULARITY_VERSION): log.error("Singularity version lower than %s" % MIN_SINGULARITY_VERSION) raise OSError("Singularity version below %s" % MIN_SINGULARITY_VERSION) + def is_singularity_version_greater(min_version): # pragma: no cover singularity_version = LooseVersion(get_singularity_version().split()[-1]) retval = singularity_version > LooseVersion(MIN_SINGULARITY_VERSION) return retval + def build_image(output_dir): if not isdir(output_dir): raise OSError("Directory not found!") diff --git a/km3buu/jobcard.py b/km3buu/jobcard.py index 4e6353c..14013d9 100644 --- a/km3buu/jobcard.py +++ b/km3buu/jobcard.py @@ -88,10 +88,12 @@ class Jobcard(f90nml.Namelist): def read_jobcard(filepath): return Jobcard(f90nml.read(filepath), filename=basename(filepath)) -def write_jobcard(jobcard,filepath): + +def write_jobcard(jobcard, filepath): with open(filepath, 'w') as nml_file: f90nml.write(jobcard, nml_file) + def generate_neutrino_jobcard(events, process, flavour, diff --git a/km3buu/tests/test_ctrl.py b/km3buu/tests/test_ctrl.py index 0fc92e1..34d4faa 100644 --- a/km3buu/tests/test_ctrl.py +++ b/km3buu/tests/test_ctrl.py @@ -78,7 +78,9 @@ class TestCTRLbyJobcardObject(unittest.TestCase): self.test_jobcard["neutrinoAnalysis"]["outputEvents"] = True self.test_jobcard["pythia"]["PARP(91)"] = 0.44 self.output_dir = TemporaryDirectory() - self.retval = run_jobcard(self.test_jobcard, self.output_dir.name, container=True) + self.retval = run_jobcard(self.test_jobcard, + self.output_dir.name, + container=True) # raise Exception(self.test_jobcard) def test_output(self): -- GitLab