python3 support: pylint, W1624 # (indexing-exception) Indexing exceptions will not work on Python 3
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 12 Oct 2018 10:42:47 +0300
changeset 2452 2f2b2152580f
parent 2451 6d1bf321fb89
child 2453 9900a8df922f
python3 support: pylint, W1624 # (indexing-exception) Indexing exceptions will not work on Python 3
i18n/mki18n.py
tests/tools/check_source.sh
--- a/i18n/mki18n.py	Thu Oct 11 12:09:04 2018 +0300
+++ b/i18n/mki18n.py	Fri Oct 12 10:42:47 2018 +0300
@@ -84,8 +84,10 @@
 import os
 import sys
 import re
+from builtins import str as text
 import wx
 
+
 # -----------------------------------------------------------------------------
 # Global variables
 # ----------------
@@ -200,7 +202,7 @@
     os.chdir(applicationDirectoryPath)
     filelist = 'app.fil'
     if not os.path.exists(filelist):
-        raise IOError(2, 'No module file: ' % filelist)
+        raise IOError(2, 'No module file: %s' % filelist)
 
     fileout = 'messages.pot'
     # Steps:
@@ -487,7 +489,7 @@
     try:
         optionList, pargs = getopt.getopt(sys.argv[1:], validOptions, validLongOptions)
     except getopt.GetoptError as e:
-        printUsage(e[0])
+        printUsage(e)
         sys.exit(1)
     for (opt, val) in optionList:
         if opt == '-h':
@@ -513,7 +515,7 @@
             makePO(appDirPath, option['domain'], option['verbose'])
             exit_code = 0
         except IOError as e:
-            printUsage(e[1] + '\n   You must write a file app.fil that contains the list of all files to parse.')
+            printUsage(text(e) + '\n   You must write a file app.fil that contains the list of all files to parse.')
     if option['mo']:
         makeMO(appDirPath, option['moTarget'], option['domain'], option['verbose'], option['forceEnglish'])
         exit_code = 0
--- a/tests/tools/check_source.sh	Thu Oct 11 12:09:04 2018 +0300
+++ b/tests/tools/check_source.sh	Fri Oct 12 10:42:47 2018 +0300
@@ -262,7 +262,6 @@
     disable=$disable,C0103        # invalid-name
     disable=$disable,C0326        # bad whitespace
     disable=$disable,W0110        # (deprecated-lambda) map/filter on lambda could be replaced by comprehension
-    disable=$disable,W1401        # (anomalous-backslash-in-string) Anomalous backslash in string: '\.'. String constant might be missing an r prefix.
     disable=$disable,W0613        # (unused-argument) Unused argument 'X'
     disable=$disable,W0622        # (redefined-builtin) Redefining built-in
     disable=$disable,W0621        # (redefined-outer-name) Redefining name 'Y' from outer scope (line X)
@@ -371,6 +370,7 @@
     enable=$enable,W1651          # (deprecated-itertools-function) Accessing a deprecated function on the itertools module
     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=
 
     options=