Commit 5e6004fa authored by Matias Guijarro's avatar Matias Guijarro
Browse files

Merge branch 'clean-up-scannable-type' into 'master'

Remove _scannable, use Scannable

Closes #2421

See merge request !3671
parents a282edf9 aaaac29b
Pipeline #46178 failed with stages
in 105 minutes and 41 seconds
......@@ -24,10 +24,10 @@ from bliss.scanning.scan import Scan, StepScanDataWatch
from bliss.scanning.acquisition.motor import MeshStepTriggerMaster
from bliss.scanning.scan_info import ScanInfo
from .step_by_step import DEFAULT_CHAIN
from bliss.common.protocols import Scannable
from bliss.common.types import (
_int,
_float,
_scannable,
_countables,
_scannable_start_stop_intervals_list,
)
......@@ -203,11 +203,11 @@ def anmesh(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def amesh(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
intervals1: _int,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
intervals2: _int,
......@@ -268,11 +268,11 @@ def amesh(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def dmesh(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
intervals1: _int,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
intervals2: _int,
......@@ -336,15 +336,15 @@ def dmesh(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def a3mesh(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
intervals1: _int,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
intervals2: _int,
motor3: _scannable,
motor3: Scannable,
start3: _float,
stop3: _float,
intervals3: _int,
......@@ -410,15 +410,15 @@ def a3mesh(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def d3mesh(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
intervals1: _int,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
intervals2: _int,
motor3: _scannable,
motor3: Scannable,
start3: _float,
stop3: _float,
intervals3: _int,
......
......@@ -43,12 +43,12 @@ from bliss.scanning.toolbox import DefaultAcquisitionChain
from bliss.scanning.scan import Scan, StepScanDataWatch
from bliss.scanning.acquisition.motor import VariableStepTriggerMaster
from bliss.scanning.scan_info import ScanInfo
from bliss.common.protocols import Scannable
from bliss.common.types import (
_int,
_float,
_countable,
_countables,
_scannable,
_scannable_start_stop_list,
_position_list,
_scannable_position_list,
......@@ -63,7 +63,7 @@ DEFAULT_CHAIN = DefaultAcquisitionChain()
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def ascan(
motor: _scannable,
motor: Scannable,
start: _float,
stop: _float,
intervals: _int,
......@@ -128,7 +128,7 @@ def ascan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def dscan(
motor: _scannable,
motor: Scannable,
start: _float,
stop: _float,
intervals: _int,
......@@ -196,7 +196,7 @@ def dscan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def lineup(
motor: _scannable,
motor: Scannable,
start: _float,
stop: _float,
intervals: _int,
......@@ -241,10 +241,10 @@ def lineup(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def a2scan(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
intervals: _int,
......@@ -616,13 +616,13 @@ def dnscan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def a3scan(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
motor3: _scannable,
motor3: Scannable,
start3: _float,
stop3: _float,
intervals: _int,
......@@ -661,16 +661,16 @@ def a3scan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def a4scan(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
motor3: _scannable,
motor3: Scannable,
start3: _float,
stop3: _float,
motor4: _scannable,
motor4: Scannable,
start4: _float,
stop4: _float,
intervals: _int,
......@@ -715,19 +715,19 @@ def a4scan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def a5scan(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
motor3: _scannable,
motor3: Scannable,
start3: _float,
stop3: _float,
motor4: _scannable,
motor4: Scannable,
start4: _float,
stop4: _float,
motor5: _scannable,
motor5: Scannable,
start5: _float,
stop5: _float,
intervals: _int,
......@@ -772,13 +772,13 @@ def a5scan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def d3scan(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
motor3: _scannable,
motor3: Scannable,
start3: _float,
stop3: _float,
intervals: _int,
......@@ -817,16 +817,16 @@ def d3scan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def d4scan(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
motor3: _scannable,
motor3: Scannable,
start3: _float,
stop3: _float,
motor4: _scannable,
motor4: Scannable,
start4: _float,
stop4: _float,
intervals: _int,
......@@ -870,19 +870,19 @@ def d4scan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def d5scan(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
motor3: _scannable,
motor3: Scannable,
start3: _float,
stop3: _float,
motor4: _scannable,
motor4: Scannable,
start4: _float,
stop4: _float,
motor5: _scannable,
motor5: Scannable,
start5: _float,
stop5: _float,
intervals: _int,
......@@ -927,10 +927,10 @@ def d5scan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def d2scan(
motor1: _scannable,
motor1: Scannable,
start1: _float,
stop1: _float,
motor2: _scannable,
motor2: Scannable,
start2: _float,
stop2: _float,
intervals: _int,
......@@ -1142,7 +1142,7 @@ def loopscan(
@shorten_signature(hidden_kwargs=["title", "name", "scan_type", "return_scan"])
@typeguard.typechecked
def pointscan(
motor: _scannable,
motor: Scannable,
positions: _position_list,
count_time: _float,
*counter_args: _countables,
......
......@@ -22,12 +22,11 @@ _countables = Union[
_float_or_countables = Union[
numbers.Real, IterableNamespace, Counter, MeasurementGroup, CounterContainer, Tuple
]
_scannable = Scannable
_scannable_or_name = Union[_scannable, str]
_scannable_start_stop_list = Sequence[Tuple[_scannable, _float, _float]]
_scannable_start_stop_intervals_list = Sequence[Tuple[_scannable, _float, _float, _int]]
_scannable_or_name = Union[Scannable, str]
_scannable_start_stop_list = Sequence[Tuple[Scannable, _float, _float]]
_scannable_start_stop_intervals_list = Sequence[Tuple[Scannable, _float, _float, _int]]
_position_list = Union[Sequence, numpy.ndarray]
_scannable_position_list = Sequence[Tuple[_scannable, _position_list]]
_scannable_position_list = Sequence[Tuple[Scannable, _position_list]]
_providing_channel = Union[None, _scannable, Counter, str]
_providing_channel = Union[None, Scannable, Counter, str]
"""Used by plotselect"""
......@@ -948,7 +948,7 @@ def typecheck_var_args_pattern(args_pattern, empty_var_pos_args_allowed=False):
.. code-block::
@typecheck_var_args_pattern([_scannable,_float])
@typecheck_var_args_pattern([Scannable,_float])
def umv(*args):
...
"""
......
......@@ -3,7 +3,8 @@ import typeguard
from typing import Optional, Callable, Any
from bliss.data.scan import get_counter_names
from bliss import current_session, global_map
from bliss.common.types import _countable, _scannable
from bliss.common.protocols import Scannable
from bliss.common.types import _countable
from bliss.common.plot import display_motor
from bliss.scanning.scan import Scan
from bliss.scanning.scan_display import ScanDisplay
......@@ -150,7 +151,7 @@ def _scan_calc(func, counter=None, axis=None, scan=None, marker=True, goto=False
@shorten_signature(hidden_kwargs=[])
def fwhm(
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
"""
......@@ -166,7 +167,7 @@ def fwhm(
@shorten_signature(hidden_kwargs=[])
def cen(
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
"""
......@@ -183,7 +184,7 @@ def cen(
def find_position(
func: Callable[[Any, Any], float],
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
return _scan_calc(func, counter=counter, axis=axis, scan=scan)
......@@ -193,7 +194,7 @@ def find_position(
@shorten_signature(hidden_kwargs=[])
def goto_cen(
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
"""
......@@ -210,7 +211,7 @@ def goto_cen(
@shorten_signature(hidden_kwargs=[])
def com(
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
"""
......@@ -226,7 +227,7 @@ def com(
@shorten_signature(hidden_kwargs=[])
def goto_com(
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
"""
......@@ -243,7 +244,7 @@ def goto_com(
@shorten_signature(hidden_kwargs=[])
def peak(
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
"""
......@@ -259,7 +260,7 @@ def peak(
@shorten_signature(hidden_kwargs=[])
def goto_peak(
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
"""
......@@ -276,7 +277,7 @@ def goto_peak(
@shorten_signature(hidden_kwargs=[])
def trough(
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
"""
......@@ -292,7 +293,7 @@ def trough(
@shorten_signature(hidden_kwargs=[])
def goto_min(
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
"""
......@@ -310,7 +311,7 @@ def goto_min(
def goto_custom(
func: Callable[[Any, Any], float],
counter: Optional[_countable] = None,
axis: Optional[_scannable] = None,
axis: Optional[Scannable] = None,
scan: Optional[Scan] = None,
):
return _scan_calc(func, counter=counter, axis=axis, scan=scan, goto=True)
......
......@@ -106,9 +106,9 @@ import tabulate
from bliss.common.utils import typeguardTypeError_to_hint
from typing import Optional, Union
from bliss.controllers.lima.lima_base import Lima
from bliss.common.protocols import Scannable
from bliss.common.types import (
_countable,
_scannable,
_scannable_or_name,
_float,
_providing_channel,
......@@ -789,7 +789,7 @@ def wm(*axes: _scannable_or_name, **kwargs):
display_original_msg=False,
)
@modify_annotations({"args": "motor1, pos1, motor2, pos2, ..."})
@typecheck_var_args_pattern([_scannable, _float])
@typecheck_var_args_pattern([Scannable, _float])
def umv(*args):
"""
Move given axes to given absolute positions providing updated display of
......@@ -807,7 +807,7 @@ def umv(*args):
display_original_msg=False,
)
@modify_annotations({"args": "motor1, rel. pos1, motor2, rel. pos2, ..."})
@typecheck_var_args_pattern([_scannable, _float])
@typecheck_var_args_pattern([Scannable, _float])
def umvr(*args):
"""
Move given axes to given relative positions providing updated display of
......@@ -825,7 +825,7 @@ def umvr(*args):
display_original_msg=False,
)
@modify_annotations({"args": "motor1, pos1, motor2, pos2, ..."})
@typecheck_var_args_pattern([_scannable, _float])
@typecheck_var_args_pattern([Scannable, _float])
def umvd(*args):
"""
Move given axes to given absolute dial positions providing updated display of
......@@ -843,7 +843,7 @@ def umvd(*args):
display_original_msg=False,
)
@modify_annotations({"args": "motor1, rel. pos1, motor2, rel. pos2, ..."})
@typecheck_var_args_pattern([_scannable, _float])
@typecheck_var_args_pattern([Scannable, _float])
def umvdr(*args):
"""
Move given axes to given relative dial positions providing updated display of
......
from bliss.common.types import _scannable
from bliss.common.protocols import Scannable
import typeguard
def test_scannable_type(default_session):
@typeguard.typechecked
def func_with_scannable(axis: _scannable):
def func_with_scannable(axis: Scannable):
return True
bad = default_session.config.get("bad")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment