Corrected some f-string related issues, removed some obsolete (commented) code and corrected some code style issues.

Sun, 22 Dec 2024 16:24:30 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 22 Dec 2024 16:24:30 +0100
changeset 116
0f49bfab0768
parent 115
7ea2d2482bff
child 117
87478c256975

Corrected some f-string related issues, removed some obsolete (commented) code and corrected some code style issues.

PipxInterface/Documentation/Source/Plugin_Pipx_Interface.PipxInterface.Pipx.html file | annotate | diff | comparison | revisions
PipxInterface/Pipx.py file | annotate | diff | comparison | revisions
PipxInterface/PipxWidget.py file | annotate | diff | comparison | revisions
PluginPipxInterface.py file | annotate | diff | comparison | revisions
PluginPipxInterface.zip file | annotate | diff | comparison | revisions
--- a/PipxInterface/Documentation/Source/Plugin_Pipx_Interface.PipxInterface.Pipx.html	Sat Dec 14 15:28:55 2024 +0100
+++ b/PipxInterface/Documentation/Source/Plugin_Pipx_Interface.PipxInterface.Pipx.html	Sun Dec 22 16:24:30 2024 +0100
@@ -78,7 +78,7 @@
 </tr>
 <tr>
 <td><a href="#Pipx.__getBrokenDependencies">__getBrokenDependencies</a></td>
-<td></td>
+<td>Private method to get a list of broken dependencies.</td>
 </tr>
 <tr>
 <td><a href="#Pipx.__getPackageDependencies">__getPackageDependencies</a></td>
@@ -305,7 +305,29 @@
 <a NAME="Pipx.__getBrokenDependencies" ID="Pipx.__getBrokenDependencies"></a>
 <h4>Pipx.__getBrokenDependencies</h4>
 <b>__getBrokenDependencies</b>(<i>dependencies</i>)
+<p>
+        Private method to get a list of broken dependencies.
+</p>
 
+<dl>
+
+<dt><i>dependencies</i> (list of str)</dt>
+<dd>
+list of dependencies to be checked for being outdated
+</dd>
+</dl>
+<dl>
+<dt>Return:</dt>
+<dd>
+list of broken dependencies
+</dd>
+</dl>
+<dl>
+<dt>Return Type:</dt>
+<dd>
+list of str
+</dd>
+</dl>
 <a NAME="Pipx.__getPackageDependencies" ID="Pipx.__getPackageDependencies"></a>
 <h4>Pipx.__getPackageDependencies</h4>
 <b>__getPackageDependencies</b>(<i>package, uptodate=False, outdated=False</i>)
--- a/PipxInterface/Pipx.py	Sat Dec 14 15:28:55 2024 +0100
+++ b/PipxInterface/Pipx.py	Sun Dec 22 16:24:30 2024 +0100
@@ -836,72 +836,29 @@
         packagePath = ctx.venvs / package
         _venv = Venv(packagePath)
         return str(_venv.python_path)
-##
-    ##def __addDependency(self, dependency, parent):
-        ##"""
-        ##Private method to add a dependency branch to a given parent.
-##
-        ##@param dependency dependency to be added
-        ##@type dict
-        ##@param parent reference to the parent item
-        ##@type QTreeWidget or QTreeWidgetItem
-        ##"""
-        ##itm = QTreeWidgetItem(
-            ##parent,
-            ##[
-                ##dependency["package_name"],
-                ##dependency["installed_version"],
-                ##dependency["required_version"],
-            ##],
-        ##)
-        ##itm.setExpanded(True)
-##
-        ##if dependency["installed_version"] == "?":
-            ##itm.setText(PipPackagesWidget.DepInstalledVersionColumn, self.tr("unknown"))
-##
-        ##if dependency["required_version"].lower() not in ("any", "?"):
-            ##spec = (
-                ##"=={0}".format(dependency["required_version"])
-                ##if dependency["required_version"][0] in "0123456789"
-                ##else dependency["required_version"]
-            ##)
-            ##try:
-                ##specifierSet = SpecifierSet(specifiers=spec)
-                ##if not specifierSet.contains(dependency["installed_version"]):
-                    ##itm.setIcon(
-                        ##PipPackagesWidget.DepRequiredVersionColumn,
-                        ##EricPixmapCache.getIcon("warning"),
-                    ##)
-            ##except InvalidSpecifier:
-                ##itm.setText(
-                    ##PipPackagesWidget.DepRequiredVersionColumn,
-                    ##dependency["required_version"],
-                ##)
-##
-        ##elif dependency["required_version"].lower() == "any":
-            ##itm.setText(PipPackagesWidget.DepRequiredVersionColumn, self.tr("any"))
-##
-        ##elif dependency["required_version"] == "?":
-            ##itm.setText(PipPackagesWidget.DepRequiredVersionColumn, self.tr("unknown"))
-##
-        ### recursively add sub-dependencies
-        ##for dep in dependency["dependencies"]:
-            ##self.__addDependency(dep, itm)
 
     def __getBrokenDependencies(self, dependencies):
+        """
+        Private method to get a list of broken dependencies.
+
+        @param dependencies list of dependencies to be checked for being outdated
+        @type list of str
+        @return list of broken dependencies
+        @rtype list of str
+        """
         brokenDependecies = []
 
         for dependency in dependencies:
             if dependency["required_version"].lower() not in ("any", "?"):
                 spec = (
-                    "=={0}".format(dependency["required_version"])
+                    f"=={dependency['required_version']}"
                     if dependency["required_version"][0] in "0123456789"
                     else dependency["required_version"]
                 )
                 with contextlib.suppress(InvalidSpecifier):
                     specifierSet = SpecifierSet(specifiers=spec)
                     if not specifierSet.contains(dependency["installed_version"]):
-                        brokenDependecies.append(f"{dependency["package_name"]}{spec}")
+                        brokenDependecies.append(f"{dependency['package_name']}{spec}")
 
             # recursively add sub-dependencies
             brokenDependecies.extend(
--- a/PipxInterface/PipxWidget.py	Sat Dec 14 15:28:55 2024 +0100
+++ b/PipxInterface/PipxWidget.py	Sun Dec 22 16:24:30 2024 +0100
@@ -82,9 +82,7 @@
         )
         self.repairDependenciesButton.setIcon(
             EricPixmapCache.getIcon(
-                os.path.join(
-                    "PipxInterface", "icons", "repair{0}".format(iconSuffix)
-                )
+                os.path.join("PipxInterface", "icons", "repair{0}".format(iconSuffix))
             )
         )
 
@@ -664,7 +662,7 @@
     def __repairBrokenDependencies(self):
         """
         Private slot to repair broken (unmet) dependencies.
-        
+
         Note: This could be necessary after a dependencies upgrade. pip will tell you.
         """
         package = self.__selectedPackages()[0]
--- a/PluginPipxInterface.py	Sat Dec 14 15:28:55 2024 +0100
+++ b/PluginPipxInterface.py	Sun Dec 22 16:24:30 2024 +0100
@@ -36,7 +36,7 @@
     "author": "Detlev Offenbach <detlev@die-offenbachs.de>",
     "autoactivate": True,
     "deactivateable": True,
-    "version": "10.6.2",
+    "version": "10.6.3",
     "className": "PluginPipxInterface",
     "packageName": "PipxInterface",
     "shortDescription": "Graphical interface to the 'pipx' command.",
Binary file PluginPipxInterface.zip has changed

eric ide

mercurial