--- a/Utilities/__init__.py Sat Mar 11 14:35:22 2017 +0100 +++ b/Utilities/__init__.py Sat Mar 11 18:08:42 2017 +0100 @@ -201,10 +201,9 @@ f = open(filename, "rb") text = f.read() f.close() - hash = str(QCryptographicHash.hash( - QByteArray(text), QCryptographicHash.Md5).toHex(), - encoding="ASCII") - return decode(text) + (hash, ) + hashStr = str(QCryptographicHash.hash( + QByteArray(text), QCryptographicHash.Md5).toHex(), encoding="ASCII") + return decode(text) + (hashStr, ) def decode(text): @@ -460,16 +459,16 @@ } -def escape_entities(m, map=_escape_map): +def escape_entities(m, escmap=_escape_map): """ Function to encode html entities. @param m the match object - @param map the map of entities to encode + @param escmap the map of entities to encode @return the converted text (string) """ char = m.group() - text = map.get(char) + text = escmap.get(char) if text is None: text = "&#{0:d};".format(ord(char)) return text @@ -527,8 +526,8 @@ @return the converted text (string) """ char = m.group() - ord = int(char[2:-1]) - return chr(ord) + ordinal = int(char[2:-1]) + return chr(ordinal) def html_udecode(text, pattern=_uunescape): @@ -825,8 +824,8 @@ return False dirs = path.split(os.pathsep) - for dir in dirs: - if os.access(os.path.join(dir, file), os.X_OK): + for directory in dirs: + if os.access(os.path.join(directory, file), os.X_OK): return True return False @@ -942,8 +941,8 @@ return "" dirs = path.split(os.pathsep) - for dir in dirs: - exe = os.path.join(dir, file) + for directory in dirs: + exe = os.path.join(directory, file) if os.access(exe, os.X_OK): return exe @@ -977,8 +976,8 @@ # environment variable not defined if path is not None: dirs = path.split(os.pathsep) - for dir in dirs: - exe = os.path.join(dir, file) + for directory in dirs: + exe = os.path.join(directory, file) if os.access(exe, os.X_OK) and exe not in paths: paths.append(exe) @@ -1020,9 +1019,9 @@ return "" dirs = path.split(os.pathsep) - for dir in dirs: + for directory in dirs: for filename in filenames: - exe = os.path.join(dir, filename) + exe = os.path.join(directory, filename) if os.access(exe, os.X_OK): return exe @@ -1575,12 +1574,12 @@ @return the requested entry or the default value, if the entry wasn't found (string or None) """ - filter = QRegExp("^{0}[ \t]*=".format(key)) + filterRe = QRegExp("^{0}[ \t]*=".format(key)) if isWindowsPlatform(): - filter.setCaseSensitivity(Qt.CaseInsensitive) + filterRe.setCaseSensitivity(Qt.CaseInsensitive) entries = [e for e in QProcess.systemEnvironment() - if filter.indexIn(e) != -1] + if filterRe.indexIn(e) != -1] if not entries: return default @@ -1596,12 +1595,12 @@ @param key key of the requested environment entry (string) @return flag indicating the presence of the requested entry (boolean) """ - filter = QRegExp("^{0}[ \t]*=".format(key)) + filterRe = QRegExp("^{0}[ \t]*=".format(key)) if isWindowsPlatform(): - filter.setCaseSensitivity(Qt.CaseInsensitive) + filterRe.setCaseSensitivity(Qt.CaseInsensitive) entries = [e for e in QProcess.systemEnvironment() - if filter.indexIn(e) != -1] + if filterRe.indexIn(e) != -1] return len(entries) > 0 ###############################################################################