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

changeset 8228
772103b14c18
parent 8222
5994b80b8760
child 8243
cc717c2ae956
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py	Mon Apr 12 19:05:23 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py	Mon Apr 12 19:21:40 2021 +0200
@@ -2100,10 +2100,11 @@
                 # datetime.strptime(...).replace(tzinfo=UTC)
                 parent = getattr(node, '_dtCheckerParent', None)
                 pparent = getattr(parent, '_dtCheckerParent', None)
-                if not (isinstance(parent, ast.Attribute) and
-                        parent.attr == 'replace'):
-                    isCase1 = False
-                elif not isinstance(pparent, ast.Call):
+                if (
+                    not (isinstance(parent, ast.Attribute) and
+                         parent.attr == 'replace') or
+                    not isinstance(pparent, ast.Call)
+                ):
                     isCase1 = False
                 else:
                     tzinfoKeyword = self.__getFromKeywords(pparent.keywords,
@@ -2193,16 +2194,13 @@
         """
         match = False
         if (
-            isinstance(node, ast.Attribute) and
-            isinstance(node.value, ast.Name) and
-            node.value.id == "sys" and
-            node.attr == attr
-        ):
-            match = True
-        elif (
-            isinstance(node, ast.Name) and
-            node.id == attr and
-            self.__fromImports.get(node.id) == "sys"
+            (isinstance(node, ast.Attribute) and
+             isinstance(node.value, ast.Name) and
+             node.value.id == "sys" and
+             node.attr == attr) or
+            (isinstance(node, ast.Name) and
+             node.id == attr and
+             self.__fromImports.get(node.id) == "sys")
         ):
             match = True
         

eric ide

mercurial