Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up adapter in the scan_nd plan #1728

Open
noemifrisina opened this issue Apr 18, 2024 · 0 comments
Open

Tidy up adapter in the scan_nd plan #1728

noemifrisina opened this issue Apr 18, 2024 · 0 comments

Comments

@noemifrisina
Copy link

Current Behavior

In the scan_nd plan, it is not obvious how the adapter function works when _verify_1d_step is True.
It appears to be redefining per_step to be usable for the 1d case since the signatures of the one_nd_step and one_1d_step are slightly different. However the arguments passed to the adapter do not match the ones passed to user_per_step when doing this operation.

            user_per_step = per_step

            def adapter(detectors, step, pos_cache):
                # one_nd_step 'step' parameter is a dict; one_id_step 'step'
                # parameter is a value
                (step,) = step.values()
                return (yield from user_per_step(detectors, motor, step))

            per_step = adapter  # type: ignore

Context

The issue came up while adding type hints to plans in #1712 , which showed a mismatch between the signatures of expression and variable:

src/bluesky/plans.py:1148: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, Any], Any]", variable has type "Callable[[Sequence[Readable], Movable, Any, Callable[[Sequence[Readable]], Generator[Msg, Any, Mapping[str, Reading]]] | None], Generator[Msg, Any, Any]] | Callable[[Sequence[Readable], Mapping[Movable, Any], dict[Movable, Any], Callable[[Sequence[Readable]], Generator[Msg, Any, Mapping[str, Reading]]] | None], Generator[Msg, Any, Any]] | None")  [assignment]

Temporary workaround was to #type: ignore it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant