Skip to content

Commit

Permalink
Revert "Add deprecation warning to inject (#854)"
Browse files Browse the repository at this point in the history
This reverts commit 0f8989e.
  • Loading branch information
DiamondJoseph committed Oct 25, 2024
1 parent 374dd83 commit 11a8faf
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 73 deletions.
37 changes: 0 additions & 37 deletions docs/how-to/include-devices-in-plans.md

This file was deleted.

20 changes: 0 additions & 20 deletions src/dodal/common/coordination.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import uuid
import warnings
from textwrap import dedent
from typing import Any

from dodal.common.types import Group
Expand Down Expand Up @@ -39,22 +37,4 @@ def scan(x: Movable = inject("stage_x"), start: float = 0.0 ...)
"""

warnings.warn(
dedent("""
Inject is deprecated, users are now expected to call the device factory
functions in dodal directly, these will cache devices as singletons after
they have been called once. For example:
from bluesky.protocols import Readable
from bluesky.utils import MsgGenerator
from dodal.beamlines import i22
def my_plan(detector: Readable = i22.saxs(connect_immediately=False)) -> MsgGenerator:
...
Where previously the default would have been inject("saxs")
"""),
DeprecationWarning,
stacklevel=2,
)
return name
16 changes: 0 additions & 16 deletions tests/common/test_coordination.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ def test_group_uid(group: str):
assert not gid.endswith(f"{group}-")


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_inject_returns_value():
assert inject("foo") == "foo"


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_type_checking_ignores_inject():
def example_function(x: Movable = inject("foo")) -> MsgGenerator: # noqa: B008
yield from {}
Expand All @@ -31,13 +25,3 @@ def example_function(x: Movable = inject("foo")) -> MsgGenerator: # noqa: B008
x: Parameter = signature(example_function).parameters["x"]
assert x.annotation == Movable
assert x.default == "foo"


def test_inject_is_deprecated():
with pytest.raises(
DeprecationWarning,
match="Inject is deprecated, users are now expected to call the device factory",
):

def example_function(x: Movable = inject("foo")) -> MsgGenerator: # noqa: B008
yield from {}

0 comments on commit 11a8faf

Please sign in to comment.