Fix various 'testing inequality to None' syntax issues
Substitute `is not None` for `!= None`
This commit is contained in:
@@ -142,7 +142,7 @@ class TemplatePyMod_Cmd4:
|
||||
FreeCAD.Console.PrintError('TemplatePyMod_Cmd4 was destroyed\n')
|
||||
|
||||
def Activated(self):
|
||||
if FreeCADGui.ActiveDocument != None:
|
||||
if FreeCADGui.ActiveDocument is not None:
|
||||
self.sc.enter()
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning('A 3d view must be created\n')
|
||||
|
||||
@@ -47,7 +47,7 @@ class DocumentBasicCases(unittest.TestCase):
|
||||
def testCreateDestroy(self):
|
||||
#FIXME: Causes somehow a ref count error but it's _not_ FreeCAD.getDocument()!!!
|
||||
#If we remove the whole method no error appears.
|
||||
self.failUnless(FreeCAD.getDocument("CreateTest")!= None,"Creating Document failed")
|
||||
self.failUnless(FreeCAD.getDocument("CreateTest") is not None,"Creating Document failed")
|
||||
|
||||
def testAddition(self):
|
||||
# Cannot write a real test case for that but when debugging the
|
||||
@@ -1092,7 +1092,7 @@ class DocumentGroupCases(unittest.TestCase):
|
||||
self.Doc.commitTransaction()
|
||||
self.failUnless(G1.getObject("Label_2") is None)
|
||||
self.Doc.undo()
|
||||
self.failUnless(G1.getObject("Label_2") != None)
|
||||
self.failUnless(G1.getObject("Label_2") is not None)
|
||||
|
||||
# Remove first group and then the object
|
||||
self.Doc.openTransaction("Remove")
|
||||
@@ -1100,7 +1100,7 @@ class DocumentGroupCases(unittest.TestCase):
|
||||
self.Doc.removeObject("Label_2")
|
||||
self.Doc.commitTransaction()
|
||||
self.Doc.undo()
|
||||
self.failUnless(G1.getObject("Label_2") != None)
|
||||
self.failUnless(G1.getObject("Label_2") is not None)
|
||||
|
||||
# Remove first object and then the group in two transactions
|
||||
self.Doc.openTransaction("Remove")
|
||||
@@ -1112,7 +1112,7 @@ class DocumentGroupCases(unittest.TestCase):
|
||||
self.Doc.commitTransaction()
|
||||
self.Doc.undo()
|
||||
self.Doc.undo()
|
||||
self.failUnless(G1.getObject("Label_2") != None)
|
||||
self.failUnless(G1.getObject("Label_2") is not None)
|
||||
|
||||
# Remove first object and then the group in one transaction
|
||||
self.Doc.openTransaction("Remove")
|
||||
@@ -1122,7 +1122,7 @@ class DocumentGroupCases(unittest.TestCase):
|
||||
self.Doc.commitTransaction()
|
||||
self.Doc.undo()
|
||||
# FIXME: See bug #1820554
|
||||
self.failUnless(G1.getObject("Label_2") != None)
|
||||
self.failUnless(G1.getObject("Label_2") is not None)
|
||||
|
||||
# Add a second object to the group
|
||||
L3 = self.Doc.addObject("App::FeatureTest","Label_3")
|
||||
@@ -1135,8 +1135,8 @@ class DocumentGroupCases(unittest.TestCase):
|
||||
self.Doc.removeObject("Group")
|
||||
self.Doc.commitTransaction()
|
||||
self.Doc.undo()
|
||||
self.failUnless(G1.getObject("Label_3") != None)
|
||||
self.failUnless(G1.getObject("Label_2") != None)
|
||||
self.failUnless(G1.getObject("Label_3") is not None)
|
||||
self.failUnless(G1.getObject("Label_2") is not None)
|
||||
|
||||
self.Doc.UndoMode = 0
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ class TestDeleteMenuCmd:
|
||||
class TestInsertFeatureCmd:
|
||||
"Base test commando object"
|
||||
def Activated(self):
|
||||
if FreeCAD.activeDocument() != None:
|
||||
if FreeCAD.activeDocument() is not None:
|
||||
FreeCAD.activeDocument().addObject("App::FeatureTest")
|
||||
else:
|
||||
FreeCAD.PrintMessage("No active document.\n")
|
||||
|
||||
@@ -212,7 +212,7 @@ def build_deps_graph(graph, bundle_path, dirs_filter=None, search_paths=[]):
|
||||
visited = {}
|
||||
|
||||
for root, dirs, files in os.walk(bundle_path):
|
||||
if dirs_filter != None:
|
||||
if dirs_filter is not None:
|
||||
dirs[:] = [d for d in dirs if should_visit(bundle_path, dirs_filter,
|
||||
os.path.join(root, d))]
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ d=dict()
|
||||
l=list()
|
||||
for line in lines:
|
||||
r=re.search("\\(#\\s*\\d+\\)",line)
|
||||
if r != None:
|
||||
if r is not None:
|
||||
s=line[r.start():r.end()]
|
||||
t=re.search("^Leak",line)
|
||||
if t != None:
|
||||
if t is not None:
|
||||
m=d[s]
|
||||
l.append(m)
|
||||
else:
|
||||
|
||||
@@ -97,7 +97,7 @@ class DebianChangelog(VersionControl):
|
||||
c = f.readline()
|
||||
f.close()
|
||||
r=re.search("bzr(\\d+)",c)
|
||||
if r != None:
|
||||
if r is not None:
|
||||
self.rev = r.groups()[0] + " (Launchpad)"
|
||||
|
||||
t = time.localtime()
|
||||
@@ -116,11 +116,11 @@ class BazaarControl(VersionControl):
|
||||
lines=info.split("\n")
|
||||
for i in lines:
|
||||
r = re.match("^revno: (\\d+)$", i)
|
||||
if r != None:
|
||||
if r is not None:
|
||||
self.rev = r.groups()[0]
|
||||
continue
|
||||
r=re.match("^timestamp: (\\w+ \\d+-\\d+-\\d+ \\d+:\\d+:\\d+)",i)
|
||||
if r != None:
|
||||
if r is not None:
|
||||
self.date = r.groups()[0]
|
||||
continue
|
||||
return True
|
||||
@@ -325,7 +325,7 @@ class GitControl(VersionControl):
|
||||
self.date = time.strftime("%Y/%m/%d %H:%M:%S",time.gmtime(\
|
||||
float(info.strip().split(' ',1)[0])))
|
||||
for self.branch in os.popen("git branch --no-color").read().split('\n'):
|
||||
if re.match( "\*", self.branch ) != None:
|
||||
if re.match( "\*", self.branch ) is not None:
|
||||
break
|
||||
self.branch=self.branch[2:]
|
||||
self.getremotes() #setup self.remotes and branchlst
|
||||
@@ -356,7 +356,7 @@ class GitControl(VersionControl):
|
||||
if self.url == "Unknown":
|
||||
for i in info:
|
||||
r = re.match("origin\\W+(\\S+)",i)
|
||||
if r != None:
|
||||
if r is not None:
|
||||
self.url = r.groups()[0]
|
||||
break
|
||||
return True
|
||||
@@ -421,12 +421,12 @@ class Subversion(VersionControl):
|
||||
|
||||
# if version string ends with an 'M'
|
||||
r=re.search("M$",Ver)
|
||||
if r != None:
|
||||
if r is not None:
|
||||
self.mods = 'Src modified'
|
||||
|
||||
# if version string contains a range
|
||||
r=re.match("^\\d+\\:\\d+",Ver)
|
||||
if r != None:
|
||||
if r is not None:
|
||||
self.mixed = 'Src mixed'
|
||||
self.range = Ver[:r.end()]
|
||||
return True
|
||||
|
||||
@@ -225,7 +225,7 @@ public:
|
||||
-
|
||||
//@}
|
||||
|
||||
+ if(self.export.CustomAttributes != None):
|
||||
+ if(self.export.CustomAttributes is not None):
|
||||
/// getter method for special attributes (e.g. dynamic ones)
|
||||
PyObject *getCustomAttributes(const char* attr) const;
|
||||
/// setter for special attributes (e.g. dynamic ones)
|
||||
@@ -720,7 +720,7 @@ PyObject *@self.export.Name@::_repr()
|
||||
return Py_BuildValue("s", representation().c_str());
|
||||
}
|
||||
|
||||
+ if(self.export.CustomAttributes != None):
|
||||
+ if(self.export.CustomAttributes is not None):
|
||||
//--------------------------------------------------------------------------
|
||||
// @self.export.Name@ Attributes
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -1119,7 +1119,7 @@ void @self.export.Name@::set@i.Name@(Py::@i.Parameter.Type@ arg)
|
||||
}
|
||||
-
|
||||
-
|
||||
+ if(self.export.CustomAttributes != None):
|
||||
+ if(self.export.CustomAttributes is not None):
|
||||
|
||||
PyObject *@self.export.Name@::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
@@ -1446,7 +1446,7 @@ void @self.export.Name@::set@i.Name@(Py::@i.Parameter.Type@ /*arg*/)
|
||||
}
|
||||
-
|
||||
-
|
||||
+ if(self.export.CustomAttributes != None):
|
||||
+ if(self.export.CustomAttributes is not None):
|
||||
|
||||
PyObject *@self.export.Name@::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user