Skip to content

Commit

Permalink
Defer implementation of MsgGenerator to prevent strange behaviour (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph authored Oct 10, 2024
1 parent e2b2705 commit 799cae1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
9 changes: 2 additions & 7 deletions src/dodal/common/types.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from abc import ABC, abstractmethod
from collections.abc import Callable, Generator
from typing import (
Any,
)
from collections.abc import Callable

from bluesky.utils import Msg
from bluesky.utils import MsgGenerator
from ophyd_async.core import PathProvider

# String identifier used by 'wait' or stubs that await
Group = str
# A true 'plan', usually the output of a generator function
MsgGenerator = Generator[Msg, Any, None]
# A function that generates a plan
PlanGenerator = Callable[..., MsgGenerator]

Expand Down
4 changes: 2 additions & 2 deletions src/dodal/plans/data_session_metadata.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from bluesky import plan_stubs as bps
from bluesky import preprocessors as bpp
from bluesky.utils import make_decorator
from bluesky.utils import MsgGenerator, make_decorator

from dodal.common.beamlines import beamline_utils
from dodal.common.types import MsgGenerator, UpdatingPathProvider
from dodal.common.types import UpdatingPathProvider

DATA_SESSION = "data_session"
DATA_GROUPS = "data_groups"
Expand Down
3 changes: 1 addition & 2 deletions src/dodal/plans/motor_util_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

from bluesky import plan_stubs as bps
from bluesky.preprocessors import finalize_wrapper, pchain
from bluesky.utils import Msg, make_decorator
from bluesky.utils import Msg, MsgGenerator, make_decorator
from ophyd_async.core import Device
from ophyd_async.epics.motor import Motor

from dodal.common import MsgGenerator
from dodal.utils import MovableReadable

MovableReadableDevice = TypeVar("MovableReadableDevice", bound=MovableReadable)
Expand Down
2 changes: 1 addition & 1 deletion tests/common/test_coordination.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import pytest
from bluesky.protocols import Movable
from bluesky.utils import MsgGenerator

from dodal.common.coordination import group_uuid, inject
from dodal.common.types import MsgGenerator

static_uuid = "51aef931-33b4-4b33-b7ad-a8287f541202"

Expand Down
3 changes: 2 additions & 1 deletion tests/preprocessors/test_filesystem_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
)
from bluesky.protocols import HasName, Readable, Reading, Triggerable
from bluesky.run_engine import RunEngine
from bluesky.utils import MsgGenerator
from event_model.documents.event_descriptor import DataKey
from ophyd_async.core import AsyncStatus, DeviceCollector, PathProvider
from pydantic import BaseModel

from dodal.common.types import MsgGenerator, UpdatingPathProvider
from dodal.common.types import UpdatingPathProvider
from dodal.common.visit import (
DataCollectionIdentifier,
DirectoryServiceClient,
Expand Down

0 comments on commit 799cae1

Please sign in to comment.