@@ -32,7 +32,7 @@ def writeOutTriangulation(tri,filebase="mesh",nbase=0,verbose=0):
3232
3333 """
3434 failed = False
35- if tri == None :
35+ if tri is None :
3636 failed = True
3737 return failed
3838 if not nbase in [0 ,1 ]:
@@ -89,7 +89,7 @@ def printNodeFile(nodes,filebase='mesh',attrib=None,markers=None,nbase=0):
8989 Remaining lines: <vertex #> <x> <y> [attributes] [boundary marker]
9090 """
9191 failed = False
92- if nodes == None : #ok to do nothing of nodes is empy
92+ if nodes is None : #ok to do nothing of nodes is empy
9393 return failed
9494 #end empty areas check
9595 if not nbase in [0 ,1 ]:
@@ -109,11 +109,11 @@ def printNodeFile(nodes,filebase='mesh',attrib=None,markers=None,nbase=0):
109109 nvert = nodes .shape [0 ]
110110 sdim = 2
111111 nattrib = 0
112- if attrib != None :
112+ if attrib is not None :
113113 nattrib = attrib .shape [1 ]
114114 #end if
115115 nmarkers = 0
116- if markers != None :
116+ if markers is not None :
117117 nmarkers = 1
118118 #end if
119119 line = """%d %d %d %d \n """ % (nvert ,sdim ,nattrib ,nmarkers )
@@ -143,7 +143,7 @@ def printElemFile(elems,filebase='mesh',attrib=None,nbase=0):
143143 Remaining lines: <triangle #> <node> <node> <node> ... [attributes]
144144 """
145145 failed = False
146- if elems == None : #ok to do nothing of nodes is empy
146+ if elems is None : #ok to do nothing of nodes is empy
147147 return failed
148148 #end empty areas check
149149 if not nbase in [0 ,1 ]:
@@ -164,7 +164,7 @@ def printElemFile(elems,filebase='mesh',attrib=None,nbase=0):
164164 nelem = elems .shape [0 ]
165165 nodesPerTri = elems .shape [1 ] #should be 3 or 6
166166 nattrib = 0
167- if attrib != None :
167+ if attrib is not None :
168168 nattrib = attrib .shape [1 ]
169169 #end if
170170 line = """%d %d %d \n """ % (nelem ,nodesPerTri ,nattrib )
@@ -203,10 +203,10 @@ def printPolyFile(nodes,segments,filebase='mesh',
203203
204204 """
205205 failed = False
206- if nodes == None : #ok to do nothing of nodes is empy
206+ if nodes is None : #ok to do nothing of nodes is empy
207207 return failed
208- if segments == None :
209- if nodes == None :
208+ if segments is None :
209+ if nodes is None :
210210 return failed
211211 else :
212212 failed = True
@@ -237,11 +237,11 @@ def printPolyFile(nodes,segments,filebase='mesh',
237237 nvert = nodes .shape [0 ]
238238 sdim = 2
239239 npattrib = 0
240- if pattrib != None :
240+ if pattrib is not None :
241241 npattrib = pattrib .shape [1 ]
242242 #end if
243243 npmarkers = 0
244- if pmarkers != None :
244+ if pmarkers is not None :
245245 npmarkers = 1
246246 #end if
247247 #write points out
@@ -261,7 +261,7 @@ def printPolyFile(nodes,segments,filebase='mesh',
261261 #write segments out
262262 nsegments = segments .shape [0 ]
263263 nsmarkers = 0
264- if smarkers != None :
264+ if smarkers is not None :
265265 nsmarkers = 1
266266 line = """%d %d \n """ % (nsegments ,nsmarkers )
267267 fout .write (line )
@@ -275,7 +275,7 @@ def printPolyFile(nodes,segments,filebase='mesh',
275275 #end i segment loop
276276
277277 nholes = 0
278- if holes != None :
278+ if holes is not None :
279279 nholes = holes .shape [0 ]
280280 #end if
281281 line = """%d\n """ % nholes
@@ -286,7 +286,7 @@ def printPolyFile(nodes,segments,filebase='mesh',
286286 fout .write (line )
287287 #end i for holes
288288 nregions = 0
289- if regions != None :
289+ if regions is not None :
290290 nregions = regions .shape [0 ]
291291 #end if
292292 line = "#no regions specified"
@@ -317,7 +317,7 @@ def printAreaFile(elemAreas,filebase='mesh',nbase=0):
317317 note, negative area means that the area is unconstrained
318318 """
319319 failed = False
320- if elemAreas == None : #ok to do nothing if elemAreas is empty
320+ if elemAreas is None : #ok to do nothing if elemAreas is empty
321321 return failed
322322 #end elemAreas empty
323323 if not nbase in [0 ,1 ]:
@@ -357,7 +357,7 @@ def printEdgeFile(edges,filebase='mesh',markers=None,nbase=0):
357357 Following lines: <edge #> <endpoint> <endpoint> [boundary marker]
358358 """
359359 failed = False
360- if edges == None : #ok to do nothing if elemAreas is empty
360+ if edges is None : #ok to do nothing if elemAreas is empty
361361 return failed
362362 #end empty arrays check
363363
@@ -377,7 +377,7 @@ def printEdgeFile(edges,filebase='mesh',markers=None,nbase=0):
377377 fout .write (format )
378378 nedges = edges .shape [0 ]
379379 nmarkers = 0
380- if markers != None :
380+ if markers is not None :
381381 nmarkers = 1
382382 #end if
383383 line = """%d %d \n """ % (nedges ,nmarkers )
@@ -404,7 +404,7 @@ def printNeighborFile(neigs,filebase='mesh',nbase=0):
404404 Following lines: <triangle #> <neighbor> <neighbor> <neighbor>
405405 """
406406 failed = False
407- if neigs == None : #ok to do nothing if elemAreas is empty
407+ if neigs is None : #ok to do nothing if elemAreas is empty
408408 return failed
409409 #end
410410 if not nbase in [0 ,1 ]:
@@ -791,12 +791,12 @@ def readPoly(self,filebase,commchar='#',nbase=0,verbose=0):
791791 #end
792792 outputData ['hole' ] = {}
793793 outputData ['hole' ]['holes' ] = None
794- if not holeData == None :
794+ if not holeData is None :
795795 outputData ['hole' ]['holes' ] = holeData [0 ]
796796
797797 outputData ['region' ] = {}
798798 outputData ['region' ]['regions' ] = None
799- if not regionData == None :
799+ if not regionData is None :
800800 outputData ['region' ]['regions' ] = regionData [0 ]
801801
802802 return outputInfo ,outputData
0 commit comments