mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
22465: [CEA] sometimes isinstance(m, Mesh) returns False for Mesh objects // PPGP pb
class MeshMeta(type): def __instancecheck__(cls, inst): """Implement isinstance(inst, cls).""" return any(cls.__subclasscheck__(c) for c in {type(inst), inst.__class__}) def __subclasscheck__(cls, sub): """Implement issubclass(sub, cls).""" return type.__subclasscheck__(cls, sub) or (cls.__name__ == sub.__name__ and cls.__module__ == sub.__module__) ... class Mesh: __metaclass__ = MeshMeta ...
This commit is contained in:
parent
cc9e7d5442
commit
fce720f2d2
@ -93,6 +93,16 @@ import SALOME
|
|||||||
import SALOMEDS
|
import SALOMEDS
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
class MeshMeta(type):
|
||||||
|
def __instancecheck__(cls, inst):
|
||||||
|
"""Implement isinstance(inst, cls)."""
|
||||||
|
return any(cls.__subclasscheck__(c)
|
||||||
|
for c in {type(inst), inst.__class__})
|
||||||
|
|
||||||
|
def __subclasscheck__(cls, sub):
|
||||||
|
"""Implement issubclass(sub, cls)."""
|
||||||
|
return type.__subclasscheck__(cls, sub) or (cls.__name__ == sub.__name__ and cls.__module__ == sub.__module__)
|
||||||
|
|
||||||
## @addtogroup l1_auxiliary
|
## @addtogroup l1_auxiliary
|
||||||
## @{
|
## @{
|
||||||
|
|
||||||
@ -1144,6 +1154,7 @@ def New( study, instance=None):
|
|||||||
# new nodes and elements and by changing the existing entities), to get information
|
# new nodes and elements and by changing the existing entities), to get information
|
||||||
# about a mesh and to export a mesh into different formats.
|
# about a mesh and to export a mesh into different formats.
|
||||||
class Mesh:
|
class Mesh:
|
||||||
|
__metaclass__ = MeshMeta
|
||||||
|
|
||||||
geom = 0
|
geom = 0
|
||||||
mesh = 0
|
mesh = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user