Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonFZ committed Nov 20, 2024
1 parent bede7af commit e62066b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
22 changes: 0 additions & 22 deletions tests/files/test_custom_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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))
12 changes: 0 additions & 12 deletions zntrack/fields/outs_and_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e62066b

Please sign in to comment.