Datasets:
Download src/verifyit/json_objects.py from open-athena/Structure-Closure-BFCL-v6: direct link, hf CLI and curl.
- Browser
- Download file 396 Bytes
-
https://huggingface.co/datasets/open-athena/Structure-Closure-BFCL-v6/resolve/main/src/verifyit/json_objects.py
- Command line
-
hf download hf://datasets/open-athena/Structure-Closure-BFCL-v6/src/verifyit/json_objects.py
-
curl -L -o json_objects.py https://huggingface.co/datasets/open-athena/Structure-Closure-BFCL-v6/resolve/main/src/verifyit/json_objects.py
396 Bytes
| # Copyright The Marin Authors | |
| # SPDX-License-Identifier: Apache-2.0 | |
| """Reject ambiguous duplicate keys while decoding trusted JSON objects.""" | |
| def unique_object(pairs: list[tuple[str, object]]) -> dict[str, object]: | |
| result = {} | |
| for key, value in pairs: | |
| if key in result: | |
| raise ValueError(f"duplicate JSON key {key!r}") | |
| result[key] = value | |
| return result | |