From df15d666cf5510959838afe445f661bbbced2ea5 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Fri, 18 Oct 2024 20:19:22 -0700 Subject: [PATCH] cleanup --- src/numpydantic/interface/hdf5.py | 51 ------------------------------- tests/test_interface/conftest.py | 6 ++-- 2 files changed, 3 insertions(+), 54 deletions(-) diff --git a/src/numpydantic/interface/hdf5.py b/src/numpydantic/interface/hdf5.py index 3f3195d..b8492b7 100644 --- a/src/numpydantic/interface/hdf5.py +++ b/src/numpydantic/interface/hdf5.py @@ -99,51 +99,6 @@ class H5JsonDict(JsonDict): ) -# def to_json(self, info: SerializationInfo): -# """ -# Serialize H5Proxy to JSON, as the interface does, -# in cases when the interface is not able to be used -# (eg. like when used as an `extra` field in a model without a type annotation) -# """ -# from numpydantic.serialization import postprocess_json -# -# if info.round_trip: -# as_json = { -# "type": H5Interface.name, -# } -# as_json.update(self._h5arraypath._asdict()) -# else: -# try: -# dset = self.open() -# as_json = dset[:].tolist() -# finally: -# self.close() -# return postprocess_json(as_json, info) - - -# def _make_pydantic_schema(): -# return core_schema.typed_dict_schema( -# { -# "file": core_schema.typed_dict_field( -# core_schema.str_schema(), required=True -# ), -# "path": core_schema.typed_dict_field( -# core_schema.str_schema(), required=True -# ), -# "field": core_schema.typed_dict_field( -# core_schema.union_schema( -# [ -# core_schema.str_schema(), -# core_schema.list_schema(core_schema.str_schema()), -# ], -# ), -# required=True, -# ), -# }, -# # serialization= -# ) - - class H5Proxy: """ Proxy class to mimic numpy-like array behavior with an HDF5 array @@ -166,12 +121,6 @@ class H5Proxy: annotation_dtype (dtype): Optional - the dtype of our type annotation """ - # __pydantic_serializer__ = SchemaSerializer( - # core_schema.plain_serializer_function_ser_schema( - # jsonize_array, when_used="json", info_arg=True - # ), - # ) - def __init__( self, file: Union[Path, str], diff --git a/tests/test_interface/conftest.py b/tests/test_interface/conftest.py index 3e667bf..d4ef888 100644 --- a/tests/test_interface/conftest.py +++ b/tests/test_interface/conftest.py @@ -148,7 +148,7 @@ def dtype_by_interface(request): @pytest.fixture() -def dtype_by_interface_instance(all_passing_cases, tmp_output_dir_func): - array = all_passing_cases.array(path=tmp_output_dir_func) - instance = all_passing_cases.model(array=array) +def dtype_by_interface_instance(dtype_by_interface, tmp_output_dir_func): + array = dtype_by_interface.array(path=tmp_output_dir_func) + instance = dtype_by_interface.model(array=array) return instance