diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 518b51e4..f66b8cca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: - id: end-of-file-fixer - id: sort-simple-yaml - repo: https://github.com/psf/black - rev: 24.2.0 + rev: 24.3.0 hooks: - id: black args: ['--line-length=119'] diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 6862e41e..e303aa84 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -4,6 +4,9 @@ build: os: ubuntu-20.04 tools: python: "mambaforge-4.10" + jobs: + pre_build: + - mkdir ~/tmp sphinx: builder: html diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 0caf1506..98175aec 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -40,8 +40,8 @@ requirements: - dxchange - olefile - pooch - - panel<1.3 - - param<2 + - panel + - param - pyvista - holoviews - bokeh diff --git a/environment.yml b/environment.yml index f04c4350..c159f939 100644 --- a/environment.yml +++ b/environment.yml @@ -17,8 +17,8 @@ dependencies: - datashader - hvplot # GUI - - panel<1.3 - - param<2 + - panel + - param - pyvista # IO - dxchange diff --git a/src/imars3d/backend/dataio/data.py b/src/imars3d/backend/dataio/data.py index 4bff10f2..ebbdd648 100644 --- a/src/imars3d/backend/dataio/data.py +++ b/src/imars3d/backend/dataio/data.py @@ -59,14 +59,20 @@ class Foldernames(param.Foldername): * any of the paths searched by resolve_dir_path() (if search_paths is None). """ + def _validate(self, val): + + if isinstance(val, (list, tuple)): + for v in val: + super()._validate(v) + else: + super()._validate(val) + def _resolve(self, paths): - if isinstance(paths, (str, Path)): - return super()._resolve(paths) - elif isinstance(paths, (list, tuple)): + + if isinstance(paths, (list, tuple)): return [self._resolve(path) for path in paths] else: - name = next(x for x in [self.name, self.label, "Foldernames parameter"] if x) - raise ValueError(f"{name} must be a string or a list of strings") + return super()._resolve(paths) class load_data(param.ParameterizedFunction): diff --git a/src/imars3d/backend/workflow/engine.py b/src/imars3d/backend/workflow/engine.py index c1e756fb..3736333f 100644 --- a/src/imars3d/backend/workflow/engine.py +++ b/src/imars3d/backend/workflow/engine.py @@ -104,7 +104,7 @@ def _instrospect_task_function(self, function_str: str) -> namedtuple: # depending on the value of other parameters. Methods `dryrun()` assume that # parameters are independent of each other independent = False if function_name in ["load_data"] else True - outputs = dict(function=f, paramdict=f.params(), params_independent=independent) + outputs = dict(function=f, paramdict=f.param.params(), params_independent=independent) return namedtuple("TaskFuncionInstrospection", outputs.keys())(**outputs) def _resolve_inputs(self, task_inputs: dict, paramdict: dict) -> dict: diff --git a/tests/unit/backend/dataio/test_data.py b/tests/unit/backend/dataio/test_data.py index 82cb87b0..efbe04fb 100644 --- a/tests/unit/backend/dataio/test_data.py +++ b/tests/unit/backend/dataio/test_data.py @@ -69,7 +69,8 @@ class TestFoldernames(param.Parameterized): # test wrong input with pytest.raises(ValueError) as e: TestFoldernames(f=open(tmpdir / "temp.txt", "w")) - assert str(e.value) == "f must be a string or a list of strings" + + assert str(e.value) == "Foldernames parameter 'TestFoldernames.f' only take str or pathlib.Path types" # test single directory tf = TestFoldernames(f=str(tmpdir)) assert tf.f == str(tmpdir) diff --git a/tests/unit/backend/diagnostics/test_tilt.py b/tests/unit/backend/diagnostics/test_tilt.py index b73b7200..f2f26ca5 100644 --- a/tests/unit/backend/diagnostics/test_tilt.py +++ b/tests/unit/backend/diagnostics/test_tilt.py @@ -285,7 +285,7 @@ def test_apply_tilt_correction(): def test_tilt_correction(): # error_0: incorrect dimension with pytest.raises(ValueError): - tilt_correction(arrays=np.arange(10), tilt=1.0) + tilt_correction(arrays=np.arange(10)) # make synthetic data size = 100 rot_axis_ideal = get_tilted_rot_axis(0, 0)