fix error from manual %-format conversion

frappy_psi.ppms (line 263) was not correctly converted probably due
to the fact, that dict access with f-strings gets quite ugly.

As it seems we want to get rid of %-format, use str.format_map here.

Change-Id: Idf5b700554aa7a02a6647dc4672bf4a3856f92a5
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/30933
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Alexander Zaft <a.zaft@fz-juelich.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2023-04-20 15:33:44 +02:00
parent d99f2dfbc3
commit 64b4cba67c
2 changed files with 7 additions and 10 deletions

View File

@ -267,8 +267,7 @@ class ResChannel(Channel):
if self.autorange:
if rng < self.minrange:
rng = self.minrange
self.communicate('RDGRNG %d,%d,%d,%d,%d,%d;*OPC?' % (
self.channel, iscur, exc, rng, 0, excoff))
self.communicate(f'RDGRNG {self.channel},{iscur},{exc},{rng},0,{excoff};*OPC?')
self.read_range()
def fix_autorange(self):
@ -290,12 +289,11 @@ class ResChannel(Channel):
@CommonWriteHandler(inset_params)
def write_inset(self, change):
_, _, _, curve, tempco = literal_eval(
_, _, _, change['curve'], change['tempco'] = literal_eval(
self.communicate(f'INSET?{self.channel}'))
self.enabled, self.dwell, self.pause, _, _ = literal_eval(
self.communicate('INSET %d,%d,%d,%d,%d,%d;INSET?%d' % (
self.channel, change['enabled'], change['dwell'], change['pause'], curve, tempco,
self.channel)))
self.communicate('INSET {channel},{enabled:d},{dwell:d},'
'{pause:d},{curve},{tempco};INSET?{channel}'.format_map(change)))
if 'enabled' in change and change['enabled']:
# switch to enabled channel
self.switcher.write_target(self.channel)