Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/changes/newsfragments/7972.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``qcodes.instrument.mockers.ami430.MockAMI430`` has been deprecated. This class is unused
within QCoDeS and is not expected to be used externally.
26 changes: 17 additions & 9 deletions src/qcodes/instrument/mockers/ami430.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
from datetime import datetime
from typing import ClassVar

from typing_extensions import deprecated

from qcodes.utils import QCoDeSDeprecationWarning


@deprecated(
"This class is unused in qcodes and will be removed in a future version. It is unused and no longer maintained.",
category=QCoDeSDeprecationWarning,
)
class MockAMI430:
states: ClassVar[dict[str, str]] = {
"RAMPING to target field/current": "1",
Expand All @@ -30,16 +38,16 @@ def __init__(self, name):

self._field_mag = 0
self._field_target = 0
self._state = MockAMI430.states["HOLDING at the target field/current"]
self._state = MockAMI430.states["HOLDING at the target field/current"] # pyright: ignore[reportDeprecated]

self.handlers = {
"RAMP:RATE:UNITS": {"get": MockAMI430.ramp_rate_units["A/s"], "set": None},
"FIELD:UNITS": {"get": MockAMI430.field_units["tesla"], "set": None},
"RAMP:RATE:UNITS": {"get": MockAMI430.ramp_rate_units["A/s"], "set": None}, # pyright: ignore[reportDeprecated]
"FIELD:UNITS": {"get": MockAMI430.field_units["tesla"], "set": None}, # pyright: ignore[reportDeprecated]
"*IDN": {"get": "v0.1 Mock", "set": None},
"STATE": {"get": self._getter("_state"), "set": self._setter("_state")},
"FIELD:MAG": {"get": self._getter("_field_mag"), "set": None},
"QU": {
"get": MockAMI430.quench_state[
"get": MockAMI430.quench_state[ # pyright: ignore[reportDeprecated]
False
], # We are never in a quenching state so always return the
# same value
Expand Down Expand Up @@ -155,7 +163,7 @@ def _handle_messages(self, msg):

# Find which handler is suitable to handle the message
for key in self.handlers:
match, args = MockAMI430.message_parser(gs, msg, key)
match, args = MockAMI430.message_parser(gs, msg, key) # pyright: ignore[reportDeprecated]
if not match:
continue

Expand All @@ -175,17 +183,17 @@ def _handle_messages(self, msg):
return rval

def _do_pause(self, _):
self._state = MockAMI430.states["PAUSED"]
self._state = MockAMI430.states["PAUSED"] # pyright: ignore[reportDeprecated]

def _is_paused(self):
return self._state == MockAMI430.states["PAUSED"]
return self._state == MockAMI430.states["PAUSED"] # pyright: ignore[reportDeprecated]

def _do_ramp(self, _):
self._log(f"Ramping to {self._field_target}")
self._state = MockAMI430.states["RAMPING to target field/current"]
self._state = MockAMI430.states["RAMPING to target field/current"] # pyright: ignore[reportDeprecated]
time.sleep(0.1) # Lets pretend to be ramping for a bit
self._field_mag = self._field_target
self._state = MockAMI430.states["HOLDING at the target field/current"]
self._state = MockAMI430.states["HOLDING at the target field/current"] # pyright: ignore[reportDeprecated]

def get_log_messages(self):
return self.log_messages
Expand Down
Loading