We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] `qml.data.load()` fails when using 'full' parameter value
### Expected behavior

`qml.data.load('qspin',sysname='Heisenberg',periodicity='open',lattice='full',layout='2x2')`
Should return the Heisenberg dataset corresponding to the `open` periodicity, `rectangular` lattice, and `2x2` layout.

### Actual behavior

`qml.data.load('qspin',sysname='Heisenberg',periodicity='open',lattice='full',layout='2x2')`

Raises `ValueError: layout value of '2x2' is not available. Available values are ['1x16', '1x4', '1x8']`

### Additional information

_No response_

### Source code

```shell
qml.data.load('qspin',sysname='Heisenberg',periodicity='open',lattice='full',layout='1x4') # works

qml.data.load('qspin',sysname='Heisenberg',periodicity='open',lattice='full',layout='2x2') # fails
```


### Tracebacks

_No response_

### System information

```shell
Name: PennyLane
Version: 0.31.0.dev0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/XanaduAI/pennylane
Author: 
Author-email: 
License: Apache License 2.0
Location: .venv/lib/python3.8/site-packages
Editable project location: 
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml
Required-by: PennyLane-Lightning

Platform info:           Linux-5.15.0-73-generic-x86_64-with-glibc2.29
Python version:          3.8.10
Numpy version:           1.23.5
Scipy version:           1.10.1
Installed devices:
- default.gaussian (PennyLane-0.31.0.dev0)
- default.mixed (PennyLane-0.31.0.dev0)
- default.qubit (PennyLane-0.31.0.dev0)
- default.qubit.autograd (PennyLane-0.31.0.dev0)
- default.qubit.jax (PennyLane-0.31.0.dev0)
- default.qubit.tf (PennyLane-0.31.0.dev0)
- default.qubit.torch (PennyLane-0.31.0.dev0)
- default.qutrit (PennyLane-0.31.0.dev0)
- null.qubit (PennyLane-0.31.0.dev0)
- lightning.qubit (PennyLane-Lightning-0.30.0)
```


### Existing GitHub issues

- [X] I have searched existing GitHub issues to make sure the issue does not already exist.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pennylane/data/data_manager/foldermap.py`
Content:
```
1 # Copyright 2018-2023 Xanadu Quantum Technologies Inc.
2 
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """
15 Contains ``FolderMapView`` for reading the ``foldermap.json`` file in the
16 datasets bucket.
17 """
18 
19 
20 import typing
21 from collections.abc import Mapping
22 from pathlib import PurePosixPath
23 from typing import Any, List, Literal, Optional, Tuple, Union
24 
25 from .params import Description, ParamArg, ParamVal
26 
27 
28 # Type for a dataset path, relative to the foldermap.json file
29 class DataPath(PurePosixPath):
30     """Type for Dataset Path, relative to the foldermap.json file."""
31 
32     def __repr__(self) -> str:
33         return repr(str(self))
34 
35 
36 class FolderMapView(typing.Mapping[str, Union["FolderMapView", DataPath]]):
37     """Provides a read-only view of the ``foldermap.json`` file in
38     the datasets bucket. The folder map is a nested mapping of
39     dataset parameters to their path, relative to the ``foldermap.json``
40     file.
41 
42     A dictionary in the folder map can optionally specify a default
43     paramater using the '__default' key. This view hides that
44     key, and allows the default parameter to be accessed.
45 
46     For example, the underlying foldermap data will look like
47     this:
48 
49         {
50             "__params": {
51                 "qchem": ["molname", "basis", "bondlength"]
52             },
53             "qchem": {
54                 "O2": {
55                     "__default": "STO-3G",
56                     "STO-3G": {
57                         "__default": "0.5",
58                         "0.5": "qchem/O2/STO-3G/0.5.h5",
59                         "0.6": "qchem/O2/STO-3G/0.6.h5"
60                     }
61                 },
62                 "H2": {
63                     "__default": "STO-3G",
64                     "STO-3G": {
65                         "__default": "0.7",
66                         "0.7": "qchem/H2/STO-3G/0.7.h5"
67                     }
68                 }
69             },
70         }
71 
72     When accessed through ``FolderMapView``, the '__default' and '__params'
73     keys will be hidden.
74     """
75 
76     __PRIVATE_KEYS = {"__default", "__params"}
77 
78     def __init__(self, __curr_level: typing.Mapping[str, Any]) -> None:
79         """Initialize the mapping.
80 
81         Args:
82             __data_struct: The top level foldermap
83         """
84         self.__curr_level = __curr_level
85 
86     def get_default_key(self) -> Optional[str]:
87         """Get the default key for this level of the foldermap.
88         Raises a ValueError if it does not have a default.
89         """
90         return self.__curr_level.get("__default")
91 
92     def find(
93         self,
94         data_name: str,
95         missing_default: Optional[ParamArg] = ParamArg.DEFAULT,
96         **params: Union[typing.Iterable[ParamVal], ParamArg],
97     ) -> List[Tuple[Description, DataPath]]:
98         """Returns a 2-tuple of dataset description and paths, for each dataset that
99         matches ``params``."""
100 
101         try:
102             data_names_to_params = self.__curr_level["__params"]
103         except KeyError as exc:
104             raise RuntimeError("Can only call find() from top level of foldermap") from exc
105 
106         try:
107             param_names: List[str] = data_names_to_params[data_name]
108         except KeyError as exc:
109             raise ValueError(f"No datasets with data name: '{data_name}'") from exc
110 
111         curr: List[Tuple[Description, Union[FolderMapView, DataPath]]] = [
112             (Description(()), self[data_name])
113         ]
114         todo: List[Tuple[Description, Union[FolderMapView, DataPath]]] = []
115         done: List[Tuple[Description, DataPath]] = []
116 
117         for param_name in param_names:
118             param_arg = params.get(param_name, missing_default)
119 
120             while curr:
121                 curr_description, curr_level = curr.pop()
122                 if param_arg == ParamArg.FULL:
123                     next_params = curr_level
124                 elif param_arg == ParamArg.DEFAULT:
125                     default = curr_level.get_default_key()
126                     if default is None:
127                         raise ValueError(f"No default available for parameter '{param_name}'")
128                     next_params = (default,)
129                 elif isinstance(param_arg, str):
130                     next_params = (param_arg,)
131                 else:
132                     next_params = param_arg
133 
134                 try:
135                     todo.extend(
136                         (
137                             Description((*curr_description.items(), (param_name, next_param))),
138                             curr_level[next_param],
139                         )
140                         for next_param in next_params
141                     )
142                 except KeyError as exc:
143                     raise ValueError(
144                         f"{param_name} '{exc.args[0]}' is not available. Available values are: {list(curr_level)}"
145                     ) from exc
146 
147             curr, todo = todo, curr
148 
149         done.extend(curr)
150 
151         return done
152 
153     def __getitem__(
154         self, __key: Union[str, Literal[ParamArg.DEFAULT]]
155     ) -> Union["FolderMapView", DataPath]:
156         """Gets the item with key. If key is ``ParamArg.DEFAULT``, return the
157         item under the default parameter, or raise a ``ValueError`` if no
158         default exists."""
159         if __key in self.__PRIVATE_KEYS:
160             raise KeyError(__key)
161 
162         if __key == ParamArg.DEFAULT:
163             default = self.get_default_key()
164             if default is None:
165                 raise ValueError("No default available")
166             return self[default]
167 
168         elem = self.__curr_level[__key]
169         if isinstance(elem, Mapping):
170             return FolderMapView(elem)
171 
172         return DataPath(elem)
173 
174     def __iter__(self) -> typing.Iterator[str]:
175         return (key for key in self.__curr_level.keys() if key not in self.__PRIVATE_KEYS)
176 
177     def keys(self) -> typing.FrozenSet[str]:
178         return frozenset(iter(self))
179 
180     def __len__(self) -> int:
181         return sum(1 for _ in self.__iter__())
182 
183     def __repr__(self) -> str:
184         return repr(dict(self))
185 
186     def __str__(self) -> str:
187         return str(dict(self))
188
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pennylane/data/data_manager/foldermap.py b/pennylane/data/data_manager/foldermap.py
--- a/pennylane/data/data_manager/foldermap.py
+++ b/pennylane/data/data_manager/foldermap.py
@@ -119,6 +119,7 @@
 
             while curr:
                 curr_description, curr_level = curr.pop()
+
                 if param_arg == ParamArg.FULL:
                     next_params = curr_level
                 elif param_arg == ParamArg.DEFAULT:
@@ -131,18 +132,29 @@
                 else:
                     next_params = param_arg
 
-                try:
-                    todo.extend(
+                for next_param in next_params:
+                    try:
+                        fmap_next = curr_level[next_param]
+                    except KeyError:
+                        continue
+
+                    todo.append(
                         (
                             Description((*curr_description.items(), (param_name, next_param))),
-                            curr_level[next_param],
+                            fmap_next,
                         )
-                        for next_param in next_params
                     )
-                except KeyError as exc:
-                    raise ValueError(
-                        f"{param_name} '{exc.args[0]}' is not available. Available values are: {list(curr_level)}"
-                    ) from exc
+
+            if len(todo) == 0:
+                # None of the parameters matched
+                param_arg_repr = (
+                    repr([param_arg])
+                    if isinstance(param_arg, (str, ParamArg))
+                    else repr(list(param_arg))
+                )
+                raise ValueError(
+                    f"{param_name} value(s) {param_arg_repr} are not available. Available values are: {list(curr_level)}"
+                )
 
             curr, todo = todo, curr

{"golden_diff": "diff --git a/pennylane/data/data_manager/foldermap.py b/pennylane/data/data_manager/foldermap.py\n--- a/pennylane/data/data_manager/foldermap.py\n+++ b/pennylane/data/data_manager/foldermap.py\n@@ -119,6 +119,7 @@\n \n             while curr:\n                 curr_description, curr_level = curr.pop()\n+\n                 if param_arg == ParamArg.FULL:\n                     next_params = curr_level\n                 elif param_arg == ParamArg.DEFAULT:\n@@ -131,18 +132,29 @@\n                 else:\n                     next_params = param_arg\n \n-                try:\n-                    todo.extend(\n+                for next_param in next_params:\n+                    try:\n+                        fmap_next = curr_level[next_param]\n+                    except KeyError:\n+                        continue\n+\n+                    todo.append(\n                         (\n                             Description((*curr_description.items(), (param_name, next_param))),\n-                            curr_level[next_param],\n+                            fmap_next,\n                         )\n-                        for next_param in next_params\n                     )\n-                except KeyError as exc:\n-                    raise ValueError(\n-                        f\"{param_name} '{exc.args[0]}' is not available. Available values are: {list(curr_level)}\"\n-                    ) from exc\n+\n+            if len(todo) == 0:\n+                # None of the parameters matched\n+                param_arg_repr = (\n+                    repr([param_arg])\n+                    if isinstance(param_arg, (str, ParamArg))\n+                    else repr(list(param_arg))\n+                )\n+                raise ValueError(\n+                    f\"{param_name} value(s) {param_arg_repr} are not available. Available values are: {list(curr_level)}\"\n+                )\n \n             curr, todo = todo, curr\n", "issue": "[BUG] `qml.data.load()` fails when using 'full' parameter value\n### Expected behavior\r\n\r\n`qml.data.load('qspin',sysname='Heisenberg',periodicity='open',lattice='full',layout='2x2')`\r\nShould return the Heisenberg dataset corresponding to the `open` periodicity, `rectangular` lattice, and `2x2` layout.\r\n\r\n### Actual behavior\r\n\r\n`qml.data.load('qspin',sysname='Heisenberg',periodicity='open',lattice='full',layout='2x2')`\r\n\r\nRaises `ValueError: layout value of '2x2' is not available. Available values are ['1x16', '1x4', '1x8']`\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### Source code\r\n\r\n```shell\r\nqml.data.load('qspin',sysname='Heisenberg',periodicity='open',lattice='full',layout='1x4') # works\r\n\r\nqml.data.load('qspin',sysname='Heisenberg',periodicity='open',lattice='full',layout='2x2') # fails\r\n```\r\n\r\n\r\n### Tracebacks\r\n\r\n_No response_\r\n\r\n### System information\r\n\r\n```shell\r\nName: PennyLane\r\nVersion: 0.31.0.dev0\r\nSummary: PennyLane is a Python quantum machine learning library by Xanadu Inc.\r\nHome-page: https://github.com/XanaduAI/pennylane\r\nAuthor: \r\nAuthor-email: \r\nLicense: Apache License 2.0\r\nLocation: .venv/lib/python3.8/site-packages\r\nEditable project location: \r\nRequires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml\r\nRequired-by: PennyLane-Lightning\r\n\r\nPlatform info:           Linux-5.15.0-73-generic-x86_64-with-glibc2.29\r\nPython version:          3.8.10\r\nNumpy version:           1.23.5\r\nScipy version:           1.10.1\r\nInstalled devices:\r\n- default.gaussian (PennyLane-0.31.0.dev0)\r\n- default.mixed (PennyLane-0.31.0.dev0)\r\n- default.qubit (PennyLane-0.31.0.dev0)\r\n- default.qubit.autograd (PennyLane-0.31.0.dev0)\r\n- default.qubit.jax (PennyLane-0.31.0.dev0)\r\n- default.qubit.tf (PennyLane-0.31.0.dev0)\r\n- default.qubit.torch (PennyLane-0.31.0.dev0)\r\n- default.qutrit (PennyLane-0.31.0.dev0)\r\n- null.qubit (PennyLane-0.31.0.dev0)\r\n- lightning.qubit (PennyLane-Lightning-0.30.0)\r\n```\r\n\r\n\r\n### Existing GitHub issues\r\n\r\n- [X] I have searched existing GitHub issues to make sure the issue does not already exist.\n", "before_files": [{"content": "# Copyright 2018-2023 Xanadu Quantum Technologies Inc.\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n\n#     http://www.apache.org/licenses/LICENSE-2.0\n\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"\nContains ``FolderMapView`` for reading the ``foldermap.json`` file in the\ndatasets bucket.\n\"\"\"\n\n\nimport typing\nfrom collections.abc import Mapping\nfrom pathlib import PurePosixPath\nfrom typing import Any, List, Literal, Optional, Tuple, Union\n\nfrom .params import Description, ParamArg, ParamVal\n\n\n# Type for a dataset path, relative to the foldermap.json file\nclass DataPath(PurePosixPath):\n    \"\"\"Type for Dataset Path, relative to the foldermap.json file.\"\"\"\n\n    def __repr__(self) -> str:\n        return repr(str(self))\n\n\nclass FolderMapView(typing.Mapping[str, Union[\"FolderMapView\", DataPath]]):\n    \"\"\"Provides a read-only view of the ``foldermap.json`` file in\n    the datasets bucket. The folder map is a nested mapping of\n    dataset parameters to their path, relative to the ``foldermap.json``\n    file.\n\n    A dictionary in the folder map can optionally specify a default\n    paramater using the '__default' key. This view hides that\n    key, and allows the default parameter to be accessed.\n\n    For example, the underlying foldermap data will look like\n    this:\n\n        {\n            \"__params\": {\n                \"qchem\": [\"molname\", \"basis\", \"bondlength\"]\n            },\n            \"qchem\": {\n                \"O2\": {\n                    \"__default\": \"STO-3G\",\n                    \"STO-3G\": {\n                        \"__default\": \"0.5\",\n                        \"0.5\": \"qchem/O2/STO-3G/0.5.h5\",\n                        \"0.6\": \"qchem/O2/STO-3G/0.6.h5\"\n                    }\n                },\n                \"H2\": {\n                    \"__default\": \"STO-3G\",\n                    \"STO-3G\": {\n                        \"__default\": \"0.7\",\n                        \"0.7\": \"qchem/H2/STO-3G/0.7.h5\"\n                    }\n                }\n            },\n        }\n\n    When accessed through ``FolderMapView``, the '__default' and '__params'\n    keys will be hidden.\n    \"\"\"\n\n    __PRIVATE_KEYS = {\"__default\", \"__params\"}\n\n    def __init__(self, __curr_level: typing.Mapping[str, Any]) -> None:\n        \"\"\"Initialize the mapping.\n\n        Args:\n            __data_struct: The top level foldermap\n        \"\"\"\n        self.__curr_level = __curr_level\n\n    def get_default_key(self) -> Optional[str]:\n        \"\"\"Get the default key for this level of the foldermap.\n        Raises a ValueError if it does not have a default.\n        \"\"\"\n        return self.__curr_level.get(\"__default\")\n\n    def find(\n        self,\n        data_name: str,\n        missing_default: Optional[ParamArg] = ParamArg.DEFAULT,\n        **params: Union[typing.Iterable[ParamVal], ParamArg],\n    ) -> List[Tuple[Description, DataPath]]:\n        \"\"\"Returns a 2-tuple of dataset description and paths, for each dataset that\n        matches ``params``.\"\"\"\n\n        try:\n            data_names_to_params = self.__curr_level[\"__params\"]\n        except KeyError as exc:\n            raise RuntimeError(\"Can only call find() from top level of foldermap\") from exc\n\n        try:\n            param_names: List[str] = data_names_to_params[data_name]\n        except KeyError as exc:\n            raise ValueError(f\"No datasets with data name: '{data_name}'\") from exc\n\n        curr: List[Tuple[Description, Union[FolderMapView, DataPath]]] = [\n            (Description(()), self[data_name])\n        ]\n        todo: List[Tuple[Description, Union[FolderMapView, DataPath]]] = []\n        done: List[Tuple[Description, DataPath]] = []\n\n        for param_name in param_names:\n            param_arg = params.get(param_name, missing_default)\n\n            while curr:\n                curr_description, curr_level = curr.pop()\n                if param_arg == ParamArg.FULL:\n                    next_params = curr_level\n                elif param_arg == ParamArg.DEFAULT:\n                    default = curr_level.get_default_key()\n                    if default is None:\n                        raise ValueError(f\"No default available for parameter '{param_name}'\")\n                    next_params = (default,)\n                elif isinstance(param_arg, str):\n                    next_params = (param_arg,)\n                else:\n                    next_params = param_arg\n\n                try:\n                    todo.extend(\n                        (\n                            Description((*curr_description.items(), (param_name, next_param))),\n                            curr_level[next_param],\n                        )\n                        for next_param in next_params\n                    )\n                except KeyError as exc:\n                    raise ValueError(\n                        f\"{param_name} '{exc.args[0]}' is not available. Available values are: {list(curr_level)}\"\n                    ) from exc\n\n            curr, todo = todo, curr\n\n        done.extend(curr)\n\n        return done\n\n    def __getitem__(\n        self, __key: Union[str, Literal[ParamArg.DEFAULT]]\n    ) -> Union[\"FolderMapView\", DataPath]:\n        \"\"\"Gets the item with key. If key is ``ParamArg.DEFAULT``, return the\n        item under the default parameter, or raise a ``ValueError`` if no\n        default exists.\"\"\"\n        if __key in self.__PRIVATE_KEYS:\n            raise KeyError(__key)\n\n        if __key == ParamArg.DEFAULT:\n            default = self.get_default_key()\n            if default is None:\n                raise ValueError(\"No default available\")\n            return self[default]\n\n        elem = self.__curr_level[__key]\n        if isinstance(elem, Mapping):\n            return FolderMapView(elem)\n\n        return DataPath(elem)\n\n    def __iter__(self) -> typing.Iterator[str]:\n        return (key for key in self.__curr_level.keys() if key not in self.__PRIVATE_KEYS)\n\n    def keys(self) -> typing.FrozenSet[str]:\n        return frozenset(iter(self))\n\n    def __len__(self) -> int:\n        return sum(1 for _ in self.__iter__())\n\n    def __repr__(self) -> str:\n        return repr(dict(self))\n\n    def __str__(self) -> str:\n        return str(dict(self))\n", "path": "pennylane/data/data_manager/foldermap.py"}], "after_files": [{"content": "# Copyright 2018-2023 Xanadu Quantum Technologies Inc.\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n\n#     http://www.apache.org/licenses/LICENSE-2.0\n\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"\nContains ``FolderMapView`` for reading the ``foldermap.json`` file in the\ndatasets bucket.\n\"\"\"\n\n\nimport typing\nfrom collections.abc import Mapping\nfrom pathlib import PurePosixPath\nfrom typing import Any, List, Literal, Optional, Tuple, Union\n\nfrom .params import Description, ParamArg, ParamVal\n\n\n# Type for a dataset path, relative to the foldermap.json file\nclass DataPath(PurePosixPath):\n    \"\"\"Type for Dataset Path, relative to the foldermap.json file.\"\"\"\n\n    def __repr__(self) -> str:\n        return repr(str(self))\n\n\nclass FolderMapView(typing.Mapping[str, Union[\"FolderMapView\", DataPath]]):\n    \"\"\"Provides a read-only view of the ``foldermap.json`` file in\n    the datasets bucket. The folder map is a nested mapping of\n    dataset parameters to their path, relative to the ``foldermap.json``\n    file.\n\n    A dictionary in the folder map can optionally specify a default\n    paramater using the '__default' key. This view hides that\n    key, and allows the default parameter to be accessed.\n\n    For example, the underlying foldermap data will look like\n    this:\n\n        {\n            \"__params\": {\n                \"qchem\": [\"molname\", \"basis\", \"bondlength\"]\n            },\n            \"qchem\": {\n                \"O2\": {\n                    \"__default\": \"STO-3G\",\n                    \"STO-3G\": {\n                        \"__default\": \"0.5\",\n                        \"0.5\": \"qchem/O2/STO-3G/0.5.h5\",\n                        \"0.6\": \"qchem/O2/STO-3G/0.6.h5\"\n                    }\n                },\n                \"H2\": {\n                    \"__default\": \"STO-3G\",\n                    \"STO-3G\": {\n                        \"__default\": \"0.7\",\n                        \"0.7\": \"qchem/H2/STO-3G/0.7.h5\"\n                    }\n                }\n            },\n        }\n\n    When accessed through ``FolderMapView``, the '__default' and '__params'\n    keys will be hidden.\n    \"\"\"\n\n    __PRIVATE_KEYS = {\"__default\", \"__params\"}\n\n    def __init__(self, __curr_level: typing.Mapping[str, Any]) -> None:\n        \"\"\"Initialize the mapping.\n\n        Args:\n            __data_struct: The top level foldermap\n        \"\"\"\n        self.__curr_level = __curr_level\n\n    def get_default_key(self) -> Optional[str]:\n        \"\"\"Get the default key for this level of the foldermap.\n        Raises a ValueError if it does not have a default.\n        \"\"\"\n        return self.__curr_level.get(\"__default\")\n\n    def find(\n        self,\n        data_name: str,\n        missing_default: Optional[ParamArg] = ParamArg.DEFAULT,\n        **params: Union[typing.Iterable[ParamVal], ParamArg],\n    ) -> List[Tuple[Description, DataPath]]:\n        \"\"\"Returns a 2-tuple of dataset description and paths, for each dataset that\n        matches ``params``.\"\"\"\n\n        try:\n            data_names_to_params = self.__curr_level[\"__params\"]\n        except KeyError as exc:\n            raise RuntimeError(\"Can only call find() from top level of foldermap\") from exc\n\n        try:\n            param_names: List[str] = data_names_to_params[data_name]\n        except KeyError as exc:\n            raise ValueError(f\"No datasets with data name: '{data_name}'\") from exc\n\n        curr: List[Tuple[Description, Union[FolderMapView, DataPath]]] = [\n            (Description(()), self[data_name])\n        ]\n        todo: List[Tuple[Description, Union[FolderMapView, DataPath]]] = []\n        done: List[Tuple[Description, DataPath]] = []\n\n        for param_name in param_names:\n            param_arg = params.get(param_name, missing_default)\n\n            while curr:\n                curr_description, curr_level = curr.pop()\n\n                if param_arg == ParamArg.FULL:\n                    next_params = curr_level\n                elif param_arg == ParamArg.DEFAULT:\n                    default = curr_level.get_default_key()\n                    if default is None:\n                        raise ValueError(f\"No default available for parameter '{param_name}'\")\n                    next_params = (default,)\n                elif isinstance(param_arg, str):\n                    next_params = (param_arg,)\n                else:\n                    next_params = param_arg\n\n                for next_param in next_params:\n                    try:\n                        fmap_next = curr_level[next_param]\n                    except KeyError:\n                        continue\n\n                    todo.append(\n                        (\n                            Description((*curr_description.items(), (param_name, next_param))),\n                            fmap_next,\n                        )\n                    )\n\n            if len(todo) == 0:\n                # None of the parameters matched\n                param_arg_repr = (\n                    repr([param_arg])\n                    if isinstance(param_arg, (str, ParamArg))\n                    else repr(list(param_arg))\n                )\n                raise ValueError(\n                    f\"{param_name} value(s) {param_arg_repr} are not available. Available values are: {list(curr_level)}\"\n                )\n\n            curr, todo = todo, curr\n\n        done.extend(curr)\n\n        return done\n\n    def __getitem__(\n        self, __key: Union[str, Literal[ParamArg.DEFAULT]]\n    ) -> Union[\"FolderMapView\", DataPath]:\n        \"\"\"Gets the item with key. If key is ``ParamArg.DEFAULT``, return the\n        item under the default parameter, or raise a ``ValueError`` if no\n        default exists.\"\"\"\n        if __key in self.__PRIVATE_KEYS:\n            raise KeyError(__key)\n\n        if __key == ParamArg.DEFAULT:\n            default = self.get_default_key()\n            if default is None:\n                raise ValueError(\"No default available\")\n            return self[default]\n\n        elem = self.__curr_level[__key]\n        if isinstance(elem, Mapping):\n            return FolderMapView(elem)\n\n        return DataPath(elem)\n\n    def __iter__(self) -> typing.Iterator[str]:\n        return (key for key in self.__curr_level.keys() if key not in self.__PRIVATE_KEYS)\n\n    def keys(self) -> typing.FrozenSet[str]:\n        return frozenset(iter(self))\n\n    def __len__(self) -> int:\n        return sum(1 for _ in self.__iter__())\n\n    def __repr__(self) -> str:\n        return repr(dict(self))\n\n    def __str__(self) -> str:\n        return str(dict(self))\n", "path": "pennylane/data/data_manager/foldermap.py"}]}