clean-up: fix PEP8 E713 test for membership should be 'not in'
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Sat, 19 Aug 2017 16:30:15 +0300
changeset 1775 b45f2768fab1
parent 1774 ac0fe8aabb5e
child 1776 81aa8aaccdd4
clean-up: fix PEP8 E713 test for membership should be 'not in'
IDEFrame.py
PLCControler.py
PLCGenerator.py
ProjectController.py
editors/TextViewer.py
svgui/pyjs/build.py
svgui/pyjs/lib/pyjslib.py
svgui/pyjs/pyjs.py
svgui/svgui_server.py
xmlclass/xmlclass.py
xmlclass/xsdschema.py
--- a/IDEFrame.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/IDEFrame.py	Sat Aug 19 16:30:15 2017 +0300
@@ -813,7 +813,7 @@
                     tab_size = child.GetSize()
                     for page_idx in xrange(child.GetPageCount()):
                         page = child.GetWindowFromIdx(page_idx)
-                        if not "size" in tab:
+                        if "size" not in tab:
                             tab["size"] = (tab_size[0], tab_size[1] + page.GetSize()[1])
                         tab_infos = self.GetTabInfos(page)
                         if tab_infos is not None:
@@ -1543,7 +1543,7 @@
                 self.ProjectTree.SetItemExtraImage(root, self.Controler.GetPouType(infos["name"]))
         elif "icon" in infos and infos["icon"] is not None:
             icon_name = infos["icon"]
-            if not icon_name in self.TreeImageDict:
+            if icon_name not in self.TreeImageDict:
                 self.TreeImageDict[icon_name] = self.TreeImageList.Add(GetBitmap(icon_name))
             self.ProjectTree.SetItemImage(root, self.TreeImageDict[icon_name])
         elif infos["type"] in self.TreeImageDict:
--- a/PLCControler.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/PLCControler.py	Sat Aug 19 16:30:15 2017 +0300
@@ -2439,7 +2439,7 @@
                     exclude[stepname] = True
                     instance.setname(stepname)
                 localid = instance.getlocalId()
-                if not localid in used_id:
+                if localid not in used_id:
                     new_id[localid] = True
 
             idx = 1
--- a/PLCGenerator.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/PLCGenerator.py	Sat Aug 19 16:30:15 2017 +0300
@@ -745,7 +745,7 @@
                         if isinstance(instance, (OutVariableClass, InOutVariableClass)):
                             self.ConnectionTypes[instance.connectionPointIn] = var_type
                             connected = self.GetConnectedConnector(instance.connectionPointIn, body)
-                            if connected is not None and not connected in self.ConnectionTypes:
+                            if connected is not None and connected not in self.ConnectionTypes:
                                 for related in self.ExtractRelatedConnections(connected):
                                     self.ConnectionTypes[related] = var_type
                 elif isinstance(instance, (ContactClass, CoilClass)):
@@ -754,7 +754,7 @@
                     self.ConnectionTypes[instance.connectionPointIn] = "BOOL"
                     for link in instance.connectionPointIn.getconnections():
                         connected = self.GetLinkedConnector(link, body)
-                        if connected is not None and not connected in self.ConnectionTypes:
+                        if connected is not None and connected not in self.ConnectionTypes:
                             for related in self.ExtractRelatedConnections(connected):
                                 self.ConnectionTypes[related] = "BOOL"
                 elif isinstance(instance, LeftPowerRailClass):
@@ -766,7 +766,7 @@
                         self.ConnectionTypes[connection] = "BOOL"
                         for link in connection.getconnections():
                             connected = self.GetLinkedConnector(link, body)
-                            if connected is not None and not connected in self.ConnectionTypes:
+                            if connected is not None and connected not in self.ConnectionTypes:
                                 for related in self.ExtractRelatedConnections(connected):
                                     self.ConnectionTypes[related] = "BOOL"
                 elif isinstance(instance, TransitionClass):
@@ -780,7 +780,7 @@
 
                         for link in connections:
                             connected = self.GetLinkedConnector(link, body)
-                            if connected is not None and not connected in self.ConnectionTypes:
+                            if connected is not None and connected not in self.ConnectionTypes:
                                 for related in self.ExtractRelatedConnections(connected):
                                     self.ConnectionTypes[related] = "BOOL"
                 elif isinstance(instance, ContinuationClass):
@@ -859,10 +859,10 @@
                 for oname, otype, oqualifier in block_infos["outputs"]:
                     if output_name == oname:
                         if otype.startswith("ANY"):
-                            if not otype in undefined:
+                            if otype not in undefined:
                                 undefined[otype] = []
                             undefined[otype].append(variable.connectionPointOut)
-                        elif not variable.connectionPointOut in self.ConnectionTypes:
+                        elif variable.connectionPointOut not in self.ConnectionTypes:
                             for connection in self.ExtractRelatedConnections(variable.connectionPointOut):
                                 self.ConnectionTypes[connection] = otype
         for variable in instance.inputVariables.getvariable():
@@ -875,14 +875,14 @@
                     if input_name == iname:
                         connected = self.GetConnectedConnector(variable.connectionPointIn, body)
                         if itype.startswith("ANY"):
-                            if not itype in undefined:
+                            if itype not in undefined:
                                 undefined[itype] = []
                             undefined[itype].append(variable.connectionPointIn)
                             if connected is not None:
                                 undefined[itype].append(connected)
                         else:
                             self.ConnectionTypes[variable.connectionPointIn] = itype
-                            if connected is not None and not connected in self.ConnectionTypes:
+                            if connected is not None and connected not in self.ConnectionTypes:
                                 for connection in self.ExtractRelatedConnections(connected):
                                     self.ConnectionTypes[connection] = itype
         for var_type, connections in undefined.items():
@@ -1086,7 +1086,7 @@
                 if one_input_connected:
                     for i, variable in enumerate(output_variables):
                         parameter = variable.getformalParameter()
-                        if not parameter in inout_variables and parameter in output_names + ["", "ENO"]:
+                        if parameter not in inout_variables and parameter in output_names + ["", "ENO"]:
                             if variable.getformalParameter() == "":
                                 variable_name = "%s%d" % (type, block.getlocalId())
                             else:
@@ -1535,7 +1535,7 @@
                                     transition_infos["content"] = [("\n%s:= " % self.CurrentIndent, ())] + expression + [(";\n", ())]
                                     self.SFCComputedBlocks += self.Program
                                     self.Program = []
-                    if not "content" in transition_infos:
+                    if "content" not in transition_infos:
                         raise PLCGenException(
                             _("Transition \"%s\" body must contain an output variable or coil referring to its name")
                             % transitionValues["value"])
--- a/ProjectController.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/ProjectController.py	Sat Aug 19 16:30:15 2017 +0300
@@ -1261,7 +1261,7 @@
 
         elif name is not None and name.find("::") != -1:
             filepath, editor_name = name.split("::")
-            if not filepath in self._FileEditors:
+            if filepath not in self._FileEditors:
                 if os.path.isfile(filepath):
                     file_extension = os.path.splitext(filepath)[1]
 
@@ -1475,7 +1475,7 @@
         to a WeakKeyDictionary linking
         weakly referenced callables
         """
-        if IECPath != "__tick__" and not IECPath in self._IECPathToIdx:
+        if IECPath != "__tick__" and IECPath not in self._IECPathToIdx:
             return None
 
         self.IECdebug_lock.acquire()
@@ -1524,7 +1524,7 @@
         self.ReArmDebugRegisterTimer()
 
     def ForceDebugIECVariable(self, IECPath, fvalue):
-        if not IECPath in self.IECdebug_datas:
+        if IECPath not in self.IECdebug_datas:
             return
 
         self.IECdebug_lock.acquire()
@@ -1539,7 +1539,7 @@
         self.ReArmDebugRegisterTimer()
 
     def ReleaseDebugIECVariable(self, IECPath):
-        if not IECPath in self.IECdebug_datas:
+        if IECPath not in self.IECdebug_datas:
             return
 
         self.IECdebug_lock.acquire()
--- a/editors/TextViewer.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/editors/TextViewer.py	Sat Aug 19 16:30:15 2017 +0300
@@ -499,7 +499,7 @@
                     if blocktype["type"] == "function" and blockname not in self.Keywords and blockname not in self.Variables.keys():
                         interface = dict([(name, {}) for name, type, modifier in blocktype["inputs"] + blocktype["outputs"] if name != ''])
                         for param in ["EN", "ENO"]:
-                            if not param in interface:
+                            if param not in interface:
                                 interface[param] = {}
                         if blockname in self.Functions:
                             self.Functions[blockname]["interface"].update(interface)
--- a/svgui/pyjs/build.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/svgui/pyjs/build.py	Sat Aug 19 16:30:15 2017 +0300
@@ -600,7 +600,7 @@
 
 
 def has_nodeps(mod, deps):
-    if not mod in deps or not deps[mod]:
+    if mod not in deps or not deps[mod]:
         return True
     return False
 
--- a/svgui/pyjs/lib/pyjslib.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/svgui/pyjs/lib/pyjslib.py	Sat Aug 19 16:30:15 2017 +0300
@@ -894,11 +894,11 @@
         return self.items().__iter__()
 
     def setdefault(self, key, default_value):
-        if not key in self:
+        if key not in self:
             self[key] = default_value
 
     def get(self, key, default_=None):
-        if not key in self:
+        if key not in self:
             return default_
         return self[key]
 
--- a/svgui/pyjs/pyjs.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/svgui/pyjs/pyjs.py	Sat Aug 19 16:30:15 2017 +0300
@@ -1546,7 +1546,7 @@
     def parseModule(self, module_name, file_name):
 
         importing = False
-        if not file_name in self.parse_cache:
+        if file_name not in self.parse_cache:
             importing = True
             mod = compiler.parseFile(file_name)
             self.parse_cache[file_name] = mod
--- a/svgui/svgui_server.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/svgui/svgui_server.py	Sat Aug 19 16:30:15 2017 +0300
@@ -55,7 +55,7 @@
         self.inputs[attrname] = value
 
     def getinput(self, attrname, default=None):
-        if not attrname in self.inputs:
+        if attrname not in self.inputs:
             self.inputs[attrname] = default
         return self.inputs[attrname]
 
--- a/xmlclass/xmlclass.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/xmlclass/xmlclass.py	Sat Aug 19 16:30:15 2017 +0300
@@ -929,7 +929,7 @@
         return annotations, children
 
     def AddComplexType(self, typename, infos):
-        if not typename in self.XMLClassDefinitions:
+        if typename not in self.XMLClassDefinitions:
             self.XMLClassDefinitions[typename] = infos
         else:
             raise ValueError("\"%s\" class already defined. Choose another name!" % typename)
@@ -1603,7 +1603,7 @@
     def addMethod(self):
         if infos["type"] == ATTRIBUTE:
             infos["attr_type"] = FindTypeInfos(factory, infos["attr_type"])
-            if not "default" in infos:
+            if "default" not in infos:
                 setattr(self, attr, infos["attr_type"]["initial"]())
         elif infos["type"] == ELEMENT:
             infos["elmt_type"] = FindTypeInfos(factory, infos["elmt_type"])
@@ -1662,7 +1662,7 @@
     choices = dict([(choice["name"], choice) for choice in choice_types])
 
     def setChoiceMethod(self, content_type):
-        if not content_type in choices:
+        if content_type not in choices:
             raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type)
         choices[content_type]["elmt_type"] = FindTypeInfos(factory, choices[content_type]["elmt_type"])
         new_content = choices[content_type]["elmt_type"]["initial"]()
@@ -1676,7 +1676,7 @@
     choices = dict([(choice["name"], choice) for choice in choice_types])
 
     def appendChoiceMethod(self, content_type):
-        if not content_type in choices:
+        if content_type not in choices:
             raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type)
         choices[content_type]["elmt_type"] = FindTypeInfos(factory, choices[content_type]["elmt_type"])
         if maxOccurs == "unbounded" or len(self.content) < maxOccurs:
@@ -1693,7 +1693,7 @@
     choices = dict([(choice["name"], choice) for choice in choice_types])
 
     def insertChoiceMethod(self, index, content_type):
-        if not content_type in choices:
+        if content_type not in choices:
             raise ValueError("Unknown \"%s\" choice type for \"content\"!" % content_type)
         choices[type]["elmt_type"] = FindTypeInfos(factory, choices[content_type]["elmt_type"])
         if maxOccurs == "unbounded" or len(self.content) < maxOccurs:
--- a/xmlclass/xsdschema.py	Sat Aug 19 01:11:27 2017 +0300
+++ b/xmlclass/xsdschema.py	Sat Aug 19 16:30:15 2017 +0300
@@ -186,7 +186,7 @@
         # Extract simple type facets
         for facet in typeinfos.get("facets", []):
             facettype = facet["type"]
-            if not facettype in basetypeinfos["facets"]:
+            if facettype not in basetypeinfos["facets"]:
                 raise ValueError("\"%s\" facet can't be defined for \"%s\" type!" % (facettype, type))
             elif basetypeinfos["facets"][facettype][1]:
                 raise ValueError("\"%s\" facet is fixed on base type!" % facettype)
@@ -296,7 +296,7 @@
 
         # Report not redefined facet from base type to new created type
         for facettype, facetvalue in basetypeinfos["facets"].items():
-            if not facettype in facets:
+            if facettype not in facets:
                 facets[facettype] = facetvalue
 
         # Generate extract value for new created type
@@ -553,7 +553,7 @@
 
 def ReduceExtension(factory, attributes, elements):
     annotations, children = factory.ReduceElements(elements)
-    if not "base" in attributes:
+    if "base" not in attributes:
         raise ValueError("No base type has been defined for extension!")
     extension = {"type": "extension", "attributes": [], "elements": [], "base": attributes["base"], "doc": annotations}
     if len(children) > 0:
@@ -808,7 +808,7 @@
             choices.extend(child["choices"])
         elif child["type"] == "group":
             elmtgroup = factory.FindSchemaElement(child["ref"], ELEMENTSGROUP)
-            if not "choices" in elmtgroup:
+            if "choices" not in elmtgroup:
                 raise ValueError("Only group composed of \"choice\" can be referenced in \"choice\" element!")
             choices_tmp = []
             for choice in elmtgroup["choices"]:
@@ -842,7 +842,7 @@
             sequence.extend(child["elements"])
         elif child["type"] == "group":
             elmtgroup = factory.FindSchemaElement(child["ref"], ELEMENTSGROUP)
-            if not "elements" in elmtgroup or not elmtgroup["order"]:
+            if "elements" not in elmtgroup or not elmtgroup["order"]:
                 raise ValueError("Only group composed of \"sequence\" can be referenced in \"sequence\" element!")
             elements_tmp = []
             for element in elmtgroup["elements"]: