Corrected some code style issues and converted some source code documentation to the new style. eric7

Sat, 23 Dec 2023 17:16:21 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Dec 2023 17:16:21 +0100
branch
eric7
changeset 168
fee59283137b
parent 167
d0f4aa941afe
child 169
0405f4f83719

Corrected some code style issues and converted some source code documentation to the new style.

PluginProjectPyramid.py file | annotate | diff | comparison | revisions
PluginPyramid.epj file | annotate | diff | comparison | revisions
ProjectPyramid/CreateParametersDialog.py file | annotate | diff | comparison | revisions
ProjectPyramid/DistributionTypeSelectionDialog.py file | annotate | diff | comparison | revisions
ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.Project.html file | annotate | diff | comparison | revisions
ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidDialog.html file | annotate | diff | comparison | revisions
ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidRoutesDialog.html file | annotate | diff | comparison | revisions
ProjectPyramid/MigrateSummaryDialog.py file | annotate | diff | comparison | revisions
ProjectPyramid/Project.py file | annotate | diff | comparison | revisions
ProjectPyramid/PyramidRoutesDialog.py file | annotate | diff | comparison | revisions
--- a/PluginProjectPyramid.py	Sat Dec 23 15:48:53 2023 +0100
+++ b/PluginProjectPyramid.py	Sat Dec 23 17:16:21 2023 +0100
@@ -43,7 +43,7 @@
 pyramidPluginObject = None
 
 
-def createPyramidPage(configDlg):
+def createPyramidPage(configDlg):  # noqa: U100
     """
     Module function to create the Pyramid configuration page.
 
@@ -52,8 +52,9 @@
     @return reference to the configuration page
     @rtype PyramidPage
     """
+    from ProjectPyramid.ConfigurationPage.PyramidPage import PyramidPage
+
     global pyramidPluginObject
-    from ProjectPyramid.ConfigurationPage.PyramidPage import PyramidPage
 
     return PyramidPage(pyramidPluginObject)
 
@@ -196,27 +197,10 @@
                 progLanguages=self.__supportedVariants[:],
             )
 
-        try:
-            # backward compatibility for eric7 < 22.12
-            from eric7.Project.ProjectBrowser import (
-                FormsBrowserFlag,
-                OthersBrowserFlag,
-                SourcesBrowserFlag,
-                TranslationsBrowserFlag,
-            )
-
-            Preferences.setProjectBrowserFlagsDefault(
-                "Pyramid",
-                SourcesBrowserFlag
-                | FormsBrowserFlag
-                | TranslationsBrowserFlag
-                | OthersBrowserFlag,
-            )
-        except ImportError:
-            Preferences.setProjectBrowsersDefault(
-                "Pyramid",
-                ("sources", "forms", "translations", "others"),
-            )
+        Preferences.setProjectBrowsersDefault(
+            "Pyramid",
+            ("sources", "forms", "translations", "others"),
+        )
 
         if self.__ericProject.isOpen():
             self.__projectOpened()
@@ -475,3 +459,7 @@
         import cookiecutter  # __IGNORE_WARNING__
     except ImportError:
         pipInstall(["cookiecutter"])
+
+
+#
+# eflag: noqa = U200
--- a/PluginPyramid.epj	Sat Dec 23 15:48:53 2023 +0100
+++ b/PluginPyramid.epj	Sat Dec 23 17:16:21 2023 +0100
@@ -1,7 +1,7 @@
 {
   "header": {
     "comment": "eric project file for project PluginPyramid",
-    "copyright": "Copyright (C) 2022 Detlev Offenbach, detlev@die-offenbachs.de"
+    "copyright": "Copyright (C) 2023 Detlev Offenbach, detlev@die-offenbachs.de"
   },
   "project": {
     "AUTHOR": "Detlev Offenbach",
@@ -11,10 +11,14 @@
           "AllowStarArgAny": false,
           "AllowUntypedDefs": false,
           "AllowUntypedNested": false,
+          "CheckFutureAnnotations": false,
           "DispatchDecorators": [
             "singledispatch",
             "singledispatchmethod"
           ],
+          "ExemptedTypingSymbols": [
+            ""
+          ],
           "ForceFutureAnnotations": false,
           "MaximumComplexity": 3,
           "MaximumLength": 7,
@@ -62,15 +66,18 @@
         "CopyrightAuthor": "",
         "CopyrightMinFileSize": 0,
         "DocstringType": "eric_black",
-        "EnabledCheckerCategories": "C, D, E, M, N, S, Y, W",
+        "EnabledCheckerCategories": "C, D, E, I, L, M, NO, N, S, Y, U, W",
         "ExcludeFiles": "*/Ui_*.py, */*_rc.py",
-        "ExcludeMessages": "C101,E265,E266,E305,E402,M201,M301,M302,M303,M304,M305,M306,M307,M308,M311,M312,M313,M314,M315,M321,M701,M702,M811,M834,N802,N803,N807,N808,N821,W293,W503,Y401,Y402",
+        "ExcludeMessages": "C101,E265,E266,E305,E402,M201,M301,M302,M303,M304,M305,M306,M307,M308,M311,M312,M313,M314,M315,M321,M701,M702,M811,M834,M852,N802,N803,N807,N808,N821,W293,W503,Y401,Y402",
         "FixCodes": "",
         "FixIssues": false,
         "FutureChecker": "",
         "HangClosing": false,
         "ImportsChecker": {
-          "ApplicationPackageNames": [],
+          "ApplicationPackageNames": [
+            "ProjectPyramid",
+            "eric7"
+          ],
           "BanRelativeImports": "",
           "BannedModules": []
         },
@@ -80,6 +87,17 @@
         "MaxCodeComplexity": 10,
         "MaxDocLineLength": 88,
         "MaxLineLength": 88,
+        "NameOrderChecker": {
+          "ApplicationPackageNames": [
+            "ProjectPyramid",
+            "eric7"
+          ],
+          "CombinedAsImports": false,
+          "SortCaseSensitive": false,
+          "SortFromFirst": false,
+          "SortIgnoringStyle": false,
+          "SortOrder": "natural"
+        },
         "NoFixCodes": "E501",
         "RepeatMessages": true,
         "SecurityChecker": {
@@ -113,6 +131,19 @@
           "WeakKeySizeRsaMedium": "2048"
         },
         "ShowIgnored": false,
+        "UnusedChecker": {
+          "IgnoreAbstract": true,
+          "IgnoreDunderGlobals": true,
+          "IgnoreDunderMethods": true,
+          "IgnoreEventHandlerMethods": false,
+          "IgnoreLambdas": false,
+          "IgnoreNestedFunctions": false,
+          "IgnoreOverload": true,
+          "IgnoreOverride": true,
+          "IgnoreSlotMethods": false,
+          "IgnoreStubs": true,
+          "IgnoreVariadicNames": false
+        },
         "ValidEncodings": "latin-1, utf-8"
       }
     },
@@ -132,6 +163,7 @@
         ],
         "outputDirectory": "ProjectPyramid/Documentation/source",
         "qtHelpEnabled": false,
+        "startDirectory": "",
         "useRecursion": true
       }
     },
@@ -245,7 +277,7 @@
     ],
     "OTHERTOOLSPARMS": {
       "Black": {
-        "exclude": "/(\\.direnv|\\.eggs|\\.git|\\.hg|\\.mypy_cache|\\.nox|\\.tox|\\.venv|venv|\\.svn|\\.ipynb_checkpoints|_build|buck-out|build|dist|__pypackages__)/",
+        "exclude": "/(\\.direnv|\\.eggs|\\.git|\\.hg|\\.ipynb_checkpoints|\\.mypy_cache|\\.nox|\\.pytest_cache|\\.ruff_cache|\\.tox|\\.svn|\\.venv|\\.vscode|__pypackages__|_build|buck-out|build|dist|venv)/",
         "extend-exclude": "",
         "force-exclude": "",
         "line-length": 88,
@@ -253,6 +285,7 @@
         "skip-string-normalization": false,
         "source": "project",
         "target-version": [
+          "py312",
           "py311",
           "py310",
           "py39",
@@ -304,6 +337,7 @@
       "ProjectPyramid/__init__.py",
       "__init__.py"
     ],
+    "SOURCESDIR": "",
     "SPELLEXCLUDES": "",
     "SPELLLANGUAGE": "en_US",
     "SPELLWORDS": "",
--- a/ProjectPyramid/CreateParametersDialog.py	Sat Dec 23 15:48:53 2023 +0100
+++ b/ProjectPyramid/CreateParametersDialog.py	Sat Dec 23 17:16:21 2023 +0100
@@ -58,7 +58,7 @@
         self.resize(max(self.width(), msh.width()), msh.height())
 
     @pyqtSlot(str)
-    def on_templateCombo_currentTextChanged(self, text):
+    def on_templateCombo_currentTextChanged(self, text):  # noqa: U100
         """
         Private slot to handle changes of the selected scaffold.
 
--- a/ProjectPyramid/DistributionTypeSelectionDialog.py	Sat Dec 23 15:48:53 2023 +0100
+++ b/ProjectPyramid/DistributionTypeSelectionDialog.py	Sat Dec 23 17:16:21 2023 +0100
@@ -58,7 +58,7 @@
             else:
                 if not finished:
                     errMsg = self.tr(
-                        "The python setup.py command did not finish within" " 30s."
+                        "The python setup.py command did not finish within 30s."
                     )
         else:
             errMsg = self.tr("Could not start the python executable.")
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.Project.html	Sat Dec 23 15:48:53 2023 +0100
+++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.Project.html	Sat Dec 23 17:16:21 2023 +0100
@@ -25,7 +25,7 @@
 <td>Class implementing the Pyramid project support.</td>
 </tr>
 <tr>
-<td><a href="#PyramidNoProjectSelectedException">PyramidNoProjectSelectedException</a></td>
+<td><a href="#PyramidNoProjectSelectedError">PyramidNoProjectSelectedError</a></td>
 <td>Exception thrown to signal, that there is no current Pyramid project.</td>
 </tr>
 <tr>
@@ -638,7 +638,7 @@
 </dl>
 <dl>
 
-<dt>Raises <b>PyramidNoProjectSelectedException</b>:</dt>
+<dt>Raises <b>PyramidNoProjectSelectedError</b>:</dt>
 <dd>
 raised, if no project is
             selected
@@ -1152,7 +1152,7 @@
 </dl>
 <dl>
 
-<dt>Raises <b>PyramidNoProjectSelectedException</b>:</dt>
+<dt>Raises <b>PyramidNoProjectSelectedError</b>:</dt>
 <dd>
 raised, if no project is
             selected
@@ -1230,8 +1230,8 @@
 <div align="right"><a href="#top">Up</a></div>
 <hr />
 <hr />
-<a NAME="PyramidNoProjectSelectedException" ID="PyramidNoProjectSelectedException"></a>
-<h2>PyramidNoProjectSelectedException</h2>
+<a NAME="PyramidNoProjectSelectedError" ID="PyramidNoProjectSelectedError"></a>
+<h2>PyramidNoProjectSelectedError</h2>
 
 <p>
     Exception thrown to signal, that there is no current Pyramid project.
@@ -1324,7 +1324,7 @@
 </dl>
 <a NAME="QProcess.startDetached" ID="QProcess.startDetached"></a>
 <h4>QProcess.startDetached (static)</h4>
-<b>startDetached</b>(<i>args=None, path=''</i>)
+<b>startDetached</b>(<i>args=None, path=""</i>)
 
 <p>
         Public static method to start the given program (cmd) in a new process,
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidDialog.html	Sat Dec 23 15:48:53 2023 +0100
+++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidDialog.html	Sat Dec 23 17:16:21 2023 +0100
@@ -124,7 +124,7 @@
 
 <a NAME="PyramidDialog.__init__" ID="PyramidDialog.__init__"></a>
 <h4>PyramidDialog (Constructor)</h4>
-<b>PyramidDialog</b>(<i>text, fixed=False, linewrap=True, msgSuccess=None, msgError=None, combinedOutput=False, parent=None</i>)
+<b>PyramidDialog</b>(<i>text, fixed=False, linewrap=True, msgSuccess=None, msgError=None, combinedOutput=False, parent=None, </i>)
 
 <p>
         Constructor
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidRoutesDialog.html	Sat Dec 23 15:48:53 2023 +0100
+++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidRoutesDialog.html	Sat Dec 23 17:16:21 2023 +0100
@@ -205,9 +205,9 @@
 </p>
 <dl>
 
-<dt><i>button</i></dt>
+<dt><i>button</i> (QAbstractButton)</dt>
 <dd>
-button that was clicked (QAbstractButton)
+button that was clicked
 </dd>
 </dl>
 <a NAME="PyramidRoutesDialog.on_input_returnPressed" ID="PyramidRoutesDialog.on_input_returnPressed"></a>
--- a/ProjectPyramid/MigrateSummaryDialog.py	Sat Dec 23 15:48:53 2023 +0100
+++ b/ProjectPyramid/MigrateSummaryDialog.py	Sat Dec 23 17:16:21 2023 +0100
@@ -101,9 +101,7 @@
                     EricMessageBox.critical(
                         None,
                         self.tr("Migrations Summary"),
-                        self.tr(
-                            """The 'alembic' process could not be""" """ started."""
-                        ),
+                        self.tr("""The 'alembic' process could not be started."""),
                     )
             for column in range(self.summaryWidget.columnCount()):
                 self.summaryWidget.resizeColumnToContents(column)
--- a/ProjectPyramid/Project.py	Sat Dec 23 15:48:53 2023 +0100
+++ b/ProjectPyramid/Project.py	Sat Dec 23 17:16:21 2023 +0100
@@ -760,7 +760,7 @@
                     res = EricMessageBox.yesNo(
                         self.__ui,
                         self.tr("New Form"),
-                        self.tr("""The file already exists! Overwrite""" """ it?"""),
+                        self.tr("""The file already exists! Overwrite it?"""),
                         icon=EricMessageBox.Warning,
                     )
                     if not res:
@@ -1514,7 +1514,7 @@
                     self.__ui,
                     self.tr("Run Web-Browser"),
                     self.tr(
-                        "Could not start the web-browser for the URL" ' "{0}".'
+                        'Could not start the web-browser for the URL "{0}".'
                     ).format(url.toString()),
                 )
         else:
@@ -1558,7 +1558,7 @@
                 EricMessageBox.critical(
                     self.__ui,
                     self.tr("Process Generation Error"),
-                    self.tr("The Pyramid Shell process could not be" " started."),
+                    self.tr("The Pyramid Shell process could not be started."),
                 )
 
     ##################################################################
@@ -1570,6 +1570,8 @@
         Private slot to build a distribution file for the current Pyramid
         project.
         """
+        from .DistributionTypeSelectionDialog import DistributionTypeSelectionDialog
+
         title = self.tr("Build Distribution File")
         try:
             projectPath = self.projectPath()
@@ -1584,8 +1586,6 @@
             )
             return
 
-        from .DistributionTypeSelectionDialog import DistributionTypeSelectionDialog
-
         dlg = DistributionTypeSelectionDialog(self, projectPath, self.__ui)
         if dlg.exec() == QDialog.DialogCode.Accepted:
             formats = dlg.getFormats()
@@ -1600,7 +1600,7 @@
 
             dia = PyramidDialog(
                 title,
-                msgSuccess=self.tr("Python distribution file built" " successfully."),
+                msgSuccess=self.tr("Python distribution file built successfully."),
             )
             res = dia.startProcess(cmd, args, projectPath)
             if res:
@@ -1654,6 +1654,8 @@
         """
         Private slot showing all URL dispatch routes.
         """
+        from .PyramidRoutesDialog import PyramidRoutesDialog
+
         title = self.tr("Show Routes")
         try:
             projectPath = self.projectPath()
@@ -1668,8 +1670,6 @@
             )
             return
 
-        from .PyramidRoutesDialog import PyramidRoutesDialog
-
         dia = PyramidRoutesDialog(self)
         res = dia.start(projectPath)
         if res:
@@ -1861,7 +1861,7 @@
         args.append(code)
 
         dia = PyramidDialog(
-            title, msgSuccess=self.tr("\nMessage catalog initialized" " successfully.")
+            title, msgSuccess=self.tr("\nMessage catalog initialized successfully.")
         )
         res = dia.startProcess(cmd, args, projectPath)
         if res:
@@ -1872,7 +1872,7 @@
             )
             self.__ericProject.appendFile(langFile)
 
-    def compileCatalogs(self, filenames):
+    def compileCatalogs(self, filenames):  # noqa: U100
         """
         Public method to compile the message catalogs.
 
@@ -1899,7 +1899,7 @@
         args.append("compile_catalog")
 
         dia = PyramidDialog(
-            title, msgSuccess=self.tr("\nMessage catalogs compiled" " successfully.")
+            title, msgSuccess=self.tr("\nMessage catalogs compiled successfully.")
         )
         res = dia.startProcess(cmd, args, projectPath)
         if res:
@@ -1952,7 +1952,7 @@
             return
 
         dia = PyramidDialog(
-            title, msgSuccess=self.tr("\nMessage catalogs compiled" " successfully.")
+            title, msgSuccess=self.tr("\nMessage catalogs compiled successfully.")
         )
         res = dia.startBatchProcesses(argsLists, projectPath)
         if res:
@@ -1964,7 +1964,7 @@
                     if fullName.endswith(".mo"):
                         self.__ericProject.appendFile(fullName)
 
-    def updateCatalogs(self, filenames):
+    def updateCatalogs(self, filenames):  # noqa: U100
         """
         Public method to update the message catalogs.
 
@@ -2063,7 +2063,7 @@
                     None,
                     self.tr("Process Generation Error"),
                     self.tr(
-                        "The translations editor process ({0}) could" " not be started."
+                        "The translations editor process ({0}) could not be started."
                     ).format(os.path.basename(editor)),
                 )
 
--- a/ProjectPyramid/PyramidRoutesDialog.py	Sat Dec 23 15:48:53 2023 +0100
+++ b/ProjectPyramid/PyramidRoutesDialog.py	Sat Dec 23 17:16:21 2023 +0100
@@ -77,7 +77,8 @@
         """
         Private slot called by a button of the button box clicked.
 
-        @param button button that was clicked (QAbstractButton)
+        @param button button that was clicked
+        @type QAbstractButton
         """
         if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close):
             self.close()

eric ide

mercurial