From e62066bdb3f5149610601a4af2a19e468960889b Mon Sep 17 00:00:00 2001 From: Fabian Zills Date: Wed, 20 Nov 2024 09:21:09 +0100 Subject: [PATCH] review --- tests/files/test_custom_field.py | 22 ---------------------- zntrack/fields/outs_and_metrics.py | 12 ------------ 2 files changed, 34 deletions(-) diff --git a/tests/files/test_custom_field.py b/tests/files/test_custom_field.py index 89c7ddd2..d3045e22 100644 --- a/tests/files/test_custom_field.py +++ b/tests/files/test_custom_field.py @@ -12,27 +12,10 @@ def _h5data_getter(self: zntrack.Node, name: str, suffix: str): - # file = (self.nwd / name).with_suffix(suffix) - # with self.state.fs.open(file, mode="rb") as f: - # self.__dict__[name] = h5py.File(f, "r")["data"][()] raise NotImplementedError -# TODO: test without getter / save_func - it should not be called when purely writing! -# TODO: test with getter in a different test -# TODO: try to somehow replicate the ipsuite issue... -# TODO: check if you can simpify the fields defintion by removing cache, -# and the need to use functools.partial, base better, plugin_getter, etc. -# should only be ZNTRACK_OPTION, ZNTRACK_FIELD_LOAD, ZNTRACK_FIELD_DUMP, ZNTRACK_FIELD_SUFFIX -# TODO: if ZNTRACK_FIELD_SUFFIX is None (not, not defined!) then -# assume a directory is being saved there for DVC -# TODO: fix -> znfields.field return type, try dataclass field? Fix updstream - - def _h5data_save_func(self: zntrack.Node, name: str, suffix: str): - # file = (self.nwd / name).with_suffix(suffix) - # with h5py.File(file, "w") as f: - # f.create_dataset("data", data=getattr(self, name)) raise NotImplementedError @@ -71,8 +54,3 @@ def test_text_node(proj_path): assert (CWD / "params_config" / "custom_field.yaml").read_text() == ( proj_path / "params.yaml" ).read_text() - - # # I know this is file testing but this should be fast - # project.repro(build=False) - - # npt.assert_array_equal(node.content, np.arange(9).reshape(3, 3)) diff --git a/zntrack/fields/outs_and_metrics.py b/zntrack/fields/outs_and_metrics.py index 97e79243..c15e3803 100644 --- a/zntrack/fields/outs_and_metrics.py +++ b/zntrack/fields/outs_and_metrics.py @@ -21,18 +21,6 @@ def _metrics_save_func(self: "Node", name: str, suffix: str): def outs(*, cache: bool = True, independent: bool = False, **kwargs): - # kwargs["metadata"] = kwargs.get("metadata", {}) - # kwargs["metadata"][ZNTRACK_OPTION] = ZnTrackOptionEnum.OUTS - # kwargs["metadata"][ZNTRACK_CACHE] = cache - # kwargs["metadata"][ZNTRACK_INDEPENDENT_OUTPUT_TYPE] = independent - # kwargs["metadata"][ZNTRACK_FIELD_LOAD] = functools.partial( - # base_getter, func=_outs_getter - # ) - # kwargs["metadata"][ZNTRACK_FIELD_DUMP] = _outs_save_func - # kwargs["metadata"][ZNTRACK_FIELD_SUFFIX] = ".json" - # return znfields.field( - # default=NOT_AVAILABLE, getter=plugin_getter, **kwargs, init=False - # ) return field( default=NOT_AVAILABLE, cache=cache,