Corrected some code style issues. eric7

Sat, 23 Dec 2023 16:54:25 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Dec 2023 16:54:25 +0100
branch
eric7
changeset 71
fc1ab84c242f
parent 70
ce1c2effa0e0
child 72
529f1c17c93e

Corrected some code style issues.

PluginDjangoTagsMenu.epj file | annotate | diff | comparison | revisions
PluginProjectDjangoTagsMenu.py file | annotate | diff | comparison | revisions
ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py file | annotate | diff | comparison | revisions
--- a/PluginDjangoTagsMenu.epj	Sat Dec 23 15:48:51 2023 +0100
+++ b/PluginDjangoTagsMenu.epj	Sat Dec 23 16:54:25 2023 +0100
@@ -1,7 +1,7 @@
 {
   "header": {
     "comment": "eric project file for project PluginDjangoTagsMenu",
-    "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, */*_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,Y119,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,Y119,Y401,Y402",
         "FixCodes": "",
         "FixIssues": false,
         "FutureChecker": "",
         "HangClosing": false,
         "ImportsChecker": {
-          "ApplicationPackageNames": [],
+          "ApplicationPackageNames": [
+            "ProjectDjangoTagsMenu",
+            "eric7"
+          ],
           "BanRelativeImports": "",
           "BannedModules": []
         },
@@ -80,6 +87,17 @@
         "MaxCodeComplexity": 10,
         "MaxDocLineLength": 88,
         "MaxLineLength": 88,
+        "NameOrderChecker": {
+          "ApplicationPackageNames": [
+            "ProjectDjangoTagsMenu",
+            "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": "ProjectDjangoTagsMenu/Documentation/source",
         "qtHelpEnabled": false,
+        "startDirectory": "",
         "useRecursion": true
       }
     },
@@ -198,7 +230,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,
@@ -206,6 +238,7 @@
         "skip-string-normalization": false,
         "source": "project",
         "target-version": [
+          "py312",
           "py311",
           "py310",
           "py39",
@@ -256,6 +289,7 @@
       "ProjectDjangoTagsMenu/__init__.py",
       "__init__.py"
     ],
+    "SOURCESDIR": "",
     "SPELLEXCLUDES": "",
     "SPELLLANGUAGE": "en_US",
     "SPELLWORDS": "",
--- a/PluginProjectDjangoTagsMenu.py	Sat Dec 23 15:48:51 2023 +0100
+++ b/PluginProjectDjangoTagsMenu.py	Sat Dec 23 16:54:25 2023 +0100
@@ -165,7 +165,7 @@
         """
         self.__handler.closeAllWindows()
 
-    def __pluginActivated(self, moduleName, pluginObject):
+    def __pluginActivated(self, moduleName, pluginObject):  # noqa: U100
         """
         Private slot to react on plugin activation of the Django plugin.
 
@@ -177,7 +177,7 @@
         if moduleName == "PluginProjectDjango":
             self.__attachMenu()
 
-    def __pluginAboutToBeDeactivated(self, moduleName, pluginObject):
+    def __pluginAboutToBeDeactivated(self, moduleName, pluginObject):  # noqa: U100
         """
         Private slot to react on the Django plugin about to be deactivated.
 
@@ -193,4 +193,4 @@
 
 
 #
-# eflag: noqa = M801
+# eflag: noqa = M801, U200
--- a/ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py	Sat Dec 23 15:48:51 2023 +0100
+++ b/ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py	Sat Dec 23 16:54:25 2023 +0100
@@ -166,7 +166,7 @@
         )
         menu.addSeparator()
         menu.addAction(
-            self.tr("regroup - Regroup list of alike objects by a common" " attribute"),
+            self.tr("regroup - Regroup list of alike objects by a common attribute"),
             lambda: self.__applyTemplate("regroup"),
         )
         menu.addSeparator()
@@ -187,7 +187,7 @@
         )
         menu.addSeparator()
         menu.addAction(
-            self.tr("templatetag - Output syntax characters used for" " template"),
+            self.tr("templatetag - Output syntax characters used for template"),
             lambda: self.__applyTemplate("templatetag"),
         )
         menu.addSeparator()
@@ -428,7 +428,7 @@
         )
         menu.addAction(
             self.tr(
-                "truncatewords_html - Truncate after a number of words" " (HTML aware)"
+                "truncatewords_html - Truncate after a number of words (HTML aware)"
             ),
             lambda: self.__applyTemplate("truncatewords_html"),
         )
@@ -450,7 +450,7 @@
             lambda: self.__applyTemplate("urlize"),
         )
         menu.addAction(
-            self.tr("urlizetrunc - Convert URLs as clickable links and" " truncate"),
+            self.tr("urlizetrunc - Convert URLs as clickable links and truncate"),
             lambda: self.__applyTemplate("urlizetrunc"),
         )
         menu.addSeparator()
@@ -669,7 +669,7 @@
             lambda: self.__applyTemplate("get_available_languages"),
         )
         menu.addAction(
-            self.tr("get_current_language_bidi - Current language's" " direction"),
+            self.tr("get_current_language_bidi - Current language's direction"),
             lambda: self.__applyTemplate("get_current_language_bidi"),
         )
         menu.addAction(
@@ -767,7 +767,7 @@
             lambda: self.__applyTemplate("timezone_set"),
         )
         menu.addAction(
-            self.tr("timezone None - Unset timezone for date and time" " conversion"),
+            self.tr("timezone None - Unset timezone for date and time conversion"),
             lambda: self.__applyTemplate("timezone_unset"),
         )
         menu.addAction(
@@ -797,9 +797,9 @@
         """
         Private slot to find a template tag and insert its text.
         """
+        from .FindTemplateTagDialog import FindTemplateTagDialog
+
         if self.__findDialog is None:
-            from .FindTemplateTagDialog import FindTemplateTagDialog
-
             self.__findDialog = FindTemplateTagDialog()
             self.__findDialog.tag.connect(self.__applyTemplate)
         self.__findDialog.show()
@@ -839,6 +839,12 @@
             a replace operation
         @rtype tuple of (str, bool)
         """
+        from .IeCommentDialog import IeCommentDialog
+        from .IfTagInputDialog import IfTagInputDialog
+        from .LoremTagInputDialog import LoremTagInputDialog
+        from .MultiLineInputDialog import MultiLineInputDialog
+        from .TimezoneSelectionDialog import TimezoneSelectionDialog
+
         replace = False  # safe value
         ok = True
         templateText = ""
@@ -956,8 +962,6 @@
                 )
                 replace = True
         elif tag == "if":
-            from .IfTagInputDialog import IfTagInputDialog
-
             dlg = IfTagInputDialog()
             if dlg.exec() == QDialog.DialogCode.Accepted:
                 templateText = dlg.getTag()
@@ -1559,8 +1563,6 @@
         elif tag == "loadweb":
             templateText = "{% load webdesign %}"
         elif tag == "lorem":
-            from .LoremTagInputDialog import LoremTagInputDialog
-
             dlg = LoremTagInputDialog()
             if dlg.exec() == QDialog.DialogCode.Accepted:
                 templateText = "{{% {0} %}}".format(dlg.getTag())
@@ -1584,7 +1586,7 @@
             data, ok = DjangoTagInputDialog.getText(
                 None,
                 self.tr("Link to static file"),
-                [self.tr("Enter variable containing relative path of" " static file:")],
+                [self.tr("Enter variable containing relative path of static file:")],
                 ["user_stylesheet"],
             )
             if ok:
@@ -1611,8 +1613,6 @@
             if ok:
                 templateText = "{{# {0} #}}".format(data[0])
         elif tag == "multilinecommentdialog":
-            from .MultiLineInputDialog import MultiLineInputDialog
-
             comment, ok = MultiLineInputDialog.getText(
                 None, self.tr("Multi Line Comment"), self.tr("Enter comment:"), ""
             )
@@ -1655,8 +1655,6 @@
             templateText = "<!-- {0} -->".format(selectedText)
             replace = True
         elif tag == "iecomment":
-            from .IeCommentDialog import IeCommentDialog
-
             tag, ok = IeCommentDialog.getTag(selectedText)
             if ok:
                 templateText = "<!--{0}-->".format(tag)
@@ -1695,7 +1693,7 @@
             data, ok = DjangoTagInputDialog.getText(
                 None,
                 self.tr("Translate Block with Attributes"),
-                [self.tr("Enter attribute binding expressions" " (space separated):")],
+                [self.tr("Enter attribute binding expressions (space separated):")],
                 ["myvar1=value1 myvar2=value2"],
             )
             if ok:
@@ -1741,14 +1739,12 @@
                         data[0]
                     )
                 else:
-                    templateText = (
-                        "{% get_language_info for LANGUAGE_CODE" " as lang %}"
-                    )
+                    templateText = "{% get_language_info for LANGUAGE_CODE as lang %}"
         elif tag == "get_language_info_list":
             data, ok = DjangoTagInputDialog.getText(
                 None,
                 self.tr("Language Information for a list of languages"),
-                [self.tr("Enter language list variable (empty for" " LANGUAGES):")],
+                [self.tr("Enter language list variable (empty for LANGUAGES):")],
                 ["available_languages"],
             )
             if ok:
@@ -1759,9 +1755,7 @@
                         )
                     )
                 else:
-                    templateText = (
-                        "{% get_language_info_list for LANGUAGES" " as langs %}"
-                    )
+                    templateText = "{% get_language_info_list for LANGUAGES as langs %}"
         ## Filters ##
         elif tag == "language_name":
             templateText = "|language_name"
@@ -1811,8 +1805,6 @@
             )
             replace = True
         elif tag == "timezone_set":
-            from .TimezoneSelectionDialog import TimezoneSelectionDialog
-
             timezone, ok = TimezoneSelectionDialog.getTimezone()
             if ok:
                 templateText = '{{% timezone "{0}" %}}{1}{{% endtimezone %}}'.format(
@@ -1832,8 +1824,6 @@
         elif tag == "utc":
             templateText = "|utc"
         elif tag == "timezone":
-            from .TimezoneSelectionDialog import TimezoneSelectionDialog
-
             timezone, ok = TimezoneSelectionDialog.getTimezone()
             if ok:
                 templateText = '|timezone:"{0}"'.format(timezone)

eric ide

mercurial