[Bug]: Auto-generating MultiContainerInterface subclasses #959
Labels
category: bug
errors in the code or code behavior
priority: medium
non-critical problem and/or affecting only a small set of users
What happened?
First alerted in #948, there is a bug from auto-generating class that inherits from
MultiContainerInterface
. In this example,PlaneExtension
extendsPlaneSegmentation
, which inherits fromMultiContainerInterface
(you can see this in the schema withreference_images
having quantity*
. With extensions, NWBInspector does not see the python class definitions and will autogenerate the class from the schema. In this example,PlaneExtension
is auto-generated.PlaneExtension
inherits from bothMultiContainerInterface
and fromPlaneSegmentation
, which is aDynamicTable
.Within
DynamicTable
is a pre-init method_gather_columns
that uses the base classes in a conditional to create pre-defined columns. When autogenerating a class, the order of these classes are determined in lines 377-385 of classgenerator.pySince
MultiContainerInterface
is not a sub-class ofDynamicTable
(bases[0]), we insert at index 1.Within
gather_columns
, we checkSuch that bases[-1] (the last base in this case would be
MultiContainerInterface
) is assumed to be aDynamicTable
and checks for columns. This returns the error:AttributeError: type object 'MultiContainerInterface' has no attribute '__columns__'
To fix this, the search for DynamicTable should be agnostic to the order of the bases.
Steps to Reproduce
# Run the extension or un-register a class.
Traceback
No response
Operating System
macOS
Python Executable
Python
Python Version
3.10
Package Versions
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: