Skip to content

Commit

Permalink
Move inject method for type checked default arguments from blueapi
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph committed Oct 20, 2023
1 parent d7674d2 commit efba33e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/dls_bluesky_core/core/coordination.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,21 @@ def group_uuid(name: str) -> str:
readable_uid (str): name appended with a unique string
"""
return f"{name}-{str(uuid.uuid4())[:6]}"


def inject(name: str):
"""
Function to mark a default argument of a plan method as a reference to a device
that is stored in the Blueapi context.
Bypasses mypy linting, returning x as Any and therefore valid as a default
argument.
Args:
name (str): Name of a device to be fetched from the Blueapi context
Returns:
Any: name but without typing checking, valid as any default type
"""

return name

Check warning on line 32 in src/dls_bluesky_core/core/coordination.py

View check run for this annotation

Codecov / codecov/patch

src/dls_bluesky_core/core/coordination.py#L32

Added line #L32 was not covered by tests

0 comments on commit efba33e

Please sign in to comment.