Closed mehdisadeghi closed 8 years ago
@@ master #319 diff @@
==========================================
Files 107 107
Lines 6810 6810
Methods 0 0
Messages 0 0
Branches 806 806
==========================================
Hits 4906 4906
Misses 1867 1867
Partials 37 37
Powered by Codecov. Last update 4e6f557...04616ef
I do not think that there is a need for the check isinstance(DataContainers). It is actualy wrong to do so since wrapper engines could have their own implementation of the DataContainer object. The important thing is to support the api for all CUDS objects as described in the docs.
Furthermore, manually manipulating __base__
is beyond bad. If the need for an isinstance check is anavoidable the we need to have ABCDataContainer
where compatible classes will register
themselves and then isinstance(ABCDataContainer) will be true.
Furthermore, manually manipulating
__base__
is beyond bad
Hmm.. I missed the fact that you are already creating a class at runtime. However, looking at the code DataContainer
should be already part of the base classes since the type function should have done it for you.
DataContainer should be already part of the base classes since the type function should have done it for you
Strange. On my system it didn't work without explicitly setting __bases__
. I'll double check if I'm missing something.
I think that there is a confusion. The result
of the create_data_container is a class type. when checking with isinstance
you should check with result()
you should check with result()
I checked with the instance. However, as you referenced the type
doc, it should be already done by setting the bases tuple. I have definitely made a mistake during my debug. I'll probably close this PR.
I have definitely made a mistake during my debug.
Yes I wanted to say that the instance, class type confusion could be done during the debug session.
This PR is misleading, I close it.
Any class created with
create_data_container
helper function, which is supposed to be subclass ofDataContainer
, will not pass the following check:Solution: add
__bases__
attribute to the created classes