Skip to content

Commit

Permalink
Localise usage of T to each module
Browse files Browse the repository at this point in the history
  • Loading branch information
coretl committed Jan 29, 2025
1 parent 9045e03 commit e5e9df0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/ophyd_async/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The building blocks for making devices."""
from typing import TYPE_CHECKING

from ._detector import (
DetectorController,
Expand Down Expand Up @@ -72,7 +73,6 @@
Reference,
StrictEnum,
SubsetEnum,
T,
WatcherUpdate,
gather_dict,
get_dtype,
Expand Down Expand Up @@ -170,7 +170,6 @@
"NotConnected",
"Reference",
"Table",
"T",
"WatcherUpdate",
"gather_dict",
"get_dtype",
Expand Down
4 changes: 2 additions & 2 deletions src/ophyd_async/core/_signal_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from event_model import DataKey, Dtype, Limits

from ._table import Table
from ._utils import Callback, StrictEnum, T
from ._utils import Callback, StrictEnum

DTypeScalar_co = TypeVar("DTypeScalar_co", covariant=True, bound=np.generic)
# To be a 1D array shape should really be tuple[int], but np.array()
Expand Down Expand Up @@ -82,7 +82,7 @@ async def get_setpoint(self) -> SignalDatatypeT:
"""The point that a signal was requested to move to."""

@abstractmethod
def set_callback(self, callback: Callback[T] | None) -> None:
def set_callback(self, callback: Callback[Reading[SignalDatatypeT]] | None) -> None:
"""Observe changes to the current value, timestamp and severity"""


Expand Down
2 changes: 1 addition & 1 deletion src/ophyd_async/plan_stubs/_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
Settings,
SettingsProvider,
SignalRW,
T,
walk_rw_signals,
)
from ophyd_async.core._table import Table

from ._utils import T
from ._wait_for_awaitable import wait_for_awaitable


Expand Down
3 changes: 3 additions & 0 deletions src/ophyd_async/plan_stubs/_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from typing import TypeVar

T = TypeVar("T")
2 changes: 1 addition & 1 deletion src/ophyd_async/plan_stubs/_wait_for_awaitable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import bluesky.plan_stubs as bps
from bluesky.utils import MsgGenerator, plan

from ophyd_async.core import T
from ._utils import T


@plan
Expand Down
5 changes: 3 additions & 2 deletions src/ophyd_async/testing/_assert.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
AsyncReadable,
SignalDatatypeT,
SignalR,
T,
Table,
WatchableAsyncStatus,
Watcher,
)
from ophyd_async.core._status import WatchableAsyncStatus

from ._utils import T


def approx_value(value: Any):
Expand Down
3 changes: 3 additions & 0 deletions src/ophyd_async/testing/_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from typing import TypeVar

T = TypeVar("T")

0 comments on commit e5e9df0

Please sign in to comment.