diff --git a/doc/introduction/data.rst b/doc/introduction/data.rst index 99fe2b919db..0fc53abae8c 100644 --- a/doc/introduction/data.rst +++ b/doc/introduction/data.rst @@ -35,7 +35,7 @@ The :func:`~pennylane.data.load` function returns a ``list`` with the desired da >>> H2data = H2datasets[0] We can load datasets for multiple parameter values by providing a list of values instead of a single value. -To load all possible values, use the special value :const:`~pennylane.data.FULL`. +To load all possible values, use the special value :const:`~pennylane.data.FULL` or the string 'full': >>> H2datasets = qml.data.load("qchem", molname="H2", basis="full", bondlength=[0.5, 1.1]) >>> print(H2datasets) diff --git a/docker/pennylane.dockerfile b/docker/pennylane.dockerfile index a0d3e74702a..83f00a7c214 100644 --- a/docker/pennylane.dockerfile +++ b/docker/pennylane.dockerfile @@ -46,7 +46,7 @@ RUN pip install pytest pytest-cov pytest-mock flaky RUN pip install -i https://test.pypi.org/simple/ pennylane-lightning --pre --upgrade # hotfix, remove when pyscf 2.1 is released (currently no wheel for python3.10) RUN pip install openfermionpyscf || true -RUN pip install hdf5 || true +RUN pip install hdf5 fsspec aiohttp || true RUN make test && make coverage # create Second small build. diff --git a/pennylane/data/__init__.py b/pennylane/data/__init__.py index 463e4d9c647..4513798cca5 100644 --- a/pennylane/data/__init__.py +++ b/pennylane/data/__init__.py @@ -106,7 +106,7 @@ >>> dataset = qml.data.Dataset(hamiltonian = qml.data.attribute( hamiltonian, doc="The hamiltonian of the system")) - >>> dataset.eigen = attribute( + >>> dataset.eigen = qml.data.attribute( {"eigvals": eigvals, "eigvecs": eigvecs}, doc="Eigenvalues and eigenvectors of the hamiltonain") diff --git a/pennylane/data/attributes/array.py b/pennylane/data/attributes/array.py index 550d5c9f90d..b1c414041f5 100644 --- a/pennylane/data/attributes/array.py +++ b/pennylane/data/attributes/array.py @@ -30,8 +30,8 @@ class DatasetArray(DatasetAttribute[HDF5Array, numpy.ndarray, ArrayLike]): type_id = "array" - def __post_init__(self, value: ArrayLike, info: Optional[AttributeInfo]) -> None: - super().__post_init__(value, info) + def __post_init__(self, value: ArrayLike) -> None: + super().__post_init__(value) array_interface = get_interface(value) if array_interface not in ("numpy", "autograd"): diff --git a/pennylane/data/attributes/dictionary.py b/pennylane/data/attributes/dictionary.py index 94f21c8bd12..ecac3c77623 100644 --- a/pennylane/data/attributes/dictionary.py +++ b/pennylane/data/attributes/dictionary.py @@ -38,7 +38,8 @@ class DatasetDict( # pylint: disable=too-many-ancestors type_id = "dict" - def __post_init__(self, value: typing.Mapping[str, T], info): + def __post_init__(self, value: typing.Mapping[str, T]): + super().__post_init__(value) self.update(value) @classmethod diff --git a/pennylane/data/attributes/list.py b/pennylane/data/attributes/list.py index 9f6218e0d0a..420be6f3ad8 100644 --- a/pennylane/data/attributes/list.py +++ b/pennylane/data/attributes/list.py @@ -34,7 +34,9 @@ class DatasetList( # pylint: disable=too-many-ancestors type_id = "list" - def __post_init__(self, value: typing.Iterable[T], info): + def __post_init__(self, value: typing.Iterable[T]): + super().__post_init__(value) + self.extend(value) @classmethod diff --git a/pennylane/data/attributes/sparse_array.py b/pennylane/data/attributes/sparse_array.py index ad7d71c80d7..246f94e06bd 100644 --- a/pennylane/data/attributes/sparse_array.py +++ b/pennylane/data/attributes/sparse_array.py @@ -51,8 +51,8 @@ class DatasetSparseArray(Generic[SparseT], DatasetAttribute[HDF5Group, SparseT, type_id = "sparse_array" - def __post_init__(self, value: SparseT, info) -> None: - super().__post_init__(value, info) + def __post_init__(self, value: SparseT) -> None: + super().__post_init__(value) self.info["sparse_array_class"] = type(value).__qualname__ @property diff --git a/pennylane/data/base/attribute.py b/pennylane/data/base/attribute.py index 63f2540c003..a8a96c67670 100644 --- a/pennylane/data/base/attribute.py +++ b/pennylane/data/base/attribute.py @@ -282,7 +282,7 @@ def _value_init( self._bind = self._set_value(value, info, parent, key) self._check_bind() - self.__post_init__(value, self.info) + self.__post_init__(value) @property def info(self) -> AttributeInfo: @@ -318,7 +318,7 @@ def consumes_types(cls) -> typing.Iterable[type]: """ return () - def __post_init__(self, value: InitValueType, info: Optional[AttributeInfo]) -> None: + def __post_init__(self, value: InitValueType) -> None: """Called after __init__(), only during value initialization. Can be implemented in subclasses that require additional initialization.""" diff --git a/pennylane/data/base/dataset.py b/pennylane/data/base/dataset.py index a4fad7d75bf..769a418d976 100644 --- a/pennylane/data/base/dataset.py +++ b/pennylane/data/base/dataset.py @@ -66,7 +66,6 @@ def field( # pylint: disable=too-many-arguments, unused-argument attribute_type: Union[Type[DatasetAttribute[HDF5Any, T, Any]], Literal[UNSET]] = UNSET, doc: Optional[str] = None, py_type: Optional[Any] = None, - is_param: bool = False, **kwargs, ) -> Any: """Used to define fields on a declarative Dataset. @@ -82,7 +81,7 @@ def field( # pylint: disable=too-many-arguments, unused-argument return Field( cast(Type[DatasetAttribute[HDF5Any, T, T]], attribute_type), - AttributeInfo(doc=doc, py_type=py_type, is_param=is_param, **kwargs), + AttributeInfo(doc=doc, py_type=py_type, **kwargs), )