@@ -323,11 +323,11 @@ def export_dcf(od, dest=None, fileInfo={}):
323323
324324def export_eds (od , dest = None , file_info = {}, device_commisioning = False ):
325325 def export_object (obj , eds ):
326- if type (obj ) is objectdictionary .Variable :
326+ if isinstance (obj , objectdictionary .Variable ) :
327327 return export_variable (obj , eds )
328- if type (obj ) is objectdictionary .Record :
328+ if isinstance (obj , objectdictionary .Record ) :
329329 return export_record (obj , eds )
330- if type (obj ) is objectdictionary .Array :
330+ if isinstance (obj , objectdictionary .Array ) :
331331 return export_array (obj , eds )
332332
333333 def export_common (var , eds , section ):
@@ -337,7 +337,7 @@ def export_common(var, eds, section):
337337 eds .set (section , "StorageLocation" , var .storage_location )
338338
339339 def export_variable (var , eds ):
340- if type (var .parent ) is objectdictionary .ObjectDictionary :
340+ if isinstance (var .parent , objectdictionary .ObjectDictionary ) :
341341 # top level variable
342342 section = "%04X" % var .index
343343 else :
@@ -376,7 +376,7 @@ def export_record(var, eds):
376376 section = "%04X" % var .index
377377 export_common (var , eds , section )
378378 eds .set (section , "SubNumber" , "0x%X" % len (var .subindices ))
379- ot = RECORD if type (var ) is objectdictionary .Record else ARR
379+ ot = RECORD if isinstance (var , objectdictionary .Record ) else ARR
380380 eds .set (section , "ObjectType" , "0x%X" % ot )
381381 for i in var :
382382 export_variable (var [i ], eds )
@@ -428,11 +428,11 @@ def export_record(var, eds):
428428 ("LSS_Supported" , "LSS_supported" ),
429429 ]:
430430 val = getattr (od .device_information , odprop , None )
431- if type ( val ) is None :
431+ if val is None :
432432 continue
433- elif type (val ) is str :
433+ elif isinstance (val , str ) :
434434 eds .set ("DeviceInfo" , eprop , val )
435- elif type (val ) in (int , bool ):
435+ elif isinstance (val , (int , bool ) ):
436436 eds .set ("DeviceInfo" , eprop , int (val ))
437437
438438 # we are also adding out of spec baudrates here.
0 commit comments