eric6/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py

changeset 7894
4370a8b30648
parent 7784
3257703e10c5
child 7923
91e843545d9a
diff -r 29d2c2e5b948 -r 4370a8b30648 eric6/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py	Fri Dec 18 12:24:33 2020 +0100
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py	Fri Dec 18 12:44:31 2020 +0100
@@ -558,18 +558,14 @@
                 numArgs = len(call.args)
                 if strArgs:
                     numArgs -= 1
-                if sys.version_info < (3, 5):
-                    hasKwArgs = bool(call.kwargs)
-                    hasStarArgs = bool(call.starargs)
-                else:
-                    hasKwArgs = any(kw.arg is None for kw in call.keywords)
-                    hasStarArgs = sum(1 for arg in call.args
-                                      if isinstance(arg, ast.Starred))
-                    
-                    if hasKwArgs:
-                        keywords.discard(None)
-                    if hasStarArgs:
-                        numArgs -= 1
+                hasKwArgs = any(kw.arg is None for kw in call.keywords)
+                hasStarArgs = sum(1 for arg in call.args
+                                  if isinstance(arg, ast.Starred))
+                
+                if hasKwArgs:
+                    keywords.discard(None)
+                if hasStarArgs:
+                    numArgs -= 1
                 
                 # if starargs or kwargs is not None, it can't count the
                 # parameters but at least check if the args are used
@@ -1294,13 +1290,12 @@
         @param node reference to the node to be processed
         @type ast.JoinedStr
         """
-        if sys.version_info >= (3, 6):
-            if self.__withinLoggingStatement():
-                if any(isinstance(i, ast.FormattedValue) for i in node.values):
-                    if self.__withinLoggingArgument():
-                        self.violations.append((node, "M654"))
-                        
-                        super(LoggingVisitor, self).generic_visit(node)
+        if self.__withinLoggingStatement():
+            if any(isinstance(i, ast.FormattedValue) for i in node.values):
+                if self.__withinLoggingArgument():
+                    self.violations.append((node, "M654"))
+                    
+                    super(LoggingVisitor, self).generic_visit(node)
 
 
 class BugBearVisitor(ast.NodeVisitor):
@@ -1504,12 +1499,11 @@
         @param node reference to the node to be processed
         @type ast.JoinedStr
         """
-        if sys.version_info >= (3, 6):
-            for value in node.values:
-                if isinstance(value, ast.FormattedValue):
-                    return
-            
-            self.violations.append((node, "M508"))
+        for value in node.values:
+            if isinstance(value, ast.FormattedValue):
+                return
+        
+        self.violations.append((node, "M508"))
     
     def __checkForM502(self, node):
         """

eric ide

mercurial