src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

branch
eric7
changeset 10119
64147a7e6393
parent 10116
4a619fb7bd09
child 10122
f9b87800ecf2
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Thu Jul 20 10:36:23 2023 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Thu Jul 20 11:00:30 2023 +0200
@@ -14,7 +14,7 @@
 import sys
 
 import pycodestyle
-
+from Annotations.AnnotationsChecker import AnnotationsChecker
 from Async.AsyncChecker import AsyncChecker
 from CodeStyleFixer import CodeStyleFixer
 from Complexity.ComplexityChecker import ComplexityChecker
@@ -315,12 +315,8 @@
     src = "".join(source)
 
     try:
-        tree = (
-            ast.parse(src, filename, "exec", type_comments=True)
-            # need the 'type_comments' parameter to include type annotations
-            if sys.version_info >= (3, 8)
-            else ast.parse(src, filename, "exec")
-        )
+        tree = ast.parse(src, filename, "exec", type_comments=True)
+        # need the 'type_comments' parameter to include type annotations
         return None, None, tree
     except (SyntaxError, TypeError):
         exc_type, exc = sys.exc_info()[:2]
@@ -494,26 +490,19 @@
             errors += complexityChecker.errors
 
             # check function annotations
-            if sys.version_info >= (3, 8, 0):
-                # annotations with type comments are supported from
-                # Python 3.8 on
-                from Annotations.AnnotationsChecker import (  # __IGNORE_WARNING_I10__
-                    AnnotationsChecker,
-                )
-
-                annotationsChecker = AnnotationsChecker(
-                    source,
-                    filename,
-                    tree,
-                    select,
-                    ignore,
-                    [],
-                    repeatMessages,
-                    annotationArgs,
-                )
-                annotationsChecker.run()
-                stats.update(annotationsChecker.counters)
-                errors += annotationsChecker.errors
+            annotationsChecker = AnnotationsChecker(
+                source,
+                filename,
+                tree,
+                select,
+                ignore,
+                [],
+                repeatMessages,
+                annotationArgs,
+            )
+            annotationsChecker.run()
+            stats.update(annotationsChecker.counters)
+            errors += annotationsChecker.errors
 
             # check for security issues
             securityChecker = SecurityChecker(

eric ide

mercurial