iqm-exa-common 26.21.0__py3-none-any.whl → 26.23.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.
@@ -71,7 +71,7 @@ import xarray as xr
71
71
  from exa.common.control.sweep.sweep_values import SweepValues
72
72
  from exa.common.data.base_model import BaseModel
73
73
  from exa.common.data.value import ObservationValue
74
- from exa.common.errors.server_errors import ValidationError
74
+ from exa.common.errors.station_control_errors import ValidationError
75
75
 
76
76
  CastType = str | list["CastType"] | None
77
77
 
@@ -11,7 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
- """Errors used in the client-server communication."""
14
+ """Errors used in the station control client-server communication."""
15
15
 
16
16
  from http import HTTPStatus
17
17
 
@@ -19,11 +19,11 @@ from exa.common.errors.exa_error import ExaError
19
19
 
20
20
 
21
21
  class StationControlError(ExaError):
22
- """Base class for station control errors used in client-server communication."""
22
+ """Base class for station control errors."""
23
23
 
24
24
  # TODO: StationControlError shouldn't need to inherit ExaError
25
25
  # Some clients might still expect ExaErrors, thus inheriting here to avoid issues because of that.
26
- # Ideally, we would keep server errors (raised by station control) and any client side errors separately.
26
+ # Ideally, we would keep server errors (raised by station control) and any client side errors separate.
27
27
 
28
28
 
29
29
  class BadRequestError(StationControlError):
@@ -64,10 +64,18 @@ class InternalServerError(StationControlError):
64
64
  """
65
65
 
66
66
 
67
+ class BadGatewayError(StationControlError):
68
+ """Error raised when there are invalid responses from another server/proxy."""
69
+
70
+
67
71
  class ServiceUnavailableError(StationControlError):
68
72
  """Error raised when the service is unavailable."""
69
73
 
70
74
 
75
+ class GatewayTimeoutError(StationControlError):
76
+ """Error raised when the gateway server did not receive a timely response."""
77
+
78
+
71
79
  _ERROR_TO_STATUS_CODE_MAPPING = {
72
80
  BadRequestError: HTTPStatus.BAD_REQUEST, # 400
73
81
  UnauthorizedError: HTTPStatus.UNAUTHORIZED, # 401
@@ -76,7 +84,9 @@ _ERROR_TO_STATUS_CODE_MAPPING = {
76
84
  ConflictError: HTTPStatus.CONFLICT, # 409
77
85
  ValidationError: HTTPStatus.UNPROCESSABLE_ENTITY, # 422
78
86
  InternalServerError: HTTPStatus.INTERNAL_SERVER_ERROR, # 500
87
+ BadGatewayError: HTTPStatus.BAD_GATEWAY, # 502
79
88
  ServiceUnavailableError: HTTPStatus.SERVICE_UNAVAILABLE, # 503
89
+ GatewayTimeoutError: HTTPStatus.GATEWAY_TIMEOUT, # 504
80
90
  }
81
91
 
82
92
  _STATUS_CODE_TO_ERROR_MAPPING = {value: key for key, value in _ERROR_TO_STATUS_CODE_MAPPING.items()}
@@ -84,9 +94,15 @@ _STATUS_CODE_TO_ERROR_MAPPING = {value: key for key, value in _ERROR_TO_STATUS_C
84
94
 
85
95
  def map_from_error_to_status_code(error: StationControlError) -> HTTPStatus:
86
96
  """Map a StationControlError to an HTTPStatus code."""
87
- return _ERROR_TO_STATUS_CODE_MAPPING.get(type(error), HTTPStatus.INTERNAL_SERVER_ERROR)
97
+ direct_mapping = _ERROR_TO_STATUS_CODE_MAPPING.get(type(error))
98
+ if direct_mapping is not None:
99
+ return direct_mapping
100
+ for error_type, status_code in _ERROR_TO_STATUS_CODE_MAPPING.items():
101
+ if isinstance(error, error_type):
102
+ return status_code
103
+ return HTTPStatus.INTERNAL_SERVER_ERROR
88
104
 
89
105
 
90
- def map_from_status_code_to_error(status_code: HTTPStatus) -> StationControlError:
106
+ def map_from_status_code_to_error(status_code: HTTPStatus) -> type[StationControlError]:
91
107
  """Map an HTTPStatus code to a StationControlError."""
92
108
  return _STATUS_CODE_TO_ERROR_MAPPING.get(status_code, InternalServerError)
@@ -25,7 +25,7 @@ from packaging.version import Version
25
25
  import requests
26
26
 
27
27
  from exa.common.errors.exa_error import ExaError
28
- from exa.common.errors.server_errors import NotFoundError, ValidationError
28
+ from exa.common.errors.station_control_errors import NotFoundError, ValidationError
29
29
  from exa.common.qcm_data.file_adapter import FileAdapter
30
30
 
31
31
  MIN_SUPPORTED_CONTENT_FORMAT_VERSION = Version("1.0")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-exa-common
3
- Version: 26.21.0
3
+ Version: 26.23.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
@@ -213,7 +213,7 @@ Classifier: Intended Audience :: Science/Research
213
213
  Requires-Python: >=3.11
214
214
  Description-Content-Type: text/x-rst
215
215
  License-File: LICENSE.txt
216
- Requires-Dist: iqm-data-definitions <3.0,>=2.6
216
+ Requires-Dist: iqm-data-definitions <3.0,>=2.13
217
217
  Requires-Dist: numpy <3.0,>=1.26.4
218
218
  Requires-Dist: pydantic <3.0,>=2.10.4
219
219
  Requires-Dist: python-dotenv ==0.21.1
@@ -25,13 +25,13 @@ exa/common/control/sweep/option/start_stop_options.py,sha256=HaQFNlhRPep2yrn_LuO
25
25
  exa/common/control/sweep/option/sweep_options.py,sha256=BhKB7RHP0VXJ9iUQKVzeQOM4j_x9AsMhRJgoR3gkiaY,933
26
26
  exa/common/data/__init__.py,sha256=F5SRe5QHBTjef4XJVQ63kO5Oxc_AiZnPbV560i7La0Y,644
27
27
  exa/common/data/base_model.py,sha256=Zap09R91zHY3iYtfO-SqxfKdewCf3q5FNi1uefTtSfQ,1796
28
- exa/common/data/parameter.py,sha256=OTlBPtuMkiHNozIVzsgUn5wOg3cvaXUcqVpTOHyN12c,23193
28
+ exa/common/data/parameter.py,sha256=h-IJOY5v12bZq_PmprpqgNpvGS3lrTf3-FjgWHtcBP4,23202
29
29
  exa/common/data/setting_node.py,sha256=6Sqim4PkD9mL-9sVwokTxQQIrDZhzhld-VSp8L3HH0w,43232
30
30
  exa/common/data/settingnode_v2.html.jinja2,sha256=mo-rlLLmU-Xxf6znJAisispAZK8sbV-2C13byKAtj_Q,3166
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=Ir460DVR0g7d9wbKM6uMA1zrxC-a7MLUuW0JpQ2O8J0,3533
34
+ exa/common/errors/station_control_errors.py,sha256=NEVW9QC-jJM36CQ8b9IIg9hZv5Utph9LXirxk5ZiuNM,4122
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
@@ -46,12 +46,12 @@ exa/common/qcm_data/chad_model.py,sha256=kQFCwr7ToONvXySCCrc-_nZDyXJxgYIjtw-IpNw
46
46
  exa/common/qcm_data/chip_topology.py,sha256=Q9S7NlSzKwN2gEk6vPKuqYpjcFLJocqe7BTEtMGaod0,19990
47
47
  exa/common/qcm_data/file_adapter.py,sha256=U1XZm_PEswkW7kAztbWFLMufz4mPKPupWbh5yJXdZCI,2263
48
48
  exa/common/qcm_data/immutable_base_model.py,sha256=QXmKIWQbsbWQvovXwKT1d9jtyf2LNJtjQquIwO52zOU,901
49
- exa/common/qcm_data/qcm_data_client.py,sha256=0clAbZ3HPBH9lFOe8cVmaq8hPHG5m3pyPG4O6EI97Kk,6022
49
+ exa/common/qcm_data/qcm_data_client.py,sha256=v8gW-nAYxCdVEO4Uncl3DwH85D67Gi2n2aEpUR0vuqY,6031
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.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,,
53
+ iqm_exa_common-26.23.0.dist-info/LICENSE.txt,sha256=R6Q7eUrLyoCQgWYorQ8WJmVmWKYU3dxA3jYUp0wwQAw,11332
54
+ iqm_exa_common-26.23.0.dist-info/METADATA,sha256=A_U9ew0QZxte2FokRXml1Vll5dY1Kd1B-gxp9FWesUU,14629
55
+ iqm_exa_common-26.23.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
56
+ iqm_exa_common-26.23.0.dist-info/top_level.txt,sha256=Clphg2toaZ3_jSFRPhjMNEmLurkMNMc4lkK2EFYsSlM,4
57
+ iqm_exa_common-26.23.0.dist-info/RECORD,,