python3 support: pylint, W1646 # (invalid-str-codec) non-text encoding used in str.decode
--- a/etherlab/CommonEtherCATFunction.py Wed Oct 10 10:36:07 2018 +0300
+++ b/etherlab/CommonEtherCATFunction.py Wed Oct 10 10:50:00 2018 +0300
@@ -11,6 +11,7 @@
from __future__ import absolute_import
from __future__ import division
from builtins import str as text
+import codecs
import wx
@@ -185,7 +186,7 @@
@param controler: _EthercatSlaveCTN class in EthercatSlave.py
"""
self.Controler = controler
-
+ self.HexDecode = codecs.getdecoder("hex_codec")
self.ClearSDODataSet()
# -------------------------------------------------------------------------------
@@ -592,7 +593,7 @@
# append zero-filled padding data up to EEPROM size
for dummy in range(self.SmartViewInfosFromXML["eeprom_size"] - len(self.BinaryCode)):
- self.BinaryCode = self.BinaryCode + 'ff'.decode('hex')
+ self.BinaryCode = self.BinaryCode + self.HexDecode('ff')[0]
return self.BinaryCode
@@ -860,7 +861,7 @@
# convert binary code
for index in range(eeprom_size):
- eeprom_binary = eeprom_binary + eeprom[index].decode('hex')
+ eeprom_binary = eeprom_binary + self.HexDecode(eeprom[index])[0]
return eeprom_binary
--- a/tests/tools/check_source.sh Wed Oct 10 10:36:07 2018 +0300
+++ b/tests/tools/check_source.sh Wed Oct 10 10:50:00 2018 +0300
@@ -365,6 +365,7 @@
enable=$enable,W1606 # (execfile-builtin) execfile built-in referenced
enable=$enable,W1629 # (nonzero-method) __nonzero__ method defined
enable=$enable,W1602 # (basestring-builtin) basestring built-in referenced
+ enable=$enable,W1646 # (invalid-str-codec) non-text encoding used in str.decode
# enable=
options=