diff -r fb0ef164f536 -r 698ae46f40a4 eric6/VCS/VersionControl.py --- a/eric6/VCS/VersionControl.py Fri Apr 02 11:59:41 2021 +0200 +++ b/eric6/VCS/VersionControl.py Sat May 01 14:27:20 2021 +0200 @@ -9,6 +9,7 @@ """ import os +import contextlib from PyQt5.QtCore import ( QObject, QThread, QMutex, QProcess, Qt, pyqtSignal, QCoreApplication @@ -51,7 +52,7 @@ @param parent parent widget (QWidget) @param name name of this object (string) """ - super(VersionControl, self).__init__(parent) + super().__init__(parent) if name: self.setObjectName(name) self.defaultOptions = { @@ -521,10 +522,8 @@ """ if self.vcsSupportCommandOptions(): for key in options: - try: + with contextlib.suppress(KeyError): self.options[key] = options[key] - except KeyError: - pass def vcsGetOptions(self): """ @@ -545,10 +544,8 @@ @param data a dictionary of vcs specific data """ for key in data: - try: + with contextlib.suppress(KeyError): self.otherData[key] = data[key] - except KeyError: - pass def vcsGetOtherData(self): """ @@ -717,12 +714,11 @@ @param project reference to the project object @return reference to the monitor thread (QThread) """ - if project.pudata["VCSSTATUSMONITORINTERVAL"]: - vcsStatusMonitorInterval = project.pudata[ - "VCSSTATUSMONITORINTERVAL"] - else: - vcsStatusMonitorInterval = Preferences.getVCS( - "StatusMonitorInterval") + vcsStatusMonitorInterval = ( + project.pudata["VCSSTATUSMONITORINTERVAL"] + if project.pudata["VCSSTATUSMONITORINTERVAL"] else + Preferences.getVCS("StatusMonitorInterval") + ) if vcsStatusMonitorInterval > 0: self.statusMonitorThread = self._createStatusMonitorThread( vcsStatusMonitorInterval, project)