diff -r 82b608e352ec -r 2bbec88047dd eric6/PipInterface/Pip.py --- a/eric6/PipInterface/Pip.py Wed Apr 21 17:56:12 2021 +0200 +++ b/eric6/PipInterface/Pip.py Wed Apr 21 19:40:50 2021 +0200 @@ -156,10 +156,11 @@ pip = "pip.ini" if Globals.isWindowsPlatform() else "pip.conf" venvManager = e5App().getObject("VirtualEnvManager") - if venvManager.isGlobalEnvironment(venvName): - venvDirectory = os.path.dirname(self.getUserConfig()) - else: - venvDirectory = venvManager.getVirtualenvDirectory(venvName) + venvDirectory = ( + os.path.dirname(self.getUserConfig()) + if venvManager.isGlobalEnvironment(venvName) else + venvManager.getVirtualenvDirectory(venvName) + ) config = os.path.join(venvDirectory, pip) if venvDirectory else "" @@ -239,10 +240,11 @@ return dia = PipDialog(self.tr('Install PIP')) - if userSite: - commands = [(interpreter, ["-m", "ensurepip", "--user"])] - else: - commands = [(interpreter, ["-m", "ensurepip"])] + commands = ( + [(interpreter, ["-m", "ensurepip", "--user"])] + if userSite else + [(interpreter, ["-m", "ensurepip"])] + ) if Preferences.getPip("PipSearchIndex"): indexUrl = Preferences.getPip("PipSearchIndex") + "/simple" args = ["-m", "pip", "install", "--index-url", indexUrl, @@ -297,8 +299,8 @@ if p.lower() in ["pyqt5", "pyqt5-sip", "pyqtwebengine", "qscintilla", "sip"]] - if bool(pyqtPackages): - abort = not E5MessageBox.yesNo( + abort = ( + not E5MessageBox.yesNo( None, self.tr("Upgrade Packages"), self.tr( @@ -306,8 +308,9 @@ """ not work for the current instance of Python ({0}).""" """ Do you want to continue?""").format(sys.executable), icon=E5MessageBox.Critical) - else: - abort = False + if bool(pyqtPackages) else + False + ) return abort @@ -500,10 +503,11 @@ @return index URL for PyPI @rtype str """ - if Preferences.getPip("PipSearchIndex"): - indexUrl = Preferences.getPip("PipSearchIndex") + "/simple" - else: - indexUrl = Pip.DefaultIndexUrlSimple + indexUrl = ( + Preferences.getPip("PipSearchIndex") + "/simple" + if Preferences.getPip("PipSearchIndex") else + Pip.DefaultIndexUrlSimple + ) return indexUrl @@ -514,10 +518,11 @@ @return index URL for XML RPC calls @rtype str """ - if Preferences.getPip("PipSearchIndex"): - indexUrl = Preferences.getPip("PipSearchIndex") + "/pypi" - else: - indexUrl = Pip.DefaultIndexUrlPypi + indexUrl = ( + Preferences.getPip("PipSearchIndex") + "/pypi" + if Preferences.getPip("PipSearchIndex") else + Pip.DefaultIndexUrlPypi + ) return indexUrl @@ -528,10 +533,11 @@ @return index URL for XML RPC calls @rtype str """ - if Preferences.getPip("PipSearchIndex"): - indexUrl = Preferences.getPip("PipSearchIndex") + "/search/" - else: - indexUrl = Pip.DefaultIndexUrlSearch + indexUrl = ( + Preferences.getPip("PipSearchIndex") + "/search/" + if Preferences.getPip("PipSearchIndex") else + Pip.DefaultIndexUrlSearch + ) return indexUrl