SimplifyNodeVisitor: fixed Y113 to not fire on augmented assignments with non-integer constants.

Sun, 11 Apr 2021 11:34:32 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 11 Apr 2021 11:34:32 +0200
changeset 8219
013aee248a62
parent 8218
7c09585bd960
child 8220
006ee31b4835

SimplifyNodeVisitor: fixed Y113 to not fire on augmented assignments with non-integer constants.

eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py file | annotate | diff | comparison | revisions
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py	Sat Apr 10 18:38:27 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/SimplifyNodeVisitor.py	Sun Apr 11 11:34:32 2021 +0200
@@ -275,8 +275,11 @@
         @rtype bool
         """
         return (
-            isinstance(expression.op, ast.Add) and
-            isinstance(expression.value, (ast.Constant, ast.Num))
+            isinstance(expression.op, ast.Add) and (
+                (isinstance(expression.value, ast.Constant) and
+                 isinstance(expression.value.value, int)) or
+                isinstance(expression.value, ast.Num)
+            )
         )
     
     def __getIfBodyPairs(self, node):

eric ide

mercurial