--- a/eric6/Utilities/__init__.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/__init__.py Mon Sep 23 19:22:12 2019 +0200 @@ -42,8 +42,10 @@ from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF32 -from PyQt5.QtCore import QRegExp, QDir, QProcess, Qt, QByteArray, \ - qVersion, PYQT_VERSION_STR, QCoreApplication, QCryptographicHash +from PyQt5.QtCore import ( + QRegExp, QDir, QProcess, Qt, QByteArray, qVersion, PYQT_VERSION_STR, + QCoreApplication, QCryptographicHash +) from PyQt5.Qsci import QSCINTILLA_VERSION_STR, QsciScintilla # import these methods into the Utilities namespace @@ -228,8 +230,11 @@ try: import ThirdParty.CharDet.chardet guess = ThirdParty.CharDet.chardet.detect(text) - if guess and guess['confidence'] > 0.95 and \ - guess['encoding'] is not None: + if ( + guess and + guess['confidence'] > 0.95 and + guess['encoding'] is not None + ): codec = guess['encoding'].lower() return str(text, codec), '{0}-guessed'.format(codec) except (UnicodeError, LookupError): @@ -350,11 +355,13 @@ # Try the original encoding if origEncoding and origEncoding.endswith( ('-selected', '-default', '-guessed', '-ignore')): - coding = origEncoding\ - .replace("-selected", "")\ - .replace("-default", "")\ - .replace("-guessed", "")\ + coding = ( + origEncoding + .replace("-selected", "") + .replace("-default", "") + .replace("-guessed", "") .replace("-ignore", "") + ) try: etext, encoding = text.encode(coding), coding except (UnicodeError, LookupError): @@ -1059,8 +1066,12 @@ """ isDrive = False drive, directory = os.path.splitdrive(path) - if drive and len(drive) == 2 and drive.endswith(":") and \ - directory in ["", "\\", "/"]: + if ( + drive and + len(drive) == 2 and + drive.endswith(":") and + directory in ["", "\\", "/"] + ): isDrive = True return isDrive @@ -1078,8 +1089,10 @@ if f1 is None or f2 is None: return False - if normcaseabspath(os.path.realpath(f1)) == \ - normcaseabspath(os.path.realpath(f2)): + if ( + normcaseabspath(os.path.realpath(f1)) == + normcaseabspath(os.path.realpath(f2)) + ): return True return False @@ -1210,9 +1223,11 @@ continue fentry = os.path.join(path, entry) - if pattern and \ - not os.path.isdir(fentry) and \ - not fnmatch.fnmatch(entry, pattern): + if ( + pattern and + not os.path.isdir(fentry) and + not fnmatch.fnmatch(entry, pattern) + ): # entry doesn't fit the given pattern continue @@ -1245,8 +1260,10 @@ dirs = [] for name in names: - if os.path.isdir(os.path.join(path, name)) and \ - not os.path.islink(os.path.join(path, name)): + if ( + os.path.isdir(os.path.join(path, name)) and + not os.path.islink(os.path.join(path, name)) + ): exclude = 0 for e in excludeDirs: if name.split(os.sep, 1)[0] == e: @@ -1823,8 +1840,8 @@ venvName = Preferences.getDebugger("Python3VirtualEnv") else: venvName = Preferences.getDebugger("Python2VirtualEnv") - interpreter = e5App().getObject("VirtualEnvManager")\ - .getVirtualenvInterpreter(venvName) + interpreter = e5App().getObject( + "VirtualEnvManager").getVirtualenvInterpreter(venvName) prefix = os.path.dirname(interpreter) if toolname in ["pyside-uic", "pyside2-uic"]: return os.path.join(prefix, "Scripts", toolname + '.exe') @@ -1860,8 +1877,8 @@ pysideInformation = [] for venvNameKey in ["Python2VirtualEnv", "Python3VirtualEnv"]: venvName = Preferences.getDebugger(venvNameKey) - interpreter = e5App().getObject("VirtualEnvManager")\ - .getVirtualenvInterpreter(venvName) + interpreter = e5App().getObject( + "VirtualEnvManager").getVirtualenvInterpreter(venvName) if interpreter == "" or not isinpath(interpreter): hasPyside = False else: