iqm-exa-common 26.20.0__py3-none-any.whl → 26.21.0__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.
@@ -68,7 +68,7 @@ class ServiceUnavailableError(StationControlError):
68
68
  """Error raised when the service is unavailable."""
69
69
 
70
70
 
71
- ERROR_TO_STATUS_CODE_MAPPING = {
71
+ _ERROR_TO_STATUS_CODE_MAPPING = {
72
72
  BadRequestError: HTTPStatus.BAD_REQUEST, # 400
73
73
  UnauthorizedError: HTTPStatus.UNAUTHORIZED, # 401
74
74
  ForbiddenError: HTTPStatus.FORBIDDEN, # 403
@@ -79,4 +79,14 @@ ERROR_TO_STATUS_CODE_MAPPING = {
79
79
  ServiceUnavailableError: HTTPStatus.SERVICE_UNAVAILABLE, # 503
80
80
  }
81
81
 
82
- STATUS_CODE_TO_ERROR_MAPPING = {value: key for key, value in ERROR_TO_STATUS_CODE_MAPPING.items()}
82
+ _STATUS_CODE_TO_ERROR_MAPPING = {value: key for key, value in _ERROR_TO_STATUS_CODE_MAPPING.items()}
83
+
84
+
85
+ def map_from_error_to_status_code(error: StationControlError) -> HTTPStatus:
86
+ """Map a StationControlError to an HTTPStatus code."""
87
+ return _ERROR_TO_STATUS_CODE_MAPPING.get(type(error), HTTPStatus.INTERNAL_SERVER_ERROR)
88
+
89
+
90
+ def map_from_status_code_to_error(status_code: HTTPStatus) -> StationControlError:
91
+ """Map an HTTPStatus code to a StationControlError."""
92
+ return _STATUS_CODE_TO_ERROR_MAPPING.get(status_code, InternalServerError)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-exa-common
3
- Version: 26.20.0
3
+ Version: 26.21.0
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
@@ -31,7 +31,7 @@ exa/common/data/settingnode_v2.html.jinja2,sha256=mo-rlLLmU-Xxf6znJAisispAZK8sbV
31
31
  exa/common/data/value.py,sha256=mtMws5UPGx1pCADK6Q2Tx4BwCXznvVRSNQRfcQ3NMmY,1853
32
32
  exa/common/errors/__init__.py,sha256=ArMBdpmx1EUenBpzrSNG63kmUf7PM0gCqSYnaCnL9Qk,597
33
33
  exa/common/errors/exa_error.py,sha256=iw8ueZgqx1JXkfjRoJfPUsSE7cfhzIWpdDaFuka9Ss0,990
34
- exa/common/errors/server_errors.py,sha256=IP6Zc5blT5jwQCQAUJkZ3IQiWrvbWvZSykZjDZEis_c,3077
34
+ exa/common/errors/server_errors.py,sha256=Ir460DVR0g7d9wbKM6uMA1zrxC-a7MLUuW0JpQ2O8J0,3533
35
35
  exa/common/helpers/__init__.py,sha256=IgtVD3tojIFA4MTV2mT5uYM6jb2qny9kBIIhEZT2PuI,610
36
36
  exa/common/helpers/data_helper.py,sha256=qg-RBCGGP947IbZAoFQ0oQrmp2EgzCSgh6kinX2MD9A,1903
37
37
  exa/common/helpers/deprecation.py,sha256=nY8484iun63JOBfBeh49Q6VD5xZ4_gT9fjPmH1RAXoI,397
@@ -50,8 +50,8 @@ exa/common/qcm_data/qcm_data_client.py,sha256=0clAbZ3HPBH9lFOe8cVmaq8hPHG5m3pyPG
50
50
  exa/common/sweep/__init__.py,sha256=uEKk5AtzSgSnf8Y0geRPwUpqXIBIXpeCxsN64sX7F1o,591
51
51
  exa/common/sweep/database_serialization.py,sha256=NUu1umxRQZpKtRmw1vNDsSbnofqbHvKFg_xQ2mdhY6k,7469
52
52
  exa/common/sweep/util.py,sha256=-QE2AaH-WDkYAVH5-Z-30leLgY0x4efmby4kc1JTCgY,3732
53
- iqm_exa_common-26.20.0.dist-info/LICENSE.txt,sha256=R6Q7eUrLyoCQgWYorQ8WJmVmWKYU3dxA3jYUp0wwQAw,11332
54
- iqm_exa_common-26.20.0.dist-info/METADATA,sha256=TN5g3AnUeiWzY663x024Z2nW4_qNzuPJZlO3KAvDKwU,14628
55
- iqm_exa_common-26.20.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
56
- iqm_exa_common-26.20.0.dist-info/top_level.txt,sha256=Clphg2toaZ3_jSFRPhjMNEmLurkMNMc4lkK2EFYsSlM,4
57
- iqm_exa_common-26.20.0.dist-info/RECORD,,
53
+ iqm_exa_common-26.21.0.dist-info/LICENSE.txt,sha256=R6Q7eUrLyoCQgWYorQ8WJmVmWKYU3dxA3jYUp0wwQAw,11332
54
+ iqm_exa_common-26.21.0.dist-info/METADATA,sha256=eSrsYP6qM-ZO_GzG17CkxRp_YG3xLnjq3peVp2M6hlA,14628
55
+ iqm_exa_common-26.21.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
56
+ iqm_exa_common-26.21.0.dist-info/top_level.txt,sha256=Clphg2toaZ3_jSFRPhjMNEmLurkMNMc4lkK2EFYsSlM,4
57
+ iqm_exa_common-26.21.0.dist-info/RECORD,,