--- a/src/eric7/PipInterface/Pip.py Mon Oct 31 14:07:57 2022 +0100 +++ b/src/eric7/PipInterface/Pip.py Wed Nov 30 09:19:51 2022 +0100 @@ -7,19 +7,20 @@ Package implementing the pip GUI logic. """ +import contextlib +import json import os import sys -import json -import contextlib -from PyQt6.QtCore import pyqtSlot, QObject, QProcess, QUrl, QCoreApplication, QThread +from PyQt6.QtCore import QCoreApplication, QObject, QProcess, QThread, QUrl, pyqtSlot +from PyQt6.QtNetwork import QNetworkAccessManager, QNetworkReply, QNetworkRequest from PyQt6.QtWidgets import QDialog, QInputDialog, QLineEdit -from PyQt6.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply +from eric7 import Globals, Preferences +from eric7.EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp - -from eric7.EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired +from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog try: from eric7.EricNetwork.EricSslErrorHandler import EricSslErrorHandler @@ -31,8 +32,6 @@ from .PipDialog import PipDialog from .PipVulnerabilityChecker import PipVulnerabilityChecker -from eric7 import Globals, Preferences - class Pip(QObject): """ @@ -507,10 +506,6 @@ """ res = False if packages and venvName: - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"), @@ -535,9 +530,9 @@ @param venvName name of the virtual environment to be used @type str """ + from .PipFileSelectionDialog import PipFileSelectionDialog + if venvName: - from .PipFileSelectionDialog import PipFileSelectionDialog - dlg = PipFileSelectionDialog(self, "requirements", install=False) if dlg.exec() == QDialog.DialogCode.Accepted: requirements, _user = dlg.getData() @@ -548,10 +543,6 @@ except OSError: return - from eric7.UI.DeleteFilesConfirmationDialog import ( - DeleteFilesConfirmationDialog, - ) - dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"), @@ -806,7 +797,7 @@ data = str( reply.readAll(), Preferences.getSystem("IOEncoding"), "replace" ) - with contextlib.suppress(Exception): + with contextlib.suppress(json.JSONDecodeError): result = json.loads(data) return result @@ -836,7 +827,7 @@ dataStr = str( reply.readAll(), Preferences.getSystem("IOEncoding"), "replace" ) - with contextlib.suppress(Exception): + with contextlib.suppress(json.JSONDecodeError, KeyError): data = json.loads(dataStr) result = list(data["releases"].keys())