Commit 2ecf10b6 authored by Wout De Nolf's avatar Wout De Nolf
Browse files

cleanup: F541 f-string is missing placeholders

parent 64a60560
Pipeline #37887 passed with stages
in 92 minutes and 10 seconds
......@@ -181,7 +181,7 @@ class Modbus_RTU:
def _read(self, func_code, address, nb, struct_format, timeout_errmsg, timeout):
log_debug_data(
self,
f"In _read",
"In _read",
{
"fc": func_code,
"addr": address,
......@@ -196,7 +196,7 @@ class Modbus_RTU:
def _write(self, func_code, address, struct_format, value, timeout_errmsg, timeout):
log_debug_data(
self,
f"In _write",
"In _write",
{
"fc": func_code,
"addr": address,
......@@ -404,7 +404,7 @@ class ModbusTcp:
def read_holding_registers(self, address, struct_format, timeout=None):
log_debug_data(
self,
f"read_holding_registers",
"read_holding_registers",
{"address": address, "num": len(struct_format)},
)
timeout_errmsg = "timeout on read_holding_registers modbus tcp (%s, %d)" % (
......@@ -424,7 +424,7 @@ class ModbusTcp:
def write_register(self, address, struct_format, value, timeout=None):
log_debug_data(
self,
f"write_register",
"write_register",
{"address": address, "num": len(struct_format), "value": value},
)
timeout_errmsg = "timeout on write_register modbus tcp (%s, %d)" % (
......@@ -435,7 +435,7 @@ class ModbusTcp:
@try_connect_modbustcp
def write_float(self, address, value, timeout=None):
log_debug_data(self, f"write_float", {"address": address, "value": value})
log_debug_data(self, "write_float", {"address": address, "value": value})
timeout_errmsg = "timeout on write_registers modbus tcp (%s, %d)" % (
self._host,
self._port,
......@@ -468,7 +468,7 @@ class ModbusTcp:
def read_input_registers(self, address, struct_format, timeout=None):
log_debug_data(
self,
f"read_input_registers",
"read_input_registers",
{"address": address, "num": len(struct_format)},
)
timeout_errmsg = "timeout on read_input_registers modbus tcp (%s, %d)" % (
......@@ -486,7 +486,7 @@ class ModbusTcp:
@try_connect_modbustcp
def read_coils(self, address, nb_coils, timeout=None):
log_debug_data(self, f"read_coils", {"address": address, "num": nb_coils})
log_debug_data(self, "read_coils", {"address": address, "num": nb_coils})
timeout_errmsg = "timeout on read_coils tcp (%s, %d)" % (self._host, self._port)
nb_bytes = ((nb_coils + 7) & ~7) // 8
struct_format = "%dB" % nb_bytes
......@@ -502,7 +502,7 @@ class ModbusTcp:
@try_connect_modbustcp
def write_coil(self, address, on_off, timeout=None):
log_debug_data(self, f"write_coil", {"address": address, "value": on_off})
log_debug_data(self, "write_coil", {"address": address, "value": on_off})
timeout_errmsg = "timeout on write_coil tcp (%s, %d)" % (self._host, self._port)
value = 0xFF00 if on_off else 0x0000
self._write(0x05, address, "H", value, timeout_errmsg, timeout)
......@@ -511,7 +511,7 @@ class ModbusTcp:
def write_registers(self, address, struct_format, values, timeout=None):
log_debug_data(
self,
f"write_registers",
"write_registers",
{"address": address, "num": len(struct_format), "values": values},
)
timeout_errmsg = "timeout on write_registers modbus tcp (%s, %d)" % (
......@@ -522,7 +522,7 @@ class ModbusTcp:
@try_connect_modbustcp
def write_coils(self, address, on_off, timeout=None):
log_debug_data(self, f"write_coils", {"address": address, "values": on_off})
log_debug_data(self, "write_coils", {"address": address, "values": on_off})
# implements function code 16
raise NotImplementedError
......
......@@ -1151,7 +1151,7 @@ class Axis:
try:
info_string += f" state (R): {self.state}\n"
except Exception:
info_string += f" ERROR: unable to get state\n"
info_string += " ERROR: unable to get state\n"
# ACCELERATION
try:
......@@ -1170,7 +1170,7 @@ class Axis:
)
info_string += f" acctime (RW): {_acc_time:10.5f} (config: {_acc_time_config})\n"
except Exception:
info_string += f" acceleration: None\n"
info_string += " acceleration: None\n"
# VELOCITY
try:
......@@ -1185,13 +1185,13 @@ class Axis:
f" velocity (RW): {_vel:10.5f} (config: {_vel_config})\n"
)
except Exception:
info_string += f" velocity: None\n"
info_string += " velocity: None\n"
# CONTROLLER
try:
info_string += self.__controller.__info__()
except Exception:
info_string += f"ERROR: Unable to get info from controller\n"
info_string += "ERROR: Unable to get info from controller\n"
# SPECIFIC AXIS INFO
try:
......@@ -1204,7 +1204,7 @@ class Axis:
try:
info_string += self.encoder.__info__()
except Exception:
info_string += f"ENCODER:\n None\n"
info_string += "ENCODER:\n None\n"
return info_string
......@@ -1958,7 +1958,7 @@ class Axis:
raise RuntimeError("axis %s state is %r" % (self.name, "MOVING"))
# create motion object for hooks
motion = Motion(self, switch, None, "homing", user_target_pos=f"home")
motion = Motion(self, switch, None, "homing", user_target_pos="home")
motion.polling_time = (
self._polling_time if polling_time is None else polling_time
)
......
......@@ -252,9 +252,9 @@ def DrawArc(arry, value=1, cx=0, cy=0, r1=100, r2=120, a1=0, a2=180):
# check input args
if r1 < 0 or r2 < 0:
raise ValueError(f"radius must be a positive number !")
raise ValueError("radius must be a positive number !")
if a1 < 0 or a2 < 0 or a1 > 360 or a2 > 360:
raise ValueError(f"angles must be in [0, 360] degree !")
raise ValueError("angles must be in [0, 360] degree !")
h, w = arry.shape
cx = w / 2 + cx
......
......@@ -335,7 +335,7 @@ def wid():
undu_str = ""
for id_ds in ID_DS_list:
undu_str += f"\n ---------------------------------------\n"
undu_str += "\n ---------------------------------------\n"
undu_str += f" ID Device Server {id_ds.ds_name}\n"
power = f"{id_ds.device.Power:.3f}"
......
......@@ -123,7 +123,7 @@ except ImportError:
def logging_call(*args, name=None, tango_func=None, logger=None):
logger(f"call %s%s", name, args)
logger("call %s%s", name, args)
ret = tango_func(*args)
logger("returned: %s", ret)
return ret
......
......@@ -48,7 +48,7 @@ class BlissValidator(Validator):
{ 'nullable': True}
"""
if not value == expected_value:
self._error(field, f" non expected value")
self._error(field, " non expected value")
def _normalize_default_setter_find_default(self, mapping, schema, field):
......
......@@ -148,11 +148,11 @@ class CT2Controller(Proxy, CounterController):
if self.input_channel is not None:
infos += f" input channel : {self.input_channel}\n"
else:
infos += f" input channel : Not Configured\n"
infos += " input channel : Not Configured\n"
if self.output_channel is not None:
infos += f" output channel : {self.output_channel}\n"
else:
infos += f" output channel : Not Configured\n"
infos += " output channel : Not Configured\n"
return infos
......
......@@ -114,7 +114,7 @@ def main(args=None):
obj_name = arguments["name"]
if obj_name is None:
raise ValueError(f"Argument '--name' is required")
raise ValueError("Argument '--name' is required")
config = get_config()
cfg = config.get_config(obj_name)
......
......@@ -200,7 +200,7 @@ class BpmController(SamplingCounterController):
info_str += f" roi : {self.roi}\n"
info_str += f" flip : {self.flip}\n"
info_str += f" rotation : {self.rotation}\n"
info_str += f"\n"
info_str += "\n"
return info_str
......
......@@ -207,7 +207,7 @@ class BaseMCA(CounterController):
try:
info_str += f" Detector type : {self.detector_type.name}\n"
except Exception:
info_str += f" Detector type : UNKNOWN\n"
info_str += " Detector type : UNKNOWN\n"
info_str += f" Acquisition mode : {self.acquisition_mode.name}\n"
try:
info_str += f" Spectrum size : {self.spectrum_size}\n"
......@@ -232,13 +232,13 @@ class BaseMCA(CounterController):
# info_str += f"\nConfig:\n"
# info_str += f"Counters: {self.counters}\n"
info_str += f"\nROIS:\n"
info_str += "\nROIS:\n"
info_str_shifted = ""
for line in self.rois.__info__().split("\n"):
info_str_shifted += " " + line + "\n"
info_str += info_str_shifted
info_str += f"\n"
info_str += "\n"
return info_str
......
......@@ -169,8 +169,8 @@ class EnergyWavelength(CalcController):
info_str += f" mono axis: {_mono_axis.name} ({_mono_axis.position:10.5f} deg)\n"
if self.lut:
info_str += f" Use LUT: \n"
info_str += f" \n"
info_str += " Use LUT: \n"
info_str += " \n"
else:
_dspace = _ene_axis.settings.get("dspace")
info_str += f" dspace: {_dspace}\n"
......
......@@ -451,12 +451,12 @@ class esrf_hexapode(Controller):
curr_leg_length = self.device.read_attribute("LegLength").value
dlg_curr_l1 = UserMsg(label=f"Leg 1 (mm) : %8.4f" % (curr_leg_length[0]))
dlg_curr_l2 = UserMsg(label=f"Leg 2 (mm) : %8.4f" % (curr_leg_length[1]))
dlg_curr_l3 = UserMsg(label=f"Leg 3 (mm) : %8.4f" % (curr_leg_length[2]))
dlg_curr_l4 = UserMsg(label=f"Leg 4 (mm) : %8.4f" % (curr_leg_length[3]))
dlg_curr_l5 = UserMsg(label=f"Leg 5 (mm) : %8.4f" % (curr_leg_length[4]))
dlg_curr_l6 = UserMsg(label=f"Leg 6 (mm) : %8.4f" % (curr_leg_length[5]))
dlg_curr_l1 = UserMsg(label="Leg 1 (mm) : %8.4f" % (curr_leg_length[0]))
dlg_curr_l2 = UserMsg(label="Leg 2 (mm) : %8.4f" % (curr_leg_length[1]))
dlg_curr_l3 = UserMsg(label="Leg 3 (mm) : %8.4f" % (curr_leg_length[2]))
dlg_curr_l4 = UserMsg(label="Leg 4 (mm) : %8.4f" % (curr_leg_length[3]))
dlg_curr_l5 = UserMsg(label="Leg 5 (mm) : %8.4f" % (curr_leg_length[4]))
dlg_curr_l6 = UserMsg(label="Leg 6 (mm) : %8.4f" % (curr_leg_length[5]))
cont_curr = Container(
[
dlg_curr_l1,
......@@ -547,17 +547,17 @@ class esrf_hexapode(Controller):
curr_pos = self.device.read_attribute("Position").value
dlg_curr_tx = UserMsg(label=f"Tx (mm) : %8.4f" % curr_pos[0])
dlg_curr_ty = UserMsg(label=f"Ty (mm) : %8.4f" % curr_pos[1])
dlg_curr_tz = UserMsg(label=f"Tz (mm) : %8.4f" % curr_pos[2])
dlg_curr_tx = UserMsg(label="Tx (mm) : %8.4f" % curr_pos[0])
dlg_curr_ty = UserMsg(label="Ty (mm) : %8.4f" % curr_pos[1])
dlg_curr_tz = UserMsg(label="Tz (mm) : %8.4f" % curr_pos[2])
dlg_curr_rx = UserMsg(
label=f"Rx (mrad) : %8.4f" % math.radians(float(curr_pos[5])) * 1000.0
label="Rx (mrad) : %8.4f" % math.radians(float(curr_pos[5])) * 1000.0
)
dlg_curr_ry = UserMsg(
label=f"Ry (mrad) : %8.4f" % math.radians(float(curr_pos[4])) * 1000.0
label="Ry (mrad) : %8.4f" % math.radians(float(curr_pos[4])) * 1000.0
)
dlg_curr_rz = UserMsg(
label=f"Rz (mrad) : %8.4f" % math.radians(float(curr_pos[3])) * 1000.0
label="Rz (mrad) : %8.4f" % math.radians(float(curr_pos[3])) * 1000.0
)
cont_curr = Container(
[
......@@ -664,12 +664,12 @@ class esrf_hexapode(Controller):
curr_leg_length = self.device.read_attribute("LegLength").value
dlg_curr_l1 = UserMsg(label=f"Leg 1 (mm) : %8.4f" % (curr_leg_length[0]))
dlg_curr_l2 = UserMsg(label=f"Leg 2 (mm) : %8.4f" % (curr_leg_length[1]))
dlg_curr_l3 = UserMsg(label=f"Leg 3 (mm) : %8.4f" % (curr_leg_length[2]))
dlg_curr_l4 = UserMsg(label=f"Leg 4 (mm) : %8.4f" % (curr_leg_length[3]))
dlg_curr_l5 = UserMsg(label=f"Leg 5 (mm) : %8.4f" % (curr_leg_length[4]))
dlg_curr_l6 = UserMsg(label=f"Leg 6 (mm) : %8.4f" % (curr_leg_length[5]))
dlg_curr_l1 = UserMsg(label="Leg 1 (mm) : %8.4f" % (curr_leg_length[0]))
dlg_curr_l2 = UserMsg(label="Leg 2 (mm) : %8.4f" % (curr_leg_length[1]))
dlg_curr_l3 = UserMsg(label="Leg 3 (mm) : %8.4f" % (curr_leg_length[2]))
dlg_curr_l4 = UserMsg(label="Leg 4 (mm) : %8.4f" % (curr_leg_length[3]))
dlg_curr_l5 = UserMsg(label="Leg 5 (mm) : %8.4f" % (curr_leg_length[4]))
dlg_curr_l6 = UserMsg(label="Leg 6 (mm) : %8.4f" % (curr_leg_length[5]))
cont_curr = Container(
[
dlg_curr_l1,
......@@ -820,12 +820,12 @@ class esrf_hexapode(Controller):
border=1,
)
dlg_curr_l1 = UserMsg(label=f"Leg 1 (mm) : %8.4f" % (curr_leg_length[0]))
dlg_curr_l2 = UserMsg(label=f"Leg 2 (mm) : %8.4f" % (curr_leg_length[1]))
dlg_curr_l3 = UserMsg(label=f"Leg 3 (mm) : %8.4f" % (curr_leg_length[2]))
dlg_curr_l4 = UserMsg(label=f"Leg 4 (mm) : %8.4f" % (curr_leg_length[3]))
dlg_curr_l5 = UserMsg(label=f"Leg 5 (mm) : %8.4f" % (curr_leg_length[4]))
dlg_curr_l6 = UserMsg(label=f"Leg 6 (mm) : %8.4f" % (curr_leg_length[5]))
dlg_curr_l1 = UserMsg(label="Leg 1 (mm) : %8.4f" % (curr_leg_length[0]))
dlg_curr_l2 = UserMsg(label="Leg 2 (mm) : %8.4f" % (curr_leg_length[1]))
dlg_curr_l3 = UserMsg(label="Leg 3 (mm) : %8.4f" % (curr_leg_length[2]))
dlg_curr_l4 = UserMsg(label="Leg 4 (mm) : %8.4f" % (curr_leg_length[3]))
dlg_curr_l5 = UserMsg(label="Leg 5 (mm) : %8.4f" % (curr_leg_length[4]))
dlg_curr_l6 = UserMsg(label="Leg 6 (mm) : %8.4f" % (curr_leg_length[5]))
cont_curr = Container(
[
dlg_curr_l1,
......
......@@ -356,7 +356,7 @@ class Icepap(Controller):
info_str += f" {self.read_encoder_all_types(axis)}\n"
if isinstance(axis, LinkedAxis):
info_str += f"LINKED AXIS:\n"
info_str += "LINKED AXIS:\n"
info_str += f" {self.get_linked_axis()}\n"
return info_str
......
......@@ -403,13 +403,13 @@ class PI_E753(Controller):
for bs in self.comm.write_readlines(b"IFC? IPADR MACADR IPSTART\n", 3)
]
info_str = f"CONTROLLER:\n"
info_str = "CONTROLLER:\n"
info_str += f" ID: {idn}\n"
info_str += f" MAC address: {ifc[1]}\n"
info_str += f" IP address: {ifc[0]}\n"
_start_mode = "use IPADR" if ifc[2] == "0" else "use default -> 192.168.0.1"
info_str += f" IP start: IPSTART={ifc[2]}({_start_mode})\n"
info_str += f"COMMUNICATION CONFIG:\n "
info_str += "COMMUNICATION CONFIG:\n "
info_str += self.comm.__info__()
return info_str
......
......@@ -283,7 +283,7 @@ class VSCANNER(Controller):
# Q: in which case there is no velocity in motion ???
if any(velocities):
_msg = f"start_all() -- SCAN (relative) move"
_msg = "start_all() -- SCAN (relative) move"
log_debug(self, _msg)
# first_axis.velocity is in user units.
......@@ -421,14 +421,14 @@ class VSCANNER(Controller):
"""
info_str = ""
info_str += "###############################\n"
info_str += f"Config:\n"
info_str += "Config:\n"
info_str += f" url={self.config.config_dict['serial']['url']}\n"
info_str += f" class={self.config.config_dict['class']}\n"
# info_str += f" channel letter:{axis.chan_letter}\n"
info_str += "###############################\n"
info_str += f"?ERR: {self.get_error()}\n"
info_str += "###############################\n"
info_str += f"'?INFO' command:\n"
info_str += "'?INFO' command:\n"
info_str += f"firmware version : {self.get_version()}\n"
info_str += f"output voltage : {self.get_voltages()}\n"
info_str += f"unit state : {self.get_state()}\n"
......
......@@ -195,10 +195,10 @@ class NhqChannel:
if self._module_status is None:
self.module_status
info_list.append(f"")
info_list.append("")
for k, v in self._module_status.items():
info_list.append(f"{k:12s}: {v}")
info_list.append(f"")
info_list.append("")
st = self.status
info_list.append(f"Status : {st} ({self.nhq._STATUS2INFO[st]})")
......@@ -485,14 +485,14 @@ class Nhq:
info_list.append(
f"=== Controller {self.name} (sn{self._unit_number} ver{self._software_version}) ==="
)
info_list.append(f"")
info_list.append("")
# info_list.append(f"Unit number : {self.unit_number}")
# info_list.append(f"Software version: {self.software_version}")
if level > 1:
info_list.append(f"Break time : {self.break_time}ms")
info_list.append(f"Maximum voltage : {self._vout_max}")
info_list.append(f"Maximum current : {self._iout_max}")
info_list.append(f"")
info_list.append("")
txt = "\n".join(info_list)
......
......@@ -589,12 +589,12 @@ class Ace:
if us_time < 1 or us_time > 2 ** 31:
raise ValueError(
f"Ace counting time must be in range [0.000001, 2147.483648] second "
"Ace counting time must be in range [0.000001, 2147.483648] second "
)
self.putget("TCT %d" % us_time)
else:
raise RuntimeError(f"Ace counter not ready!")
raise RuntimeError("Ace counter not ready!")
def counting_stop(self):
self.putget("STCT")
......
......@@ -367,7 +367,7 @@ class Cyberstar:
log_debug(self, "Cyberstar:sca_low.setter %s" % value)
if value >= self.sca_up:
raise ValueError(f"Error: sca_low value must be lower than sca_up")
raise ValueError("Error: sca_low value must be lower than sca_up")
self._set_value("sca_low", value)
self._update_sca_window_size()
......@@ -382,7 +382,7 @@ class Cyberstar:
log_debug(self, "Cyberstar:sca_up.setter %s" % value)
if value <= self.sca_low:
raise ValueError(f"Error: sca_up value must be greater than sca_low")
raise ValueError("Error: sca_up value must be greater than sca_low")
self._set_value("sca_up", value)
self._update_sca_window_size()
......
......@@ -251,7 +251,7 @@ class tango_attr_as_counter(SamplingCounter):
if self.tango_format != "":
info_string += f' Tango format = "{self.tango_format}"\n'
else:
info_string += f" no format\n"
info_string += " no format\n"
# UNIT
if self.yml_unit is not None:
......@@ -260,13 +260,13 @@ class tango_attr_as_counter(SamplingCounter):
if self.tango_unit != "":
info_string += f' Tango unit = "{self.tango_unit}"\n'
else:
info_string += f" no unit\n"
info_string += " no unit\n"
# INDEX if any
if self.index is not None:
info_string += f" index: {self.index}\n"
else:
info_string += f" scalar\n"
info_string += " scalar\n"
# VALUE
info_string += f" value: {self.value}\n"
......
......@@ -874,7 +874,7 @@ def interlock_download(
Note: wago mapping should be set before calling this
"""
log_info(wago, f"Checking interlock on Wago")
log_info(wago, "Checking interlock on Wago")
registered_inst, available_inst, free_inst = interlock_memory(wago)
......@@ -960,7 +960,7 @@ def interlock_download(
def interlock_state(wago: Union[TangoWago, WagoController]):
log_info(wago, f"Checking interlock state on Wago")
log_info(wago, "Checking interlock state on Wago")
registered_inst, available_inst, free_inst = interlock_memory(wago)
state_list = []
......
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