change way to build fake
This commit is contained in:
parent
d2928a38d2
commit
8dd90bc85a
@ -159,12 +159,13 @@ def save_mainOp(obj, mainOp):
|
|||||||
:mainOp: the main operator
|
:mainOp: the main operator
|
||||||
:returns: the same object with the main operation attribute
|
:returns: the same object with the main operation attribute
|
||||||
"""
|
"""
|
||||||
class Fake(type(obj)):
|
#class Fake(type(obj)):
|
||||||
""" The fake class """
|
# """ The fake class """
|
||||||
def __new__(cls, obj):
|
# def __new__(cls, obj):
|
||||||
op = type(obj).__new__(cls, obj)
|
# op = type(obj).__new__(cls, obj)
|
||||||
op.mainOp = mainOp
|
# op.mainOp = mainOp
|
||||||
return op
|
# return op
|
||||||
|
Fake = type('fake_'+str(type(obj)), (type(obj),), {'mainOp': mainOp})
|
||||||
|
|
||||||
return Fake(obj)
|
return Fake(obj)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user