# HG changeset patch # User Andrey Skvortsov # Date 1538229226 -10800 # Node ID 7afecc27db957add80ab0ed79969a5ee3979de41 # Parent a9a6dbc506e9c6d7fd3008e5194fda0039ecfd40 clean etherlab: pylint, C0123 # (unidiomatic-typecheck) Using type() instead of isinstance() for a typecheck. diff -r a9a6dbc506e9 -r 7afecc27db95 etherlab/CommonEtherCATFunction.py --- a/etherlab/CommonEtherCATFunction.py Sat Sep 29 16:48:25 2018 +0300 +++ b/etherlab/CommonEtherCATFunction.py Sat Sep 29 16:53:46 2018 +0300 @@ -887,7 +887,7 @@ vendor_spec_strings = [] for element in device.getType().getcontent(): data += element - if data is not "" and type(data) == unicode: + if data is not "" and isinstance(data, unicode): for vendor_spec_string in vendor_spec_strings: if data == vendor_spec_string: self.OrderIdx = vendor_spec_strings.index(data)+1 @@ -906,7 +906,7 @@ # element2-1; ---- data = device.getGroupType() - if data is not None and type(data) == unicode: + if data is not None and isinstance(data, unicode): for vendor_spec_string in vendor_spec_strings: if data == vendor_spec_string: self.GroupIdx = vendor_spec_strings.index(data)+1 @@ -931,7 +931,7 @@ for device_item in group_etc["devices"]: if device == device_item[1]: data = group_type - if data is not None and type(data) == unicode: + if data is not None and isinstance(data, unicode): for vendor_spec_string in vendor_spec_strings: if data == vendor_spec_string: self.GroupIdx = vendor_spec_strings.index(data)+1 @@ -956,7 +956,7 @@ for device_item in group_etc["devices"]: if device == device_item[1]: data = group_etc["name"] - if data is not "" and type(data) == unicode: + if data is not "" and isinstance(data, unicode): for vendor_spec_string in vendor_spec_strings: if data == vendor_spec_string: groupnameflag = True @@ -975,7 +975,7 @@ for element in device.getName(): if element.getLcId() == 1 or element.getLcId() == 1033: data = element.getcontent() - if data is not "" and type(data) == unicode: + if data is not "" and isinstance(data, unicode): for vendor_spec_string in vendor_spec_strings: if data == vendor_spec_string: self.NameIdx = vendor_spec_strings.index(data)+1 @@ -995,7 +995,7 @@ # element5-1; ---- if device.getcontent() is not None: data = device.getcontent() - if data is not None and type(data) == unicode: + if data is not None and isinstance(data, unicode): for vendor_spec_string in vendor_spec_strings: if data == vendor_spec_string: self.ImgIdx = vendor_spec_strings.index(data)+1 @@ -1019,7 +1019,7 @@ for device_item in group_etc["devices"]: if device == device_item[1]: data = group_etc - if data is not None and type(data) == unicode: + if data is not None and isinstance(data, unicode): for vendor_spec_string in vendor_spec_strings: if data == vendor_spec_string: self.ImgIdx = vendor_spec_strings.index(data)+1