Fix TypeError: unorderable types: EnumItem() < EnumItem()

This commit is contained in:
Gilles DAVID 2017-05-04 18:34:49 +02:00
parent e8173b4ff1
commit f782dacab1

View File

@ -219,31 +219,31 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo, mesh):
pass pass
reason = "" reason = ""
if hasattr( status, "__getitem__" ): if hasattr( status, "__getitem__" ):
status,reason = status[0],status[1] status, reason = status[0]._v, status[1]
if status == HYP_UNKNOWN_FATAL : if status == HYP_UNKNOWN_FATAL._v:
reason = "for unknown reason" reason = "for unknown reason"
elif status == HYP_INCOMPATIBLE : elif status == HYP_INCOMPATIBLE._v:
reason = "this hypothesis mismatches the algorithm" reason = "this hypothesis mismatches the algorithm"
elif status == HYP_NOTCONFORM : elif status == HYP_NOTCONFORM._v:
reason = "a non-conform mesh would be built" reason = "a non-conform mesh would be built"
elif status == HYP_ALREADY_EXIST : elif status == HYP_ALREADY_EXIST._v:
if isAlgo: return # it does not influence anything if isAlgo: return # it does not influence anything
reason = hypType + " of the same dimension is already assigned to this shape" reason = hypType + " of the same dimension is already assigned to this shape"
elif status == HYP_BAD_DIM : elif status == HYP_BAD_DIM._v:
reason = hypType + " mismatches the shape" reason = hypType + " mismatches the shape"
elif status == HYP_CONCURENT : elif status == HYP_CONCURENT._v:
reason = "there are concurrent hypotheses on sub-shapes" reason = "there are concurrent hypotheses on sub-shapes"
elif status == HYP_BAD_SUBSHAPE : elif status == HYP_BAD_SUBSHAPE._v:
reason = "the shape is neither the main one, nor its sub-shape, nor a valid group" reason = "the shape is neither the main one, nor its sub-shape, nor a valid group"
elif status == HYP_BAD_GEOMETRY: elif status == HYP_BAD_GEOMETRY._v:
reason = "the algorithm is not applicable to this geometry" reason = "the algorithm is not applicable to this geometry"
elif status == HYP_HIDDEN_ALGO: elif status == HYP_HIDDEN_ALGO._v:
reason = "it is hidden by an algorithm of an upper dimension, which generates elements of all dimensions" reason = "it is hidden by an algorithm of an upper dimension, which generates elements of all dimensions"
elif status == HYP_HIDING_ALGO: elif status == HYP_HIDING_ALGO._v:
reason = "it hides algorithms of lower dimensions by generating elements of all dimensions" reason = "it hides algorithms of lower dimensions by generating elements of all dimensions"
elif status == HYP_NEED_SHAPE: elif status == HYP_NEED_SHAPE._v:
reason = "algorithm can't work without shape" reason = "algorithm can't work without shape"
elif status == HYP_INCOMPAT_HYPS: elif status == HYP_INCOMPAT_HYPS._v:
pass pass
else: else:
return return
@ -254,7 +254,7 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo, mesh):
meshName = GetName( mesh ) meshName = GetName( mesh )
if meshName and meshName != NO_NAME: if meshName and meshName != NO_NAME:
where = '"%s" shape in "%s" mesh ' % ( geomName, meshName ) where = '"%s" shape in "%s" mesh ' % ( geomName, meshName )
if status < HYP_UNKNOWN_FATAL and where: if status < HYP_UNKNOWN_FATAL._v and where:
print('"%s" was assigned to %s but %s' %( hypName, where, reason )) print('"%s" was assigned to %s but %s' %( hypName, where, reason ))
elif where: elif where:
print('"%s" was not assigned to %s : %s' %( hypName, where, reason )) print('"%s" was not assigned to %s : %s' %( hypName, where, reason ))
@ -1484,18 +1484,18 @@ class Mesh(metaclass=MeshMeta):
name = err.algoName name = err.algoName
if len(name) == 0: if len(name) == 0:
reason = '%s %sD algorithm is missing' % (glob, dim) reason = '%s %sD algorithm is missing' % (glob, dim)
elif err.state == HYP_MISSING: elif err.state._v == HYP_MISSING._v:
reason = ('%s %sD algorithm "%s" misses %sD hypothesis' reason = ('%s %sD algorithm "%s" misses %sD hypothesis'
% (glob, dim, name, dim)) % (glob, dim, name, dim))
elif err.state == HYP_NOTCONFORM: elif err.state._v == HYP_NOTCONFORM._v:
reason = 'Global "Not Conform mesh allowed" hypothesis is missing' reason = 'Global "Not Conform mesh allowed" hypothesis is missing'
elif err.state == HYP_BAD_PARAMETER: elif err.state._v == HYP_BAD_PARAMETER._v:
reason = ('Hypothesis of %s %sD algorithm "%s" has a bad parameter value' reason = ('Hypothesis of %s %sD algorithm "%s" has a bad parameter value'
% ( glob, dim, name )) % ( glob, dim, name ))
elif err.state == HYP_BAD_GEOMETRY: elif err.state._v == HYP_BAD_GEOMETRY._v:
reason = ('%s %sD algorithm "%s" is assigned to mismatching' reason = ('%s %sD algorithm "%s" is assigned to mismatching'
'geometry' % ( glob, dim, name )) 'geometry' % ( glob, dim, name ))
elif err.state == HYP_HIDDEN_ALGO: elif err.state._v == HYP_HIDDEN_ALGO._v:
reason = ('%s %sD algorithm "%s" is ignored due to presence of a %s ' reason = ('%s %sD algorithm "%s" is ignored due to presence of a %s '
'algorithm of upper dimension generating %sD mesh' 'algorithm of upper dimension generating %sD mesh'
% ( glob, dim, name, glob, dim )) % ( glob, dim, name, glob, dim ))
@ -1719,7 +1719,7 @@ class Mesh(metaclass=MeshMeta):
AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName()) AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName())
status = self.mesh.AddHypothesis(geom, hyp) status = self.mesh.AddHypothesis(geom, hyp)
else: else:
status = HYP_BAD_GEOMETRY,"" status = HYP_BAD_GEOMETRY, ""
hyp_name = GetName( hyp ) hyp_name = GetName( hyp )
geom_name = "" geom_name = ""
if geom: if geom: