11from __future__ import annotations
22
33import os
4- from collections .abc import Iterator , Mapping , Sequence
5- from typing import Any , Generic
4+ from collections .abc import Iterator , Sequence
5+ from typing import TYPE_CHECKING , Any , Generic
66
77import numpy as np
88
9- from .parameter_base import InstrumentTypeVar_co , ParameterBase , ParameterDataTypeVar
9+ from .parameter_base import (
10+ InstrumentTypeVar_co ,
11+ ParameterBase ,
12+ ParameterBaseKWArgs ,
13+ ParameterDataTypeVar ,
14+ )
1015from .sequence_helpers import is_sequence_of
1116
17+ if TYPE_CHECKING :
18+ from typing_extensions import Unpack
19+
1220try :
1321 from qcodes_loop .data .data_array import DataArray
1422
@@ -84,9 +92,6 @@ class MultiParameter(
8492 each item. Scalars should be denoted by (), 1D arrays as (n,),
8593 2D arrays as (n, m), etc.
8694
87- instrument: The instrument this parameter
88- belongs to, if any.
89-
9095 labels: A label for each item. Normally used
9196 as the axis label when a component is graphed, along with the
9297 matching entry from ``units``.
@@ -119,20 +124,10 @@ class MultiParameter(
119124 field of the object. The ``__doc__`` field of the instance is
120125 used by some help systems, but not all
121126
122- snapshot_get: Prevent any update to the parameter, for example
123- if it takes too long to update. Default ``True``.
124-
125- snapshot_value: Should the value of the parameter be stored in the
126- snapshot. Unlike Parameter this defaults to False as
127- MultiParameters are potentially huge.
128-
129- snapshot_exclude: True prevents parameter to be
130- included in the snapshot. Useful if there are many of the same
131- parameter which are clogging up the snapshot.
132- Default ``False``.
133-
134- metadata: Extra information to include with the
135- JSON snapshot of the parameter.
127+ **kwargs: Forwarded to the ``ParameterBase`` base class.
128+ Note that ``snapshot_value`` defaults to ``False`` for
129+ ``MultiParameter``. See :class:`ParameterBaseKWArgs` for
130+ details.
136131
137132 """
138133
@@ -142,29 +137,20 @@ def __init__(
142137 * ,
143138 names : Sequence [str ],
144139 shapes : Sequence [Sequence [int ]],
145- # mypy seems to be confused here. The bound and default for InstrumentTypeVar_co
146- # contains None but mypy will not allow it as a default as of v 1.19.0
147- instrument : InstrumentTypeVar_co = None , # type: ignore[assignment]
148140 labels : Sequence [str ] | None = None ,
149141 units : Sequence [str ] | None = None ,
150142 setpoints : Sequence [Sequence [Any ]] | None = None ,
151143 setpoint_names : Sequence [Sequence [str ]] | None = None ,
152144 setpoint_labels : Sequence [Sequence [str ]] | None = None ,
153145 setpoint_units : Sequence [Sequence [str ]] | None = None ,
154146 docstring : str | None = None ,
155- snapshot_get : bool = True ,
156- snapshot_value : bool = False ,
157- snapshot_exclude : bool = False ,
158- metadata : Mapping [Any , Any ] | None = None ,
159- ** kwargs : Any ,
147+ ** kwargs : Unpack [
148+ ParameterBaseKWArgs [ParameterDataTypeVar , InstrumentTypeVar_co ]
149+ ],
160150 ) -> None :
151+ kwargs .setdefault ("snapshot_value" , False )
161152 super ().__init__ (
162153 name ,
163- instrument = instrument ,
164- snapshot_get = snapshot_get ,
165- metadata = metadata ,
166- snapshot_value = snapshot_value ,
167- snapshot_exclude = snapshot_exclude ,
168154 ** kwargs ,
169155 )
170156
0 commit comments