Corrected some code style issues. eric7

Sat, 23 Dec 2023 17:08:59 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Dec 2023 17:08:59 +0100
branch
eric7
changeset 84
f39230b845e4
parent 83
d8788dc3442f
child 85
fcb5126077b1

Corrected some code style issues.

PluginFlask.epj file | annotate | diff | comparison | revisions
PluginProjectFlask.py file | annotate | diff | comparison | revisions
ProjectFlask/FlaskBabelExtension/PyBabelConfigDialog.py file | annotate | diff | comparison | revisions
ProjectFlask/FlaskBabelExtension/PyBabelProjectExtension.py file | annotate | diff | comparison | revisions
ProjectFlask/FlaskConfigDialog.py file | annotate | diff | comparison | revisions
ProjectFlask/FlaskMigrateExtension/MigrateProjectExtension.py file | annotate | diff | comparison | revisions
ProjectFlask/FlaskMigrateExtension/MigrateSummaryDialog.py file | annotate | diff | comparison | revisions
ProjectFlask/FlaskVirtualenvConfigurationDialog.py file | annotate | diff | comparison | revisions
ProjectFlask/Project.py file | annotate | diff | comparison | revisions
ProjectFlask/RoutesDialog.py file | annotate | diff | comparison | revisions
ProjectFlask/RunServerDialog.py file | annotate | diff | comparison | revisions
ProjectFlask/ServerStartOptionsDialog.py file | annotate | diff | comparison | revisions
--- a/PluginFlask.epj	Sat Dec 23 15:48:52 2023 +0100
+++ b/PluginFlask.epj	Sat Dec 23 17:08:59 2023 +0100
@@ -1,7 +1,7 @@
 {
   "header": {
     "comment": "eric project file for project PluginFlask",
-    "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, Y, W",
+        "EnabledCheckerCategories": "C, D, E, I, L, M, NO, N, Y, U, W",
         "ExcludeFiles": "*/Ui_*.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": [
+            "ProjectFlask",
+            "eric7"
+          ],
           "BanRelativeImports": "",
           "BannedModules": []
         },
@@ -80,6 +87,17 @@
         "MaxCodeComplexity": 10,
         "MaxDocLineLength": 88,
         "MaxLineLength": 88,
+        "NameOrderChecker": {
+          "ApplicationPackageNames": [
+            "ProjectFlask",
+            "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"
       }
     },
@@ -210,7 +241,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,
@@ -218,6 +249,7 @@
         "skip-string-normalization": false,
         "source": "project",
         "target-version": [
+          "py312",
           "py311",
           "py310",
           "py39",
@@ -281,6 +313,7 @@
       "ProjectFlask/__init__.py",
       "__init__.py"
     ],
+    "SOURCESDIR": "",
     "SPELLEXCLUDES": "",
     "SPELLLANGUAGE": "en",
     "SPELLWORDS": "",
--- a/PluginProjectFlask.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/PluginProjectFlask.py	Sat Dec 23 17:08:59 2023 +0100
@@ -59,7 +59,7 @@
     return apis
 
 
-def createFlaskPage(configDlg):
+def createFlaskPage(configDlg):  # noqa: U100
     """
     Module function to create the Flask configuration page.
 
@@ -68,8 +68,9 @@
     @return reference to the configuration page
     @rtype FlaskPage
     """
+    from ProjectFlask.ConfigurationPage.FlaskPage import FlaskPage
+
     global flaskPluginObject
-    from ProjectFlask.ConfigurationPage.FlaskPage import FlaskPage
 
     page = FlaskPage(flaskPluginObject)
     return page
@@ -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(
-                "Flask",
-                SourcesBrowserFlag
-                | FormsBrowserFlag
-                | TranslationsBrowserFlag
-                | OthersBrowserFlag,
-            )
-        except ImportError:
-            Preferences.setProjectBrowsersDefault(
-                "Flask",
-                ("sources", "forms", "translations", "others"),
-            )
+        Preferences.setProjectBrowsersDefault(
+            "Flask",
+            ("sources", "forms", "translations", "others"),
+        )
 
         if self.__ericProject.isOpen():
             self.__projectOpened()
@@ -461,4 +445,4 @@
 
 
 #
-# eflag: noqa = M801
+# eflag: noqa = M801, U200
--- a/ProjectFlask/FlaskBabelExtension/PyBabelConfigDialog.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/FlaskBabelExtension/PyBabelConfigDialog.py	Sat Dec 23 17:08:59 2023 +0100
@@ -41,7 +41,7 @@
             EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE
         )
         self.configFilePicker.setFilters(
-            self.tr("Configuration Files (*.cfg);;" "All Files (*)")
+            self.tr("Configuration Files (*.cfg);;All Files (*)")
         )
         self.configFilePicker.setDefaultDirectory(self.__ericProject.getProjectPath())
 
@@ -54,7 +54,7 @@
             EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE
         )
         self.catalogFilePicker.setFilters(
-            self.tr("Message Catalog Files (*.pot);;" "All Files (*)")
+            self.tr("Message Catalog Files (*.pot);;All Files (*)")
         )
         self.catalogFilePicker.setDefaultDirectory(self.__ericProject.getProjectPath())
 
@@ -144,7 +144,7 @@
         )
 
     @pyqtSlot(str)
-    def on_configFilePicker_textChanged(self, txt):
+    def on_configFilePicker_textChanged(self, txt):  # noqa: U100
         """
         Private slot to handle a change of the configuration file name.
 
@@ -154,7 +154,7 @@
         self.__updateOK()
 
     @pyqtSlot(str)
-    def on_translationsDirectoryPicker_textChanged(self, txt):
+    def on_translationsDirectoryPicker_textChanged(self, txt):  # noqa: U100
         """
         Private slot to handle a change of the catalog file name.
 
@@ -165,7 +165,7 @@
         self.__updateCatalogPicker()
 
     @pyqtSlot(str)
-    def on_domainEdit_textChanged(self, txt):
+    def on_domainEdit_textChanged(self, txt):  # noqa: U100
         """
         Private slot to handle a change of the translations domain.
 
--- a/ProjectFlask/FlaskBabelExtension/PyBabelProjectExtension.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/FlaskBabelExtension/PyBabelProjectExtension.py	Sat Dec 23 17:08:59 2023 +0100
@@ -89,7 +89,7 @@
         )
         self.pybabelInstallAct.setStatusTip(
             self.tr(
-                "Installs the flask-babel extension into the configured" " environment"
+                "Installs the flask-babel extension into the configured environment"
             )
         )
         self.pybabelInstallAct.setWhatsThis(
@@ -446,7 +446,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)),
                 )
 
@@ -523,7 +523,7 @@
 
                 self.__ericProject.appendFile(langFile)
 
-    def compileCatalogs(self, filenames):
+    def compileCatalogs(self, filenames):  # noqa: U100
         """
         Public method to compile the message catalogs.
 
@@ -617,7 +617,7 @@
                         if fullName.endswith(".mo"):
                             self.__ericProject.appendFile(fullName)
 
-    def updateCatalogs(self, filenames, withObsolete=False):
+    def updateCatalogs(self, filenames, withObsolete=False):  # noqa: U100
         """
         Public method to update the message catalogs.
 
--- a/ProjectFlask/FlaskConfigDialog.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/FlaskConfigDialog.py	Sat Dec 23 17:08:59 2023 +0100
@@ -93,6 +93,8 @@
         """
         Private slot to open a dialog for adding a new virtual environment.
         """
+        from eric7.VirtualEnv.VirtualenvExecDialog import VirtualenvExecDialog
+
         from .FlaskVirtualenvConfigurationDialog import (
             FlaskVirtualenvConfigurationDialog,
         )
@@ -105,8 +107,6 @@
             resultDict = dlg.getData()
 
             # now do the call
-            from VirtualEnv.VirtualenvExecDialog import VirtualenvExecDialog
-
             dia = VirtualenvExecDialog(resultDict, self.__virtualEnvManager, self)
             dia.show()
             dia.start(resultDict["arguments"])
@@ -133,7 +133,7 @@
         @param venvDir  directory containing the virtual environment
         @type str
         """
-        from PipInterface.PipDialog import PipDialog
+        from eric7.PipInterface.PipDialog import PipDialog
 
         interpreter = self.__project.getFullCommand("python", venvDir)
         if Preferences.getPip("PipSearchIndex"):
--- a/ProjectFlask/FlaskMigrateExtension/MigrateProjectExtension.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/FlaskMigrateExtension/MigrateProjectExtension.py	Sat Dec 23 17:08:59 2023 +0100
@@ -454,9 +454,7 @@
         multidb = EricMessageBox.yesNo(
             None,
             self.tr("Multiple Databases"),
-            self.tr(
-                """Shall the support for multiple databases be""" """ activated?"""
-            ),
+            self.tr("""Shall the support for multiple databases be activated?"""),
         )
         if multidb:
             args.append("--multidb")
--- a/ProjectFlask/FlaskMigrateExtension/MigrateSummaryDialog.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/FlaskMigrateExtension/MigrateSummaryDialog.py	Sat Dec 23 17:08:59 2023 +0100
@@ -116,9 +116,7 @@
                         EricMessageBox.critical(
                             None,
                             self.tr("Migrations Summary"),
-                            self.tr(
-                                """The Flask process could not be""" """ started."""
-                            ),
+                            self.tr("""The Flask process could not be started."""),
                         )
                 for column in range(self.summaryWidget.columnCount()):
                     self.summaryWidget.resizeColumnToContents(column)
--- a/ProjectFlask/FlaskVirtualenvConfigurationDialog.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/FlaskVirtualenvConfigurationDialog.py	Sat Dec 23 17:08:59 2023 +0100
@@ -82,7 +82,7 @@
         )
 
     @pyqtSlot(str)
-    def on_nameEdit_textChanged(self, txt):
+    def on_nameEdit_textChanged(self, txt):  # noqa: U100
         """
         Private slot handling a change of the virtual environment name.
 
@@ -92,7 +92,7 @@
         self.__updateOK()
 
     @pyqtSlot(str)
-    def on_targetDirectoryPicker_textChanged(self, txt):
+    def on_targetDirectoryPicker_textChanged(self, txt):  # noqa: U100
         """
         Private slot handling a change of the target directory.
 
@@ -108,9 +108,7 @@
         @return target directory path
         @rtype str
         """
-        targetDirectory = toNativeSeparators(
-            self.targetDirectoryPicker.text()
-        )
+        targetDirectory = toNativeSeparators(self.targetDirectoryPicker.text())
         if not os.path.isabs(targetDirectory):
             targetDirectory = os.path.join(os.path.expanduser("~"), targetDirectory)
         return targetDirectory
--- a/ProjectFlask/Project.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/Project.py	Sat Dec 23 17:08:59 2023 +0100
@@ -117,7 +117,7 @@
         )
         self.runServerAct.setStatusTip(self.tr("Starts the Flask Web server"))
         self.runServerAct.setWhatsThis(
-            self.tr("""<b>Run Server</b>""" """<p>Starts the Flask Web server.</p>""")
+            self.tr("""<b>Run Server</b><p>Starts the Flask Web server.</p>""")
         )
         self.runServerAct.triggered.connect(self.__runServer)
         self.actions.append(self.runServerAct)
@@ -387,7 +387,7 @@
             template = dlg.getTemplateText()
 
             fileFilters = self.tr(
-                "HTML Files (*.html);;" "HTML Files (*.htm);;" "All Files (*)"
+                "HTML Files (*.html);;HTML Files (*.htm);;All Files (*)"
             )
             fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter(
                 self.__ui,
@@ -408,7 +408,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:
--- a/ProjectFlask/RoutesDialog.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/RoutesDialog.py	Sat Dec 23 17:08:59 2023 +0100
@@ -98,9 +98,7 @@
                         EricMessageBox.critical(
                             None,
                             self.tr("Flask Routes"),
-                            self.tr(
-                                """The Flask process could not be""" """ started."""
-                            ),
+                            self.tr("""The Flask process could not be started."""),
                         )
                 for column in range(self.routesList.columnCount()):
                     self.routesList.resizeColumnToContents(column)
@@ -179,7 +177,7 @@
             self.showRoutes()
 
     @pyqtSlot(bool)
-    def on_allMethodsCheckBox_toggled(self, checked):
+    def on_allMethodsCheckBox_toggled(self, checked):  # noqa: U100
         """
         Private slot handling the selection to show all methods.
 
--- a/ProjectFlask/RunServerDialog.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/RunServerDialog.py	Sat Dec 23 17:08:59 2023 +0100
@@ -8,6 +8,7 @@
 """
 
 import re
+import webbrowser
 
 from PyQt6.QtCore import QProcess, Qt, QTimer, pyqtSlot
 from PyQt6.QtGui import QTextCharFormat
@@ -153,9 +154,7 @@
                 EricMessageBox.critical(
                     None,
                     self.tr("Run Flask Server"),
-                    self.tr(
-                        """The Flask server process could not be""" """ started."""
-                    ),
+                    self.tr("""The Flask server process could not be started."""),
                 )
             else:
                 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(
@@ -243,8 +242,6 @@
         Private slot to start a web browser with the server URL.
         """
         if self.__plugin.getPreferences("UseExternalBrowser"):
-            import webbrowser
-
             webbrowser.open(self.__serverUrl)
         else:
             ericApp().getObject("UserInterface").launchHelpViewer(self.__serverUrl)
--- a/ProjectFlask/ServerStartOptionsDialog.py	Sat Dec 23 15:48:52 2023 +0100
+++ b/ProjectFlask/ServerStartOptionsDialog.py	Sat Dec 23 17:08:59 2023 +0100
@@ -36,9 +36,7 @@
 
         self.certFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
         self.certFilePicker.setFilters(
-            self.tr(
-                "Certificate Files (*.pem);;" "Certificate Files (*.cert *.cer *.crt)"
-            )
+            self.tr("Certificate Files (*.pem);;Certificate Files (*.cert *.cer *.crt)")
         )
         self.certFilePicker.setDefaultDirectory(ericProject.getProjectPath())
 

eric ide

mercurial