This commit is contained in:
sneakers-the-rat 2024-10-18 20:19:22 -07:00
parent 2ea861c9a0
commit df15d666cf
Signed by untrusted user who does not match committer: jonny
GPG key ID: 6DCB96EF1E4D232D
2 changed files with 3 additions and 54 deletions

View file

@ -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: class H5Proxy:
""" """
Proxy class to mimic numpy-like array behavior with an HDF5 array 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 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__( def __init__(
self, self,
file: Union[Path, str], file: Union[Path, str],

View file

@ -148,7 +148,7 @@ def dtype_by_interface(request):
@pytest.fixture() @pytest.fixture()
def dtype_by_interface_instance(all_passing_cases, tmp_output_dir_func): def dtype_by_interface_instance(dtype_by_interface, tmp_output_dir_func):
array = all_passing_cases.array(path=tmp_output_dir_func) array = dtype_by_interface.array(path=tmp_output_dir_func)
instance = all_passing_cases.model(array=array) instance = dtype_by_interface.model(array=array)
return instance return instance