python3 support: pylint, W1625 # (raising-string) Raising a string exception
--- a/controls/EnhancedStatusBar.py Fri Oct 12 10:42:47 2018 +0300
+++ b/controls/EnhancedStatusBar.py Fri Oct 12 11:14:34 2018 +0300
@@ -222,19 +222,20 @@
self._curPos += 1
if self.GetFieldsCount() <= pos:
- raise "\nERROR: EnhancedStatusBar has a max of %d items, you tried to set item #%d" % (self.GetFieldsCount(), pos)
+ raise ValueError("\nERROR: EnhancedStatusBar has a max of %d items, you tried to set item #%d" %
+ (self.GetFieldsCount(), pos))
if horizontalalignment not in [ESB_ALIGN_CENTER_HORIZONTAL, ESB_EXACT_FIT,
ESB_ALIGN_LEFT, ESB_ALIGN_RIGHT]:
- raise '\nERROR: Parameter "horizontalalignment" Should Be One Of '\
- '"ESB_ALIGN_CENTER_HORIZONTAL", "ESB_ALIGN_LEFT", "ESB_ALIGN_RIGHT"' \
- '"ESB_EXACT_FIT"'
+ raise ValueError('\nERROR: Parameter "horizontalalignment" Should Be One Of '
+ '"ESB_ALIGN_CENTER_HORIZONTAL", "ESB_ALIGN_LEFT", "ESB_ALIGN_RIGHT"'
+ '"ESB_EXACT_FIT"')
if verticalalignment not in [ESB_ALIGN_CENTER_VERTICAL, ESB_EXACT_FIT,
ESB_ALIGN_TOP, ESB_ALIGN_BOTTOM]:
- raise '\nERROR: Parameter "verticalalignment" Should Be One Of '\
- '"ESB_ALIGN_CENTER_VERTICAL", "ESB_ALIGN_TOP", "ESB_ALIGN_BOTTOM"' \
- '"ESB_EXACT_FIT"'
+ raise ValueError('\nERROR: Parameter "verticalalignment" Should Be One Of '
+ '"ESB_ALIGN_CENTER_VERTICAL", "ESB_ALIGN_TOP", "ESB_ALIGN_BOTTOM"'
+ '"ESB_EXACT_FIT"')
try:
self.RemoveChild(self._items[pos].widget)
--- a/plcopen/structures.py Fri Oct 12 10:42:47 2018 +0300
+++ b/plcopen/structures.py Fri Oct 12 11:14:34 2018 +0300
@@ -266,7 +266,7 @@
Function_decl_copy = Function_decl.copy()
Current_section["list"].append(Function_decl_copy)
else:
- raise "First function must be in a category"
+ raise ValueError("First function must be in a category")
return Standard_Functions_Decl
--- a/tests/tools/check_source.sh Fri Oct 12 10:42:47 2018 +0300
+++ b/tests/tools/check_source.sh Fri Oct 12 11:14:34 2018 +0300
@@ -371,6 +371,7 @@
enable=$enable,W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
enable=$enable,W1611 # (standarderror-builtin) StandardError built-in referenced
enable=$enable,W1624 # (indexing-exception) Indexing exceptions will not work on Python 3
+ enable=$enable,W1625 # (raising-string) Raising a string exception
# enable=
options=