Skip to content

Commit 475e6ac

Browse files
committed
Fixed asserts in TopologyUtils
1 parent 9e70816 commit 475e6ac

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Extend/TopologyUtils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class WireExplorer:
4343
Wire traversal
4444
'''
4545
def __init__(self, wire):
46-
assert isinstance(wire, TopoDS_Wire), 'not a TopoDS_Wire'
46+
if not isinstance(wire, TopoDS_Wire):
47+
raise AsssertionError('not a TopoDS_Wire')
4748
self.wire = wire
4849
self.wire_explorer = BRepTools_WireExplorer(self.wire)
4950
self.done = False
@@ -148,7 +149,8 @@ def _loop_topo(self, topologyType, topologicalEntity=None, topologyTypeToAvoid=N
148149
TopAbs_COMPOUND: TopoDS_Compound,
149150
TopAbs_COMPSOLID: TopoDS_CompSolid}
150151

151-
assert topologyType in topoTypes.keys(), '%s not one of %s' % (topologyType, topoTypes.keys())
152+
if topologyType not in topoTypes.keys():
153+
raise AssertionError("%s not one of %s" % (topologyType, topoTypes.keys()))
152154
# use self.myShape if nothing is specified
153155
if topologicalEntity is None and topologyTypeToAvoid is None:
154156
self.topExp.Init(self.myShape, topologyType)
@@ -191,7 +193,7 @@ def faces(self):
191193

192194
def _number_of_topo(self, iterable):
193195
n = 0
194-
for i in iterable:
196+
for _ in iterable:
195197
n += 1
196198
return n
197199

@@ -366,7 +368,7 @@ def edges_from_face(self, face):
366368

367369
def number_of_edges_from_face(self, face):
368370
cnt = 0
369-
for i in self._loop_topo(TopAbs_EDGE, face):
371+
for _ in self._loop_topo(TopAbs_EDGE, face):
370372
cnt += 1
371373
return cnt
372374

0 commit comments

Comments
 (0)