iqm-exa-common 26.11__py3-none-any.whl → 26.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ # ********************************************************************************
2
+ # _____ ____ _
3
+ # / _ \ \/ / _` | Framework for control
4
+ # | __/> < (_| | and measurement of
5
+ # \___/_/\_\__,_| superconducting qubits
6
+ #
7
+ # Copyright (c) 2019-2025 IQM Finland Oy.
8
+ # All rights reserved. Confidential and proprietary.
9
+ #
10
+ # Distribution or reproduction of any information contained herein
11
+ # is prohibited without IQM Finland Oy’s prior written permission.
12
+ # ********************************************************************************
13
+ """YAML utilities."""
14
+
15
+ import logging
16
+ from pathlib import Path
17
+ from typing import Any
18
+
19
+ from ruamel.yaml import YAML, YAMLError
20
+
21
+ logger = logging.getLogger(__name__)
22
+ yaml = YAML(typ="safe", pure=True)
23
+
24
+
25
+ def load_yaml(path: Path | str) -> dict[str, Any]:
26
+ """Load a YAML file from the given path and raise error if the file can't be loaded."""
27
+ path = path if isinstance(path, Path) else Path(path)
28
+ with path.open(encoding="utf-8") as file:
29
+ try:
30
+ data = yaml.load(file)
31
+ except YAMLError as err:
32
+ raise ValueError(f"Failed to load YAML file from {path}.") from err
33
+ logger.debug("Loaded a YAML file from %s.", path)
34
+ return data
35
+
36
+
37
+ def dump_yaml(data: dict[str, Any], path: Path | str) -> None:
38
+ """Dump a YAML data to the given path. Create missing directories if necessary."""
39
+ path = path if isinstance(path, Path) else Path(path)
40
+ path.parent.mkdir(parents=True, exist_ok=True)
41
+ with path.open("w", encoding="utf-8") as file:
42
+ yaml.dump(data, file)
43
+ logger.debug("Saved a YAML file to %s.", path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-exa-common
3
- Version: 26.11
3
+ Version: 26.13
4
4
  Summary: Framework for control and measurement of superconducting qubits: common library
5
5
  Author-email: IQM Finland Oy <info@meetiqm.com>
6
6
  License: Apache License
@@ -219,6 +219,8 @@ Requires-Dist: pydantic <3.0,>=2.10.4
219
219
  Requires-Dist: python-dotenv ==0.21.1
220
220
  Requires-Dist: xarray ==2024.10.0
221
221
  Requires-Dist: requests ==2.32.3
222
+ Requires-Dist: ruamel-yaml ==0.17.32
223
+ Requires-Dist: ruamel-yaml-clib ==0.2.8
222
224
 
223
225
  EXA-common
224
226
  ==========
@@ -38,6 +38,7 @@ exa/common/helpers/deprecation.py,sha256=nY8484iun63JOBfBeh49Q6VD5xZ4_gT9fjPmH1R
38
38
  exa/common/helpers/json_helper.py,sha256=LoTrL6FREML1o0X3Zznf1baI4kn0kh03NE1nqBHgYss,2699
39
39
  exa/common/helpers/numpy_helper.py,sha256=KKKyZ_fD0O1gn7_InEQROYnX3WGMA6C1qHh8KzzjtUI,1062
40
40
  exa/common/helpers/software_version_helper.py,sha256=9vczRJFktNycbvB6FbbLDP8ejkRrmkg_-0S46tUfbyQ,5131
41
+ exa/common/helpers/yaml_helper.py,sha256=wLy-7Nyit597FoWBemduUilYP2VCk_aDDT8y62i3ox8,1626
41
42
  exa/common/logger/__init__.py,sha256=1bIsGxHzfujXlkgtcAnWToKMkw3dpU5PEd_7LE_NpgQ,686
42
43
  exa/common/logger/logger.py,sha256=0aSjkx4pXy_CCKtspOnFgwMmhZVFAZUlopQ6HUjBMko,5689
43
44
  exa/common/qcm_data/__init__.py,sha256=VtsYkGoaniSjCkY0oQlqkcYJCtmC2sTDxfrIe_kpqZg,567
@@ -49,8 +50,8 @@ exa/common/qcm_data/qcm_data_client.py,sha256=0clAbZ3HPBH9lFOe8cVmaq8hPHG5m3pyPG
49
50
  exa/common/sweep/__init__.py,sha256=uEKk5AtzSgSnf8Y0geRPwUpqXIBIXpeCxsN64sX7F1o,591
50
51
  exa/common/sweep/database_serialization.py,sha256=NUu1umxRQZpKtRmw1vNDsSbnofqbHvKFg_xQ2mdhY6k,7469
51
52
  exa/common/sweep/util.py,sha256=-QE2AaH-WDkYAVH5-Z-30leLgY0x4efmby4kc1JTCgY,3732
52
- iqm_exa_common-26.11.dist-info/LICENSE.txt,sha256=R6Q7eUrLyoCQgWYorQ8WJmVmWKYU3dxA3jYUp0wwQAw,11332
53
- iqm_exa_common-26.11.dist-info/METADATA,sha256=ZBi19GWCpltp8bTk67J0FPgR3sOY_nGkMg4ysspskYg,14549
54
- iqm_exa_common-26.11.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
55
- iqm_exa_common-26.11.dist-info/top_level.txt,sha256=Clphg2toaZ3_jSFRPhjMNEmLurkMNMc4lkK2EFYsSlM,4
56
- iqm_exa_common-26.11.dist-info/RECORD,,
53
+ iqm_exa_common-26.13.dist-info/LICENSE.txt,sha256=R6Q7eUrLyoCQgWYorQ8WJmVmWKYU3dxA3jYUp0wwQAw,11332
54
+ iqm_exa_common-26.13.dist-info/METADATA,sha256=JHDeI1Uyh9idEn1Cs399HXy0S-bkNCRYKyBg-AsVwYM,14626
55
+ iqm_exa_common-26.13.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
56
+ iqm_exa_common-26.13.dist-info/top_level.txt,sha256=Clphg2toaZ3_jSFRPhjMNEmLurkMNMc4lkK2EFYsSlM,4
57
+ iqm_exa_common-26.13.dist-info/RECORD,,