Mon, 22 May 2023 09:07:37 +0200
Corrected some code style issues detected by the extended checkers.
--- a/src/eric7/DataViews/CodeMetrics.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/DataViews/CodeMetrics.py Mon May 22 09:07:37 2023 +0200 @@ -211,7 +211,7 @@ """ try: text = Utilities.readEncodedFile(filename)[0] - except (UnicodeError, OSError): + except (OSError, UnicodeError): return SourceStat() parser = Parser()
--- a/src/eric7/DataViews/PyProfileDialog.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/DataViews/PyProfileDialog.py Mon May 22 09:07:37 2023 +0200 @@ -262,7 +262,7 @@ try: with open(fname, "rb") as f: self.stats = pickle.load(f) # secok - except (OSError, pickle.PickleError, EOFError): + except (EOFError, OSError, pickle.PickleError): EricMessageBox.critical( self, self.tr("Loading Profiling Data"),
--- a/src/eric7/DebugClients/Python/DebugClientBase.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/DebugClients/Python/DebugClientBase.py Mon May 22 09:07:37 2023 +0200 @@ -2095,7 +2095,7 @@ try: port = int(sys.argv[1]) - except (ValueError, IndexError): + except (IndexError, ValueError): port = -1 if sys.argv[2] == "True": @@ -2105,7 +2105,7 @@ else: try: redirect = int(sys.argv[2]) - except (ValueError, IndexError): + except (IndexError, ValueError): redirect = True ipOrHost = sys.argv[3]
--- a/src/eric7/EricNetwork/EricJsonClient.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/EricNetwork/EricJsonClient.py Mon May 22 09:07:37 2023 +0200 @@ -137,7 +137,7 @@ # reset select errors selectErrors = 0 - except (select.error, KeyboardInterrupt, socket.error): + except (KeyboardInterrupt, select.error, socket.error): selectErrors += 1 except Exception: @@ -186,7 +186,7 @@ else: self.handleCall(method, params) - except (select.error, KeyboardInterrupt, socket.error): + except (KeyboardInterrupt, select.error, socket.error): # just ignore these pass
--- a/src/eric7/Graphics/UMLDialog.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Graphics/UMLDialog.py Mon May 22 09:07:37 2023 +0200 @@ -465,7 +465,7 @@ with open(filename, "w") as f: f.write(jsonString) return True - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: EricMessageBox.critical( self, self.tr("Save Diagram"),
--- a/src/eric7/MultiProject/MultiProjectFile.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/MultiProject/MultiProjectFile.py Mon May 22 09:07:37 2023 +0200 @@ -66,7 +66,7 @@ jsonString = json.dumps(multiProjectDict, indent=2) with open(filename, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: with EricOverridenCursor(): EricMessageBox.critical( None,
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py Mon May 22 09:07:37 2023 +0200 @@ -581,7 +581,7 @@ if AstUtilities.isString(annotationNode): try: annotationNode = ast.parse(annotationNode.s).body[0].value - except (SyntaxError, IndexError): + except (IndexError, SyntaxError): return defaultComplexity complexity = defaultComplexity @@ -617,7 +617,7 @@ if AstUtilities.isString(annotationNode): try: annotationNode = ast.parse(annotationNode.s).body[0].value - except (SyntaxError, IndexError): + except (IndexError, SyntaxError): return annotationLength if isinstance(annotationNode, ast.Subscript):
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Mon May 22 09:07:37 2023 +0200 @@ -1007,7 +1007,7 @@ try: source, encoding = Utilities.readEncodedFile(self.filename) source = source.splitlines(True) - except (UnicodeError, OSError) as msg: + except (OSError, UnicodeError) as msg: self.results = CodeStyleCheckerDialog.hasResults self.__createFileErrorItem(self.filename, str(msg)) self.progress += 1 @@ -1053,7 +1053,7 @@ try: source, encoding = Utilities.readEncodedFile(filename) source = source.splitlines(True) - except (UnicodeError, OSError) as msg: + except (OSError, UnicodeError) as msg: self.results = CodeStyleCheckerDialog.hasResults self.__createFileErrorItem(filename, str(msg)) continue
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Mon May 22 09:07:37 2023 +0200 @@ -2953,7 +2953,7 @@ rank += maxLength rank += len(lines) - badStartingSymbol = {"(": ")", "[": "]", "{": "}"}.get(lines[0][-1], None) + badStartingSymbol = {"(": ")", "[": "]", "{": "}"}.get(lines[0][-1]) if ( len(lines) > 1
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/translations.py Mon May 22 09:07:37 2023 +0200 @@ -344,27 +344,27 @@ " It is therefore recommended to use a stacklevel of 2 or" " greater to provide more information to the user.", ), - "M529":QCoreApplication.translate( + "M529": QCoreApplication.translate( "MiscellaneousChecker", "Using 'except ():' with an empty tuple does not handle/catch " "anything. Add exceptions to handle.", - ), - "M530":QCoreApplication.translate( + ), + "M530": QCoreApplication.translate( "MiscellaneousChecker", "Except handlers should only be names of exception classes", - ), - "M531":QCoreApplication.translate( + ), + "M531": QCoreApplication.translate( "MiscellaneousChecker", "Using the generator returned from 'itertools.groupby()' more than once" " will do nothing on the second usage. Save the result to a list, if the" " result is needed multiple times.", - ), - "M532":QCoreApplication.translate( + ), + "M532": QCoreApplication.translate( "MiscellaneousChecker", "Possible unintentional type annotation (using ':'). Did you mean to" " assign (using '=')?", ), - "M533":QCoreApplication.translate( + "M533": QCoreApplication.translate( "MiscellaneousChecker", "Sets should not contain duplicate items. Duplicate items will be replaced" " with a single item at runtime.",
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/insecureHashlibNew.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/insecureHashlibNew.py Mon May 22 09:07:37 2023 +0200 @@ -73,7 +73,7 @@ ) elif func == "new": args = context.callArgs - name = args[0] if args else keywords.get("name", None) + name = args[0] if args else keywords.get("name") if ( isinstance(name, str) and name.lower() in insecureHashes @@ -113,7 +113,7 @@ if "hashlib" in qualnameList and func == "new": args = context.callArgs keywords = context.callKeywords - name = args[0] if args else keywords.get("name", None) + name = args[0] if args else keywords.get("name") if isinstance(name, str) and name.lower() in insecureHashes: reportError( context.node.lineno - 1,
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py Mon May 22 09:07:37 2023 +0200 @@ -1899,13 +1899,12 @@ @param node reference to the AST node to be checked @type ast.Call """ - errors = [] if not ( isinstance(node.func, ast.Attribute) and node.func.attr == "get" and isinstance(node.func.ctx, ast.Load) ): - return errors + return # check the argument value if not ( @@ -1913,7 +1912,7 @@ and isinstance(node.args[1], BOOL_CONST_TYPES) and node.args[1].value is None ): - return errors + return actual = unparse(node) func = unparse(node.func) @@ -1921,5 +1920,6 @@ expected = f"{func}({key})" self.__error(node.lineno - 1, node.col_offset, "Y910", expected, actual) + # # eflag: noqa = M891
--- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Mon May 22 09:07:37 2023 +0200 @@ -327,7 +327,7 @@ try: self.source = Utilities.readEncodedFile(self.filename)[0] self.source = Utilities.normalizeCode(self.source) - except (UnicodeError, OSError) as msg: + except (OSError, UnicodeError) as msg: self.noResults = False self.__createResultItem( self.filename, @@ -364,7 +364,7 @@ try: source = Utilities.readEncodedFile(filename)[0] source = Utilities.normalizeCode(source) - except (UnicodeError, OSError) as msg: + except (OSError, UnicodeError) as msg: self.noResults = False self.__createResultItem( self.filename, @@ -439,7 +439,7 @@ source = Utilities.readEncodedFile(fn)[0] source = Utilities.normalizeCode(source) source = source.splitlines() - except (UnicodeError, OSError): + except (OSError, UnicodeError): source = "" else: source = self.source.splitlines()
--- a/src/eric7/Preferences/ConfigurationPages/EmailPage.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/EmailPage.py Mon May 22 09:07:37 2023 +0200 @@ -197,7 +197,7 @@ EricMessageBox.information( self, self.tr("Login Test"), self.tr("""The login test succeeded.""") ) - except (smtplib.SMTPException, OSError) as e: + except (OSError, smtplib.SMTPException) as e: if isinstance(e, smtplib.SMTPResponseException): errorStr = e.smtp_error.decode() elif isinstance(e, socket.timeout):
--- a/src/eric7/Preferences/HighlightingStylesFile.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Preferences/HighlightingStylesFile.py Mon May 22 09:07:37 2023 +0200 @@ -85,7 +85,7 @@ jsonString = json.dumps(stylesDict, indent=2) with open(filename, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: with EricOverridenCursor(): EricMessageBox.critical( None,
--- a/src/eric7/Preferences/ProgramsDialog.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Preferences/ProgramsDialog.py Mon May 22 09:07:37 2023 +0200 @@ -286,7 +286,7 @@ version = enchant.__version__ except AttributeError: version = self.tr("(unknown)") - except (ImportError, AttributeError, OSError): + except (AttributeError, ImportError, OSError): text = "enchant" version = "" self.__createEntry(self.tr("Spell Checker - PyEnchant"), text, version) @@ -303,7 +303,7 @@ version = pygments.__version__ except AttributeError: version = self.tr("(unknown)") - except (ImportError, AttributeError, OSError): + except (AttributeError, ImportError, OSError): text = "pygments" version = "" self.__createEntry(self.tr("Source Highlighter - Pygments"), text, version) @@ -370,7 +370,7 @@ version = jedi.__version__ except AttributeError: version = self.tr("(unknown)") - except (ImportError, AttributeError, OSError): + except (AttributeError, ImportError, OSError): text = "jedi" version = "" self.__createEntry(self.tr("Code Assistant - Jedi"), text, version)
--- a/src/eric7/Preferences/ShortcutsFile.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Preferences/ShortcutsFile.py Mon May 22 09:07:37 2023 +0200 @@ -158,7 +158,7 @@ jsonString = json.dumps(shortcutsDict, indent=2) with open(filename, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: with EricOverridenCursor(): EricMessageBox.critical( None,
--- a/src/eric7/Preferences/ThemeManager.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Preferences/ThemeManager.py Mon May 22 09:07:37 2023 +0200 @@ -72,7 +72,7 @@ with open(filename, "r") as f: jsonString = f.read() themeDict = json.loads(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: EricMessageBox.critical( None, self.tr("Import Theme"), @@ -202,7 +202,7 @@ jsonString = json.dumps(themeDict, indent=2) with open(filename, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: EricMessageBox.critical( None, self.tr("Export Theme"),
--- a/src/eric7/Project/DebuggerPropertiesFile.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Project/DebuggerPropertiesFile.py Mon May 22 09:07:37 2023 +0200 @@ -68,7 +68,7 @@ jsonString = json.dumps(debuggerPropertiesDict, indent=2) with open(filename, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: with EricOverridenCursor(): EricMessageBox.critical( None,
--- a/src/eric7/Project/ProjectFile.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Project/ProjectFile.py Mon May 22 09:07:37 2023 +0200 @@ -68,16 +68,6 @@ # modify paths to contain universal separators for key in self.__project.getFileCategories() + ["TRANSLATIONEXCEPTIONS"]: - ##for key in ( - ##"SOURCES", - ##"FORMS", - ##"TRANSLATIONS", - ##"TRANSLATIONEXCEPTIONS", - ##"RESOURCES", - ##"INTERFACES", - ##"PROTOCOLS", - ##"OTHERS", - ##): with contextlib.suppress(KeyError): projectDict["project"][key] = sorted( [ @@ -102,7 +92,7 @@ jsonString = json.dumps(projectDict, indent=2, sort_keys=True) with open(filename, "w", newline="") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: with EricOverridenCursor(): EricMessageBox.critical( None,
--- a/src/eric7/Project/UserProjectFile.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Project/UserProjectFile.py Mon May 22 09:07:37 2023 +0200 @@ -64,7 +64,7 @@ jsonString = json.dumps(userProjectDict, indent=2) with open(filename, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: with EricOverridenCursor(): EricMessageBox.critical( None,
--- a/src/eric7/QScintilla/Editor.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/QScintilla/Editor.py Mon May 22 09:07:37 2023 +0200 @@ -3329,7 +3329,7 @@ ) else: txt, self.encoding = Utilities.readEncodedFile(fn) - except (UnicodeDecodeError, OSError) as why: + except (OSError, UnicodeDecodeError) as why: EricMessageBox.critical( self.vm, self.tr("Open File"), @@ -3449,7 +3449,7 @@ if createBackup and perms_valid: os.chmod(fn, permissions) return True - except (OSError, Utilities.CodingError, UnicodeError) as why: + except (OSError, UnicodeError, Utilities.CodingError) as why: EricMessageBox.critical( self, self.tr("Save File"),
--- a/src/eric7/QScintilla/MiniEditor.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/QScintilla/MiniEditor.py Mon May 22 09:07:37 2023 +0200 @@ -3192,7 +3192,7 @@ ) else: txt, self.encoding = Utilities.readEncodedFile(fileName) - except (UnicodeDecodeError, OSError) as why: + except (OSError, UnicodeDecodeError) as why: EricMessageBox.critical( self, self.tr("Open File"), @@ -3302,7 +3302,7 @@ self.encoding = Utilities.writeEncodedFile( fileName, txt, self.encoding, forcedEncoding=editorConfigEncoding ) - except (OSError, Utilities.CodingError, UnicodeError) as why: + except (OSError, UnicodeError, Utilities.CodingError) as why: EricMessageBox.critical( self, self.tr("Save File"),
--- a/src/eric7/Sessions/SessionFile.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Sessions/SessionFile.py Mon May 22 09:07:37 2023 +0200 @@ -226,7 +226,7 @@ jsonString = json.dumps(sessionDict, indent=2) with open(filename, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: with EricOverridenCursor(): EricMessageBox.critical( None,
--- a/src/eric7/Tasks/TaskViewer.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Tasks/TaskViewer.py Mon May 22 09:07:37 2023 +0200 @@ -847,7 +847,7 @@ try: text, encoding = Utilities.readEncodedFile(fn) lines = text.splitlines() - except (UnicodeError, OSError): + except (OSError, UnicodeError): count += 1 progress.setValue(count) continue @@ -978,7 +978,7 @@ try: text, encoding = Utilities.readEncodedFile(fn) lines = text.splitlines() - except (UnicodeError, OSError): + except (OSError, UnicodeError): continue # now search tasks and record them
--- a/src/eric7/Tasks/TasksFile.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Tasks/TasksFile.py Mon May 22 09:07:37 2023 +0200 @@ -87,7 +87,7 @@ jsonString = json.dumps(tasksDict, indent=2) with open(filename, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: with EricOverridenCursor(): EricMessageBox.critical( None,
--- a/src/eric7/Templates/TemplatesFile.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Templates/TemplatesFile.py Mon May 22 09:07:37 2023 +0200 @@ -79,7 +79,7 @@ jsonString = json.dumps(templatesDict, indent=2) with open(filename, "w") as f: f.write(jsonString) - except (TypeError, OSError) as err: + except (OSError, TypeError) as err: with EricOverridenCursor(): EricMessageBox.critical( None,
--- a/src/eric7/Testing/Interfaces/PytestExecutor.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Testing/Interfaces/PytestExecutor.py Mon May 22 09:07:37 2023 +0200 @@ -297,7 +297,7 @@ for heading, text in sections: extraText += "----- {0} -----\n{1}".format(heading, text) - duration = data.get("duration_s", None) + duration = data.get("duration_s") if duration: # convert to ms duration *= 1000
--- a/src/eric7/Testing/Interfaces/UnittestExecutor.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Testing/Interfaces/UnittestExecutor.py Mon May 22 09:07:37 2023 +0200 @@ -238,7 +238,7 @@ description=data["description"], message=message, extra=tracebackLines, - duration=data.get("duration_ms", None), + duration=data.get("duration_ms"), filename=filename, lineno=lineno, subtestResult=data.get("subtest", False),
--- a/src/eric7/UI/EmailDialog.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/UI/EmailDialog.py Mon May 22 09:07:37 2023 +0200 @@ -352,7 +352,7 @@ return False try: server.login(Preferences.getUser("MailServerUser"), password) - except (smtplib.SMTPException, OSError) as e: + except (OSError, smtplib.SMTPException) as e: if isinstance(e, smtplib.SMTPResponseException): errorStr = e.smtp_error.decode() elif isinstance(e, OSError): @@ -377,7 +377,7 @@ with EricOverrideCursor(): server.sendmail(Preferences.getUser("Email"), self.__toAddress, msg) server.quit() - except (smtplib.SMTPException, OSError) as e: + except (OSError, smtplib.SMTPException) as e: if isinstance(e, smtplib.SMTPResponseException): errorStr = e.smtp_error.decode() elif isinstance(e, smtplib.SMTPException):
--- a/src/eric7/UI/FindFileWidget.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/UI/FindFileWidget.py Mon May 22 09:07:37 2023 +0200 @@ -643,7 +643,7 @@ try: text, encoding, hashStr = Utilities.readEncodedFileWithHash(fn) lines = text.splitlines(True) - except (UnicodeError, OSError): + except (OSError, UnicodeError): self.findProgress.setValue(progress) continue @@ -845,7 +845,7 @@ try: text, encoding, hashStr = Utilities.readEncodedFileWithHash(fn) lines = text.splitlines(True) - except (UnicodeError, OSError) as err: + except (OSError, UnicodeError) as err: EricMessageBox.critical( self, self.tr("Replace in Files"), @@ -884,7 +884,7 @@ txt = "".join(lines) try: Utilities.writeEncodedFile(fn, txt, encoding) - except (OSError, Utilities.CodingError, UnicodeError) as err: + except (OSError, UnicodeError, Utilities.CodingError) as err: EricMessageBox.critical( self, self.tr("Replace in Files"),
--- a/src/eric7/Utilities/ClassBrowsers/pyclbr.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Utilities/ClassBrowsers/pyclbr.py Mon May 22 09:07:37 2023 +0200 @@ -381,7 +381,7 @@ try: src = Utilities.readEncodedFile(file)[0] - except (UnicodeError, OSError): + except (OSError, UnicodeError): # can't do anything with this module return {}
--- a/src/eric7/Utilities/ClassBrowsers/rbclbr.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Utilities/ClassBrowsers/rbclbr.py Mon May 22 09:07:37 2023 +0200 @@ -283,7 +283,7 @@ try: src = Utilities.readEncodedFile(file)[0] - except (UnicodeError, OSError): + except (OSError, UnicodeError): # can't do anything with this module return {}
--- a/src/eric7/Utilities/FtpUtilities.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Utilities/FtpUtilities.py Mon May 22 09:07:37 2023 +0200 @@ -241,13 +241,13 @@ try: month, day, year = [int(part) for part in date.split("-")] year = 1900 + year if year >= 70 else 2000 + year - except (ValueError, IndexError): + except (IndexError, ValueError): raise FtpDirLineParserError("illegal date string '{0}'".format(month)) try: hour, minute, am_pm = time[0:2], time[3:5], time[5] hour = int(hour) minute = int(minute) - except (ValueError, IndexError): + except (IndexError, ValueError): raise FtpDirLineParserError("illegal time string '{0}'".format(month)) if hour == 12 and am_pm == "A": hour = 0
--- a/src/eric7/Utilities/__init__.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/Utilities/__init__.py Mon May 22 09:07:37 2023 +0200 @@ -295,7 +295,7 @@ 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): + except (LookupError, UnicodeError): pass except ImportError: pass @@ -392,7 +392,7 @@ if coding: try: etext, encoding = text.encode(coding), coding - except (UnicodeError, LookupError): + except (LookupError, UnicodeError): # Error: Declared encoding is incorrect raise CodingError(coding) else: @@ -483,7 +483,7 @@ if guess and guess["encoding"] is not None: codec = guess["encoding"].lower() return str(buffer, encoding=codec) - except (UnicodeError, LookupError): + except (LookupError, UnicodeError): pass except ImportError: pass @@ -717,7 +717,7 @@ """ try: source, encoding = readEncodedFile(filename) - except (UnicodeError, OSError): + except (OSError, UnicodeError): return {} return extractFlags(source) @@ -1058,7 +1058,7 @@ from PyQt6 import QtCharts # __IGNORE_WARNING_I10__ info.append(" PyQt6-Charts {0}".format(QtCharts.PYQT_CHART_VERSION_STR)) - except (ImportError, AttributeError): + except (AttributeError, ImportError): info.append(" PyQt6-Charts not installed") try: from PyQt6 import QtWebEngineCore # __IGNORE_WARNING_I10__ @@ -1066,7 +1066,7 @@ info.append( " PyQt6-WebEngine {0}".format(QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) ) - except (ImportError, AttributeError): + except (AttributeError, ImportError): info.append(" PyQt6-WebEngine not installed") info.append(" PyQt6-QScintilla {0}".format(QSCINTILLA_VERSION_STR)) info.append(" sip {0}".format(sip_version_str))
--- a/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Mon May 22 09:07:37 2023 +0200 @@ -106,7 +106,7 @@ try: with open(self.__fileName, "rb") as f: bookmarksDict = plistlib.load(f) - except (plistlib.InvalidFileException, OSError) as err: + except (OSError, plistlib.InvalidFileException) as err: self._error = True self._errorString = self.tr( "Bookmarks file cannot be read.\nReason: {0}".format(str(err))
--- a/src/eric7/WebBrowser/Sync/FtpSyncHandler.py Mon May 22 08:46:00 2023 +0200 +++ b/src/eric7/WebBrowser/Sync/FtpSyncHandler.py Mon May 22 09:07:37 2023 +0200 @@ -114,7 +114,7 @@ self.__initialSync() self.__state = "idle" self.__idleTimer.start() - except ftplib.all_errors + (EricFtpProxyError,) as err: + except ftplib.all_errors + (EricFtpProxyError,) as err: # noqa: M530 self.syncError.emit(str(err)) def __connectAndLogin(self):