mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2025-01-09 13:44:26 +00:00
bump version, docs, nocover error checking
This commit is contained in:
parent
56c5b9ac79
commit
9d31ecf385
3 changed files with 22 additions and 2 deletions
|
@ -4,6 +4,11 @@
|
|||
|
||||
### 1.5.*
|
||||
|
||||
#### 1.5.2 - 24-09-03 - `datetime` support for HDF5
|
||||
|
||||
- [#15](https://github.com/p2p-ld/numpydantic/pull/15): Datetimes are supported as
|
||||
dtype annotations for HDF5 arrays when encoded as `S32` isoformatted byte strings
|
||||
|
||||
#### 1.5.1 - 24-09-03 - Fix revalidation with proxy classes
|
||||
|
||||
Bugfix:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "numpydantic"
|
||||
version = "1.5.1"
|
||||
version = "1.5.2"
|
||||
description = "Type and shape validation and serialization for arbitrary array types in pydantic models"
|
||||
authors = [
|
||||
{name = "sneakers-the-rat", email = "sneakers-the-rat@protonmail.com"},
|
||||
|
|
|
@ -22,6 +22,21 @@ Interfaces for HDF5 Datasets
|
|||
To have direct access to the hdf5 dataset, use the
|
||||
:meth:`.H5Proxy.open` method.
|
||||
|
||||
Datetimes
|
||||
---------
|
||||
|
||||
Datetimes are supported as a dtype annotation, but currently they must be stored
|
||||
as ``S32`` isoformatted byte strings (timezones optional) like:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import h5py
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
data = np.array([datetime.now().isoformat().encode('utf-8')], dtype="S32")
|
||||
h5f = h5py.File('test.hdf5', 'w')
|
||||
h5f.create_dataset('data', data=data)
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
@ -311,7 +326,7 @@ class H5Interface(Interface):
|
|||
return np.datetime64
|
||||
else:
|
||||
return str
|
||||
except (AttributeError, ValueError, TypeError):
|
||||
except (AttributeError, ValueError, TypeError): # pragma: no cover
|
||||
return str
|
||||
else:
|
||||
return array.dtype
|
||||
|
|
Loading…
Reference in a new issue