Skip to content

Commit

Permalink
Adapt to implicit optional being disabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Nov 8, 2022
1 parent 34c5855 commit c915d00
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pandas as pd
import numpy as np
from datetime import date
from typing import Optional
from qcodes.instrument.base import Instrument

class BlueFors(Instrument):
Expand All @@ -25,7 +26,7 @@ def __init__(self, name : str,
channel_4k_plate : int,
channel_still : int,
channel_mixing_chamber : int,
channel_magnet : int=None,
channel_magnet : Optional[int] = None,
**kwargs) -> None:
"""
QCoDeS driver for BlueFors fridges.
Expand Down
6 changes: 3 additions & 3 deletions qcodes_contrib_drivers/drivers/ERAInstruments/erasynth.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,15 +610,15 @@ def _get_json(self, cmd: str, first_key: str) -> str:

# ERASynth specific methods

def get_configuration(self, par_name: str = None) -> Union[Dict[str, str], str]:
def get_configuration(self, par_name: Optional[str] = None) -> Union[Dict[str, str], str]:
"""
Returns the configuration JSON that contains all parameters.
"""
config_json = json.loads(self._get_json("RA", "rfoutput"))

return config_json if par_name is None else config_json[par_name]

def get_diagnostic_status(self, par_name: str = None) -> Union[Dict[str, str], str]:
def get_diagnostic_status(self, par_name: Optional[str] = None) -> Union[Dict[str, str], str]:
"""
Returns the diagnostic JSON.
"""
Expand Down Expand Up @@ -682,7 +682,7 @@ def run_self_test(self) -> None:
# set commands
# ##################################################################################

def _set_and_confirm(self, cmd: str, cmd_arg: str, str_back: str = None) -> None:
def _set_and_confirm(self, cmd: str, cmd_arg: str, str_back: Optional[str] = None) -> None:
"""
Because for this command the instrument replies with a text containing the
value, we make use of it to ensure we waited enough time for the changes to
Expand Down
2 changes: 1 addition & 1 deletion qcodes_contrib_drivers/drivers/Thorlabs/APT.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def apt_init(self) -> None:
code = self.dll.APTInit()
self.error_check(code, 'APTInit')

def list_available_devices(self, hw_type: Union[int, ThorlabsHWType] = None) \
def list_available_devices(self, hw_type: Union[int, ThorlabsHWType, None] = None) \
-> List[Tuple[int, int, int]]:
"""Lists all available Thorlabs devices, that can connect to the APT server.
Expand Down
8 changes: 4 additions & 4 deletions qcodes_contrib_drivers/drivers/Thorlabs/K10CR1.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import enum
from typing import Tuple
from typing import Tuple, Optional

import qcodes.utils.validators as vals
from qcodes import Instrument
Expand Down Expand Up @@ -169,7 +169,7 @@ def _get_velocity_parameters(self) -> Tuple[float, float, float]:
return self.apt.mot_get_velocity_parameters(self.serial_number)

def _set_velocity_parameters(self,
min_vel: float = None, accn: float = None, max_vel: float = None):
min_vel: Optional[float] = None, accn: Optional[float] = None, max_vel: Optional[float] = None):
if min_vel is None or accn is None or max_vel is None:
old_min_vel, old_accn, old_max_vel = self._get_velocity_parameters()
if min_vel is None:
Expand Down Expand Up @@ -204,8 +204,8 @@ def _set_velocity_max(self, max_vel: float):
def _get_home_parameters(self) -> Tuple[int, int, float, float]:
return self.apt.mot_get_home_parameters(self.serial_number)

def _set_home_parameters(self, direction: int = None, lim_switch: int = None,
velocity: float = None, zero_offset:float = None):
def _set_home_parameters(self, direction: Optional[int] = None, lim_switch: Optional[int] = None,
velocity: Optional[float] = None, zero_offset: Optional[float] = None):
if direction is None or lim_switch is None or velocity is None or zero_offset is None:
old_direction, old_lim_switch, old_velocity, old_zero_offset = self._get_home_parameters()
if direction is None:
Expand Down

0 comments on commit c915d00

Please sign in to comment.