ophyd-async 0.10.0a1__py3-none-any.whl → 0.10.0a2__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.
ophyd_async/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.10.0a1'
20
+ __version__ = version = '0.10.0a2'
21
21
  __version_tuple__ = version_tuple = (0, 10, 0)
@@ -173,7 +173,7 @@ def _make_factory(
173
173
 
174
174
  # Update the signature for raw_to_derived to match what we are passed as this
175
175
  # will be checked in DerivedSignalFactory
176
- DerivedTransform.raw_to_derived.__annotations__ = raw_to_derived.__annotations__
176
+ DerivedTransform.raw_to_derived.__annotations__ = get_type_hints(raw_to_derived)
177
177
 
178
178
  return DerivedSignalFactory(
179
179
  DerivedTransform, set_derived=set_derived, **(raw_devices or {})
@@ -93,18 +93,19 @@ class Table(BaseModel):
93
93
 
94
94
  def __add__(self, right: TableSubclass) -> TableSubclass:
95
95
  """Concatenate the arrays in field values."""
96
- if type(right) is not type(self):
96
+ cls = type(right)
97
+ if type(self) is not cls:
97
98
  raise RuntimeError(
98
99
  f"{right} is not a `Table`, or is not the same "
99
100
  f"type of `Table` as {self}."
100
101
  )
101
102
 
102
- return type(right)(
103
+ return cls(
103
104
  **{
104
105
  field_name: _concat(
105
106
  getattr(self, field_name), getattr(right, field_name)
106
107
  )
107
- for field_name in self.model_fields
108
+ for field_name in cls.model_fields
108
109
  }
109
110
  )
110
111
 
@@ -1,6 +1,7 @@
1
1
  import asyncio
2
+ from collections.abc import Mapping
2
3
  from contextlib import AbstractContextManager
3
- from typing import Any
4
+ from typing import Any, cast
4
5
  from unittest.mock import Mock, call
5
6
 
6
7
  import pytest
@@ -43,7 +44,7 @@ async def assert_value(signal: SignalR[SignalDatatypeT], value: Any) -> None:
43
44
 
44
45
  async def assert_reading(
45
46
  readable: AsyncReadable,
46
- expected_reading: dict[str, dict[str, Any]],
47
+ expected_reading: Mapping[str, Mapping[str, Any]],
47
48
  ) -> None:
48
49
  """Assert that a readable Device has the given reading.
49
50
 
@@ -54,20 +55,25 @@ async def assert_reading(
54
55
  _assert_readings_approx_equal(expected_reading, actual_reading)
55
56
 
56
57
 
57
- def _assert_readings_approx_equal(expected, actual):
58
- assert expected.keys() == actual.keys()
59
- approx_expected_reading = {
60
- k: dict(
61
- v,
62
- value=approx_value(v["value"]),
63
- timestamp=pytest.approx(v["timestamp"], rel=0.1)
64
- if "timestamp" in v
65
- else actual[k]["timestamp"],
66
- alarm_severity=v.get("alarm_severity", actual[k]["alarm_severity"]),
67
- )
68
- for k, v in expected.items()
58
+ def _approx_reading(expected: Mapping[str, Any], actual: Reading) -> Reading:
59
+ ret = dict(
60
+ expected,
61
+ value=approx_value(expected["value"]),
62
+ timestamp=pytest.approx(expected["timestamp"], rel=0.1)
63
+ if "timestamp" in expected
64
+ else actual["timestamp"],
65
+ )
66
+ if "alarm_severity" in actual and "alarm_severity" not in expected:
67
+ ret["alarm_severity"] = actual["alarm_severity"]
68
+ return cast(Reading, ret)
69
+
70
+
71
+ def _assert_readings_approx_equal(
72
+ expected: Mapping[str, Mapping[str, Any]], actual: Mapping[str, Reading]
73
+ ):
74
+ assert actual == {
75
+ k: _approx_reading(v, actual[k]) for k, v in expected.items() if k in actual
69
76
  }
70
- assert actual == approx_expected_reading
71
77
 
72
78
 
73
79
  async def assert_configuration(
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import asyncio
2
4
 
3
5
  from ophyd_async.core import (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ophyd-async
3
- Version: 0.10.0a1
3
+ Version: 0.10.0a2
4
4
  Summary: Asynchronous Bluesky hardware abstraction code, compatible with control systems like EPICS and Tango
5
5
  Author-email: Tom Cobb <tom.cobb@diamond.ac.uk>
6
6
  License: BSD 3-Clause License
@@ -1,10 +1,10 @@
1
1
  ophyd_async/__init__.py,sha256=dcAA3qsj1nNIMe5l-v2tlduZ_ypwBmyuHe45Lsq4k4w,206
2
2
  ophyd_async/__main__.py,sha256=n_U4O9bgm97OuboUB_9eK7eFiwy8BZSgXJ0OzbE0DqU,481
3
3
  ophyd_async/_docs_parser.py,sha256=gPYrigfSbYCF7QoSf2UvE-cpQu4snSssl7ZWN-kKDzI,352
4
- ophyd_async/_version.py,sha256=AdcjN4kVO4q5oA5MXB74BCO4OC6Vbb8sWbQTVnx9yt4,515
4
+ ophyd_async/_version.py,sha256=vwU_BgU9ApXpWH564vijXNOtjK-ww1iSaNC4uWmoIT4,515
5
5
  ophyd_async/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  ophyd_async/core/__init__.py,sha256=eFRVN5WJQKNcZbFtP8abDcra6d_mwFLA0A60AbXL2Vw,4484
7
- ophyd_async/core/_derived_signal.py,sha256=UKhqC6RYJ7iAqUvAXwECofm_J4_uyWvTXrikK2Svn0U,10404
7
+ ophyd_async/core/_derived_signal.py,sha256=DS2-t_N8WOGjZjzt-0xRHaWIr3VzKFyV-WiRKRxf7ks,10404
8
8
  ophyd_async/core/_derived_signal_backend.py,sha256=5_J9AfRPueJZ-CEgpE7GSG9B1nHUFzanD0N2D1mrGrY,12216
9
9
  ophyd_async/core/_detector.py,sha256=J5Chu4sI9WgupB_3qh1c7ZOtlv9tSMJ3tXkHnsc9WIw,14517
10
10
  ophyd_async/core/_device.py,sha256=UjpKuGvwCYN0-I0qpdWzBI9uLSLieHryDsLf_9Qeu-Y,14593
@@ -21,7 +21,7 @@ ophyd_async/core/_signal.py,sha256=kqIvQXRP3n34-uhgTmbwm2fTIz_phJYyTT4Rm7P-gSs,2
21
21
  ophyd_async/core/_signal_backend.py,sha256=T8vJi-QuMfjB_uBB6iu_aApAY0j5pAFkDn5g2oSCbmI,6826
22
22
  ophyd_async/core/_soft_signal_backend.py,sha256=zrE7H2ojHY6oQBucLkFgukszrkdvbIZuavLjEUqc_xM,6227
23
23
  ophyd_async/core/_status.py,sha256=h4TtWFM7wFtpxxyAYYSITgcVzArYZdYBHbya6qIX5t0,6553
24
- ophyd_async/core/_table.py,sha256=46pR9CxNGA5E5-h-vpb2OT5tfaUXfZRSayKhDJHacs4,6888
24
+ ophyd_async/core/_table.py,sha256=l5GzL3La68ZkXpcOOVntnYr8ofFV8kWGr1hzY1ek83w,6897
25
25
  ophyd_async/core/_utils.py,sha256=zEA3lLeOP0N17XGUH8irxvEW8hq0slkxY4gJV3f4YzE,11382
26
26
  ophyd_async/core/_yaml_settings.py,sha256=txy4_Igbsr8Yo132yv8jnCcsLpal8klM7DcPNow2KBs,2078
27
27
  ophyd_async/epics/__init__.py,sha256=ou4yEaH9VZHz70e8oM614-arLMQvUfQyXhRJsnEpWn8,60
@@ -136,14 +136,14 @@ ophyd_async/tango/testing/__init__.py,sha256=SYXPAS00ny3jlUMOJKpaewO4ljPjK1_z1sm
136
136
  ophyd_async/tango/testing/_one_of_everything.py,sha256=rPAgOoNGvaHMVhB79Gz70NI9tWk3QV5iKg5wAlAtqxU,6571
137
137
  ophyd_async/testing/__init__.py,sha256=f53HUj2hpIfrza9OlcOpHmq5wnziQNwixawAK4F1xgc,1698
138
138
  ophyd_async/testing/__pytest_assert_rewrite.py,sha256=_SU2UfChPgEf7CFY7aYH2B7MLp-07_qYnVLyu6QtDL8,129
139
- ophyd_async/testing/_assert.py,sha256=sBa2KnNzP01dWDHPKbujIiQk1bw1nTjUyRJKnVPH8Q0,7439
139
+ ophyd_async/testing/_assert.py,sha256=FrMgMfo-ABq_cMT-hJmoaTxhAY4TwAvGe4ae1SF1rME,7657
140
140
  ophyd_async/testing/_mock_signal_utils.py,sha256=d-n_923ii59-ae9TbqVuIK9MAJpDmu0k47fzgJLj8t8,5195
141
141
  ophyd_async/testing/_one_of_everything.py,sha256=Di0hPoKwrDOSsx50-2UdSHM2EbIKrPG9s0Vp11nE9V8,4773
142
- ophyd_async/testing/_single_derived.py,sha256=icuTFUSaNf_9dZQ37Nt4VHUUERlFdqObhq8S4URdBCo,2694
142
+ ophyd_async/testing/_single_derived.py,sha256=5-HOTzgePcZ354NK_ssVpyIbJoJmKyjVQCxSwQXUC-4,2730
143
143
  ophyd_async/testing/_utils.py,sha256=zClRo5ve8RGia7wQnby41W-Zprj-slOA5da1LfYnuhw,45
144
144
  ophyd_async/testing/_wait_for_pending.py,sha256=YZAR48n-CW0GsPey3zFRzMJ4byDAr3HvMIoawjmTrHw,732
145
- ophyd_async-0.10.0a1.dist-info/licenses/LICENSE,sha256=pU5shZcsvWgz701EbT7yjFZ8rMvZcWgRH54CRt8ld_c,1517
146
- ophyd_async-0.10.0a1.dist-info/METADATA,sha256=8nZ_nv3FefQVDkrlIo6ilDFx8ijbY9tAD6PDvoLAtjE,7075
147
- ophyd_async-0.10.0a1.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
148
- ophyd_async-0.10.0a1.dist-info/top_level.txt,sha256=-hjorMsv5Rmjo3qrgqhjpal1N6kW5vMxZO3lD4iEaXs,12
149
- ophyd_async-0.10.0a1.dist-info/RECORD,,
145
+ ophyd_async-0.10.0a2.dist-info/licenses/LICENSE,sha256=pU5shZcsvWgz701EbT7yjFZ8rMvZcWgRH54CRt8ld_c,1517
146
+ ophyd_async-0.10.0a2.dist-info/METADATA,sha256=HhNyZ27Piz8QHIz_DzFZnRD_ZJ5oCRRxfEGY5YF9WlU,7075
147
+ ophyd_async-0.10.0a2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
148
+ ophyd_async-0.10.0a2.dist-info/top_level.txt,sha256=-hjorMsv5Rmjo3qrgqhjpal1N6kW5vMxZO3lD4iEaXs,12
149
+ ophyd_async-0.10.0a2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.0.2)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5