ophyd-async 0.3a6__py3-none-any.whl → 0.3rc2__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
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.3a6'
15
+ __version__ = version = '0.3rc2'
16
16
  __version_tuple__ = version_tuple = (0, 3)
@@ -24,12 +24,10 @@ from .device_save_loader import (
24
24
  walk_rw_signals,
25
25
  )
26
26
  from .flyer import HardwareTriggeredFlyable, TriggerLogic
27
- from .mock_signal_backend import (
28
- MockSignalBackend,
29
- )
27
+ from .mock_signal_backend import MockSignalBackend
30
28
  from .mock_signal_utils import (
31
- assert_mock_put_called_with,
32
29
  callback_on_mock_put,
30
+ get_mock_put,
33
31
  mock_puts_blocked,
34
32
  reset_mock_put_calls,
35
33
  set_mock_put_proceeds,
@@ -70,7 +68,7 @@ from .utils import (
70
68
  )
71
69
 
72
70
  __all__ = [
73
- "assert_mock_put_called_with",
71
+ "get_mock_put",
74
72
  "callback_on_mock_put",
75
73
  "mock_puts_blocked",
76
74
  "set_mock_values",
@@ -1,6 +1,6 @@
1
1
  import asyncio
2
2
  from functools import cached_property
3
- from typing import Optional, Type
3
+ from typing import Callable, Optional, Type
4
4
  from unittest.mock import Mock
5
5
 
6
6
  from bluesky.protocols import Descriptor, Reading
@@ -10,7 +10,7 @@ from ophyd_async.core.soft_signal_backend import SoftSignalBackend
10
10
  from ophyd_async.core.utils import DEFAULT_TIMEOUT, ReadingValueCallback, T
11
11
 
12
12
 
13
- class MockSignalBackend(SignalBackend):
13
+ class MockSignalBackend(SignalBackend[T]):
14
14
  def __init__(
15
15
  self,
16
16
  datatype: Optional[Type[T]] = None,
@@ -31,11 +31,11 @@ class MockSignalBackend(SignalBackend):
31
31
 
32
32
  if not isinstance(self.initial_backend, SoftSignalBackend):
33
33
  # If the backend is a hard signal backend, or not provided,
34
- # then we create a soft signal to mimick it
34
+ # then we create a soft signal to mimic it
35
35
 
36
36
  self.soft_backend = SoftSignalBackend(datatype=datatype)
37
37
  else:
38
- self.soft_backend = initial_backend
38
+ self.soft_backend = self.initial_backend
39
39
 
40
40
  def source(self, name: str) -> str:
41
41
  if self.initial_backend:
@@ -47,7 +47,7 @@ class MockSignalBackend(SignalBackend):
47
47
 
48
48
  @cached_property
49
49
  def put_mock(self) -> Mock:
50
- return Mock(name="put")
50
+ return Mock(name="put", spec=Callable)
51
51
 
52
52
  @cached_property
53
53
  def put_proceeds(self) -> asyncio.Event:
@@ -65,9 +65,6 @@ class MockSignalBackend(SignalBackend):
65
65
  def set_value(self, value: T):
66
66
  self.soft_backend.set_value(value)
67
67
 
68
- async def get_descriptor(self, source: str) -> Descriptor:
69
- return await self.soft_backend.get_descriptor(source)
70
-
71
68
  async def get_reading(self) -> Reading:
72
69
  return await self.soft_backend.get_reading()
73
70
 
@@ -1,6 +1,6 @@
1
1
  from contextlib import asynccontextmanager, contextmanager
2
- from typing import Any, Callable, Iterable, Iterator, List
3
- from unittest.mock import ANY, Mock
2
+ from typing import Any, Callable, Iterable
3
+ from unittest.mock import Mock
4
4
 
5
5
  from ophyd_async.core.signal import Signal
6
6
  from ophyd_async.core.utils import T
@@ -22,7 +22,7 @@ def set_mock_value(signal: Signal[T], value: T):
22
22
  backend.set_value(value)
23
23
 
24
24
 
25
- def set_mock_put_proceeds(signal: Signal[T], proceeds: bool):
25
+ def set_mock_put_proceeds(signal: Signal, proceeds: bool):
26
26
  """Allow or block a put with wait=True from proceeding"""
27
27
  backend = _get_mock_signal_backend(signal)
28
28
 
@@ -33,7 +33,7 @@ def set_mock_put_proceeds(signal: Signal[T], proceeds: bool):
33
33
 
34
34
 
35
35
  @asynccontextmanager
36
- async def mock_puts_blocked(*signals: List[Signal]):
36
+ async def mock_puts_blocked(*signals: Signal):
37
37
  for signal in signals:
38
38
  set_mock_put_proceeds(signal, False)
39
39
  yield
@@ -41,9 +41,9 @@ async def mock_puts_blocked(*signals: List[Signal]):
41
41
  set_mock_put_proceeds(signal, True)
42
42
 
43
43
 
44
- def assert_mock_put_called_with(signal: Signal, value: Any, wait=ANY, timeout=ANY):
45
- backend = _get_mock_signal_backend(signal)
46
- backend.put_mock.assert_called_with(value, wait=wait, timeout=timeout)
44
+ def get_mock_put(signal: Signal) -> Mock:
45
+ """Get the mock associated with the put call on the signal."""
46
+ return _get_mock_signal_backend(signal).put_mock
47
47
 
48
48
 
49
49
  def reset_mock_put_calls(signal: Signal):
@@ -79,7 +79,7 @@ class _SetValuesIterator:
79
79
  return next_value
80
80
 
81
81
  def __del__(self):
82
- if self.require_all_consumed and self.index != len(self.values):
82
+ if self.require_all_consumed and self.index != len(list(self.values)):
83
83
  raise AssertionError("Not all values have been consumed.")
84
84
 
85
85
 
@@ -87,7 +87,7 @@ def set_mock_values(
87
87
  signal: Signal,
88
88
  values: Iterable[Any],
89
89
  require_all_consumed: bool = False,
90
- ) -> Iterator[Any]:
90
+ ) -> _SetValuesIterator:
91
91
  """Iterator to set a signal to a sequence of values, optionally repeating the
92
92
  sequence.
93
93
 
@@ -127,7 +127,7 @@ def _unset_side_effect_cm(put_mock: Mock):
127
127
  put_mock.side_effect = None
128
128
 
129
129
 
130
- def callback_on_mock_put(signal: Signal, callback: Callable[[T], None]):
130
+ def callback_on_mock_put(signal: Signal[T], callback: Callable[[T], None]):
131
131
  """For setting a callback when a backend is put to.
132
132
 
133
133
  Can either be used in a context, with the callback being
@@ -14,7 +14,7 @@ class SignalBackend(Generic[T]):
14
14
 
15
15
  #: Like ca://PV_PREFIX:SIGNAL
16
16
  @abstractmethod
17
- def source(name: str) -> str:
17
+ def source(self, name: str) -> str:
18
18
  """Return source of signal. Signals may pass a name to the backend, which can be
19
19
  used or discarded."""
20
20
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ophyd-async
3
- Version: 0.3a6
3
+ Version: 0.3rc2
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,19 +1,19 @@
1
1
  ophyd_async/__init__.py,sha256=v-rRiDOgZ3sQSMQKq0vgUQZvpeOkoHFXissAx6Ktg84,61
2
2
  ophyd_async/__main__.py,sha256=G-Zcv_G9zK7Nhx6o5L5w-wyhMxdl_WgyMELu8IMFqAE,328
3
- ophyd_async/_version.py,sha256=LuF-BqHYcrns31aIHwEtbxWREi37LwJcIxVOaUpUzgM,408
3
+ ophyd_async/_version.py,sha256=Q6NCoABIZDCaoLXsuU8odM9VJngCLNAvP46RIhMvPN0,409
4
4
  ophyd_async/log.py,sha256=DbMjt0bkfUOLHIinZYt0Q0FHZmCXXi5x8y0uFiEmqoQ,3587
5
5
  ophyd_async/protocols.py,sha256=EF2W9nfElV-0QNMYrX1zusL1PqDJR3kNsjlalR29j0I,3412
6
- ophyd_async/core/__init__.py,sha256=wF90GU1BHjCzVVgBtUDHoogCIx6XNXq050wth9YPzVo,2991
6
+ ophyd_async/core/__init__.py,sha256=znjVeRfrDVJbGLEkUczeKMW46kV6HDrlE4lV0SqvZt4,2952
7
7
  ophyd_async/core/_providers.py,sha256=LrlTMPHKXWOPVkpAOw-pqBq0kip-c3C9ZZPoFfiaV4M,2212
8
8
  ophyd_async/core/async_status.py,sha256=9TOgOXIAuH62RDo5t-Y5GdjrJ76d_6TFlBxYv-5_a88,4367
9
9
  ophyd_async/core/detector.py,sha256=8mdLKphirgit5CVCklJI9eHqKKiCz4CYs9BElo10-lc,11007
10
10
  ophyd_async/core/device.py,sha256=280zFnLCoiMZAA-Dh1_AjUSnhxUfKYGgj4H_2S1njOA,7086
11
11
  ophyd_async/core/device_save_loader.py,sha256=RXA3dPUPihAR2ZGDStlGiA-TAsr_xqL0snsCjMsMnfA,9138
12
12
  ophyd_async/core/flyer.py,sha256=bIjzBkrl8HVAlKgsZ_FF0WL69Qvksyzp9ZWmTLl8Yrw,2304
13
- ophyd_async/core/mock_signal_backend.py,sha256=13BAbQG1OPC3o_fOFFQH4x1mPYLQ8Zf53WviRPXWDTM,2938
14
- ophyd_async/core/mock_signal_utils.py,sha256=TgVV3D6i7ItXRiy98H1Ov8dKZhiop_9CdTaRjiH5cwQ,4143
13
+ ophyd_async/core/mock_signal_backend.py,sha256=Ug6jK72wm9vM6EueoUrYgcXtiFzdPUEISRe86LdyYKc,2844
14
+ ophyd_async/core/mock_signal_utils.py,sha256=bF8MVZA1j9zCmS2tBbgUdfwNmcHniHixnmotjd0g7hs,4083
15
15
  ophyd_async/core/signal.py,sha256=FbTb5qDPLhVxEbh6gimqXfkZwcqB4ymHTEYVXZVZYrk,16456
16
- ophyd_async/core/signal_backend.py,sha256=qDdWz8X4CWStuYknxcj4G76BLq4TzrAIyZO1NOEq9ao,1519
16
+ ophyd_async/core/signal_backend.py,sha256=fT3q0WED3JHmNKYCs7PzDLCK4cUPVin3wQjDNPdHqAY,1525
17
17
  ophyd_async/core/soft_signal_backend.py,sha256=56zvcEi4c8n1yYbafTbp7X0VhSkhoehm3L8RBhu2fik,5596
18
18
  ophyd_async/core/standard_readable.py,sha256=uVG3vs3s7-Kzg5dRCtT4I2mhZPqwVGYy2dxNmaOpDVU,8980
19
19
  ophyd_async/core/utils.py,sha256=3oZcXNqAUHX4ZWMBH5gSuK6cFWEhSkZ9GSDYv0pf8jc,5783
@@ -78,9 +78,9 @@ ophyd_async/sim/sim_pattern_detector_writer.py,sha256=ESpcVyHd1TP7Cojznv2hJAwLin
78
78
  ophyd_async/sim/sim_pattern_generator.py,sha256=fbcwWxTPYKLK33OzIY15vGylnonOO8HIudz1y_56GZU,1336
79
79
  ophyd_async/sim/demo/__init__.py,sha256=9mxKpslrL89cfSj4g3og8Br3O--pMj3hhWZS-Xu6kyA,56
80
80
  ophyd_async/sim/demo/sim_motor.py,sha256=a2p5wnHXjF-V5zOFai7jnszk4kbGmrZRnUqBtkOgEfQ,3733
81
- ophyd_async-0.3a6.dist-info/LICENSE,sha256=pU5shZcsvWgz701EbT7yjFZ8rMvZcWgRH54CRt8ld_c,1517
82
- ophyd_async-0.3a6.dist-info/METADATA,sha256=oFejS6nfk0zaWbJASTeSieIQnPMjC1mvkIFaUrmH1MQ,6284
83
- ophyd_async-0.3a6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
84
- ophyd_async-0.3a6.dist-info/entry_points.txt,sha256=O0YNJTEufO0w9BozXi-JurTy2U1_o0ypeCgJLQ727Jk,58
85
- ophyd_async-0.3a6.dist-info/top_level.txt,sha256=-hjorMsv5Rmjo3qrgqhjpal1N6kW5vMxZO3lD4iEaXs,12
86
- ophyd_async-0.3a6.dist-info/RECORD,,
81
+ ophyd_async-0.3rc2.dist-info/LICENSE,sha256=pU5shZcsvWgz701EbT7yjFZ8rMvZcWgRH54CRt8ld_c,1517
82
+ ophyd_async-0.3rc2.dist-info/METADATA,sha256=TRb7FrOHb4YrISGe-fkGY_W3kkrnBvioFJsgErNLmo8,6285
83
+ ophyd_async-0.3rc2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
84
+ ophyd_async-0.3rc2.dist-info/entry_points.txt,sha256=O0YNJTEufO0w9BozXi-JurTy2U1_o0ypeCgJLQ727Jk,58
85
+ ophyd_async-0.3rc2.dist-info/top_level.txt,sha256=-hjorMsv5Rmjo3qrgqhjpal1N6kW5vMxZO3lD4iEaXs,12
86
+ ophyd_async-0.3rc2.dist-info/RECORD,,