@@ -96,7 +96,7 @@ def __init__(self, name, **kargs):
9696 else :
9797 self .__on_update = None
9898
99- self .__validate = kargs .pop ('validate' , None )
99+ self .__validate = kargs .pop ('validate' , None )
100100 self .__always_update = kargs .pop ('always_update' , False )
101101 self ._value = kargs .pop ('initial_value' , None )
102102 self .__enable_write = True
@@ -213,32 +213,36 @@ def get(self):
213213def _Device (Base , record_type , rval = False , mlst = False , default = 0 ):
214214 '''Wrapper for generating simple records.'''
215215 val_field = 'RVAL' if rval else 'VAL'
216+
216217 class GenericDevice (Base ):
217218 _record_type_ = record_type
218219 _device_name_ = 'devPython_' + record_type
219- _val_field_ = val_field
220- _default_ = default
221- _fields_ = ['UDF' , val_field ]
222- if mlst : _fields_ .append ('MLST' )
220+ _val_field_ = val_field
221+ _default_ = default
222+ _fields_ = ['UDF' , val_field ]
223+ if mlst :
224+ _fields_ .append ('MLST' )
223225
224226 GenericDevice .__name__ = record_type
225227 return GenericDevice
226228
227- _In = ProcessDeviceSupportIn
229+ _In = ProcessDeviceSupportIn
228230_Out = ProcessDeviceSupportOut
229- def _Device_In (type , ** kargs ):
231+
232+ def _Device_In (type , ** kargs ):
230233 return _Device (_In , type , ** kargs )
234+
231235def _Device_Out (type , rval = False , mlst = True ):
232236 return _Device (_Out , type , rval = rval , mlst = mlst , default = None )
233237
234- longin = _Device_In ('longin' )
235- longout = _Device_Out ('longout' )
236- bi = _Device_In ('bi' , rval = True )
237- bo = _Device_Out ('bo' , rval = True )
238- stringin = _Device_In ('stringin' , mlst = False , default = '' )
239- stringout = _Device_Out ('stringout' , mlst = False )
240- mbbi = _Device_In ('mbbi' , rval = True )
241- mbbo = _Device_Out ('mbbo' , rval = True )
238+ longin = _Device_In ('longin' )
239+ longout = _Device_Out ('longout' )
240+ bi = _Device_In ('bi' , rval = True )
241+ bo = _Device_Out ('bo' , rval = True )
242+ stringin = _Device_In ('stringin' , mlst = False , default = '' )
243+ stringout = _Device_Out ('stringout' , mlst = False )
244+ mbbi = _Device_In ('mbbi' , rval = True )
245+ mbbo = _Device_Out ('mbbo' , rval = True )
242246
243247
244248NO_CONVERT = 2
@@ -254,10 +258,10 @@ def _Device_Out(type, rval=False, mlst=True):
254258class ai (ProcessDeviceSupportIn ):
255259 _record_type_ = 'ai'
256260 _device_name_ = 'devPython_ai'
257- _val_field_ = 'VAL'
258- _default_ = 0.0
259- _fields_ = ['UDF' , 'VAL' ]
260- _dset_extra_ = dset_process_linconv
261+ _val_field_ = 'VAL'
262+ _default_ = 0.0
263+ _fields_ = ['UDF' , 'VAL' ]
264+ _dset_extra_ = dset_process_linconv
261265
262266 def _process (self , record ):
263267 _value = self ._value
@@ -271,9 +275,9 @@ def _process(self, record):
271275class ao (ProcessDeviceSupportOut ):
272276 _record_type_ = 'ao'
273277 _device_name_ = 'devPython_ao'
274- _val_field_ = 'VAL'
275- _fields_ = ['UDF' , 'VAL' , 'MLST' ]
276- _dset_extra_ = dset_process_linconv
278+ _val_field_ = 'VAL'
279+ _fields_ = ['UDF' , 'VAL' , 'MLST' ]
280+ _dset_extra_ = dset_process_linconv
277281
278282 def init_record (self , record ):
279283 self .__super .init_record (record )
@@ -304,12 +308,14 @@ def _read_value(self, record):
304308
305309 def _write_value (self , record , value ):
306310 value = numpy .require (value , dtype = self .dtype )
307- if value .shape == (): value .shape = (1 ,)
311+ if value .shape == ():
312+ value .shape = (1 ,)
308313 assert value .ndim == 1 , 'Can\' t write multidimensional arrays'
309314
310315 nelm = record .NELM
311316 nord = len (value )
312- if nord > nelm : nord = nelm
317+ if nord > nelm :
318+ nord = nelm
313319 memmove (
314320 record .BPTR , value .ctypes .data_as (c_void_p ),
315321 self .dtype .itemsize * nord )
@@ -319,7 +325,7 @@ def _write_value(self, record, value):
319325class waveform (WaveformBase , ProcessDeviceSupportIn ):
320326 _record_type_ = 'waveform'
321327 _device_name_ = 'devPython_waveform'
322- _default_ = ()
328+ _default_ = ()
323329
324330 # Because arrays are mutable values it's ever so easy to accidentially call
325331 # set() with a value which subsequently changes. To avoid this common class
@@ -338,7 +344,8 @@ def set(self, value,
338344
339345 value = numpy .require (value , dtype = self .dtype )
340346 self ._value = (+ value , severity , alarm , timestamp )
341- if value .shape == (): value .shape = (1 ,)
347+ if value .shape == ():
348+ value .shape = (1 ,)
342349 assert value .ndim == 1 , 'Can\' t write multidimensional arrays'
343350
344351 self .trigger ()
0 commit comments