@@ -323,11 +323,11 @@ def export_dcf(od, dest=None, fileInfo={}):
323
323
324
324
def export_eds (od , dest = None , file_info = {}, device_commisioning = False ):
325
325
def export_object (obj , eds ):
326
- if type (obj ) is objectdictionary .Variable :
326
+ if isinstance (obj , objectdictionary .Variable ) :
327
327
return export_variable (obj , eds )
328
- if type (obj ) is objectdictionary .Record :
328
+ if isinstance (obj , objectdictionary .Record ) :
329
329
return export_record (obj , eds )
330
- if type (obj ) is objectdictionary .Array :
330
+ if isinstance (obj , objectdictionary .Array ) :
331
331
return export_array (obj , eds )
332
332
333
333
def export_common (var , eds , section ):
@@ -337,7 +337,7 @@ def export_common(var, eds, section):
337
337
eds .set (section , "StorageLocation" , var .storage_location )
338
338
339
339
def export_variable (var , eds ):
340
- if type (var .parent ) is objectdictionary .ObjectDictionary :
340
+ if isinstance (var .parent , objectdictionary .ObjectDictionary ) :
341
341
# top level variable
342
342
section = "%04X" % var .index
343
343
else :
@@ -376,7 +376,7 @@ def export_record(var, eds):
376
376
section = "%04X" % var .index
377
377
export_common (var , eds , section )
378
378
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
380
380
eds .set (section , "ObjectType" , "0x%X" % ot )
381
381
for i in var :
382
382
export_variable (var [i ], eds )
@@ -428,11 +428,11 @@ def export_record(var, eds):
428
428
("LSS_Supported" , "LSS_supported" ),
429
429
]:
430
430
val = getattr (od .device_information , odprop , None )
431
- if type ( val ) is None :
431
+ if val is None :
432
432
continue
433
- elif type (val ) is str :
433
+ elif isinstance (val , str ) :
434
434
eds .set ("DeviceInfo" , eprop , val )
435
- elif type (val ) in (int , bool ):
435
+ elif isinstance (val , (int , bool ) ):
436
436
eds .set ("DeviceInfo" , eprop , int (val ))
437
437
438
438
# we are also adding out of spec baudrates here.
0 commit comments