src/eric7/PipInterface/Pip.py

branch
eric7
changeset 10736
0d213bb8b7f0
parent 10690
fab36645aa7d
child 10740
2f76bfb902bc
--- a/src/eric7/PipInterface/Pip.py	Mon Jun 03 09:44:12 2024 +0200
+++ b/src/eric7/PipInterface/Pip.py	Mon Jun 03 10:18:13 2024 +0200
@@ -884,9 +884,9 @@
         @param callback method accepting a list of tuples containing the
             package name, installed version and available version
         @type function
-        @return list of tuples containing the package name, installed version
-            and available version
-        @rtype list of tuple of (str, str, str)
+        @return dictionary with the package name as key and a tuple containing the
+            installed and available version as the value
+        @rtype dict of [str: (str, str)]
         """
         packages = []
 
@@ -933,11 +933,11 @@
 
         @param proc reference to the process
         @type QProcess
-        @return list of tuples containing the package name, installed version
-            and available version
-        @rtype list of tuple of (str, str, str)
+        @return dictionary with the package name as key and a tuple containing the
+            installed and available version as the value
+        @rtype dict of [str: (str, str)]
         """
-        packages = []
+        packages = {}
 
         output = str(
             proc.readAllStandardOutput(),
@@ -953,12 +953,9 @@
 
             for package in jsonList:
                 if isinstance(package, dict):
-                    packages.append(
-                        (
-                            package["name"],
-                            package["version"],
-                            package["latest_version"],
-                        )
+                    packages[package["name"]] = (
+                        package["version"],
+                        package["latest_version"],
                     )
 
         return packages
@@ -1007,7 +1004,7 @@
                 start.lower() for start in packageStarts if bool(start)
             )
             filteredPackages = [
-                p for p in packages if p[0].lower().startswith(filterStrings)
+                p for p in packages if p.lower().startswith(filterStrings)
             ]
         else:
             filteredPackages = []

eric ide

mercurial