oruebel / ndx-icephys-meta

NWB extensions for origanizing intracellular electrophysiology metadata
Other
6 stars 0 forks source link

AttributeError: type object 'HierarchicalDynamicTableMixin' has no attribute '_get_fields' #76

Closed luiztauffer closed 3 years ago

luiztauffer commented 4 years ago

Using the latest hdmf-dev, this package will run into this error:

...
  File "c:\users\luiz\documents\github\nwb-jupyter-widgets\nwbwidgets\view.py", line 9, in <module>
    from ndx_icephys_meta.icephys import SweepSequences
  File "C:\Users\Luiz\Anaconda3\envs\env_allen\lib\site-packages\ndx_icephys_meta\__init__.py", line 32, in <module>
    from .icephys import ICEphysFile,  IntracellularRecordings, Sweeps, SweepSequences, Runs, Conditions # noqa E402, F401
  File "C:\Users\Luiz\Anaconda3\envs\env_allen\lib\site-packages\ndx_icephys_meta\icephys.py", line 307, in <module>
    class Sweeps(DynamicTable, HierarchicalDynamicTableMixin):
  File "c:\users\luiz\documents\github\hdmf\src\hdmf\utils.py", line 734, in __init__
    func(name, bases, classdict)
  File "c:\users\luiz\documents\github\hdmf\src\hdmf\container.py", line 122, in __gather_fields
    base_fields = bases[-1]._get_fields()  # tuple of field names from base class
AttributeError: type object 'HierarchicalDynamicTableMixin' has no attribute '_get_fields'

It looks like ndx-icephys-meta is performing an invalid operation with HierarchicalDynamicTableMixin. The problem only happens with the latest changes in hdmf, I guess this _get_fields was substituted by get_fields_conf

bendichter commented 4 years ago

@rly is this the result of your latest change?

rly commented 4 years ago

This looks like a problem with the multiple inheritance in the extension, but we should catch this case in HDMF.

First, I think the new table classes should have the parent class order reversed, so that DynamicTable is the base class.

https://github.com/oruebel/ndx-icephys-meta/blob/f164073c597e716c443558d94b39f02c9e1cc055/src/pynwb/ndx_icephys_meta/icephys.py#L725

Same for: https://github.com/oruebel/ndx-icephys-meta/blob/f164073c597e716c443558d94b39f02c9e1cc055/src/pynwb/ndx_icephys_meta/icephys.py#L778 https://github.com/oruebel/ndx-icephys-meta/blob/f164073c597e716c443558d94b39f02c9e1cc055/src/pynwb/ndx_icephys_meta/icephys.py#L841 https://github.com/oruebel/ndx-icephys-meta/blob/f164073c597e716c443558d94b39f02c9e1cc055/src/pynwb/ndx_icephys_meta/icephys.py#L896

Second, HDMF should not assume that the highest base class (assuming parents are higher than their children) of a class with multiple inheritance is an AbstractContainer. That should be checked.