Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix postprocess set of fields in custom class generator #626

Merged
merged 3 commits into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# HDMF Changelog

## HDMF 2.5.7 (June 4, 2021)

### Bug fix
- Fix generation of extension classes that extend MultiContainerInterface and use a custom _fieldsname. @rly (#626)

## HDMF 2.5.6 (May 19, 2021)

### Bug fix
Expand Down
2 changes: 1 addition & 1 deletion src/hdmf/build/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .builders import Builder, DatasetBuilder, GroupBuilder, LinkBuilder, ReferenceBuilder, RegionBuilder
from .classgenerator import CustomClassGenerator
from .classgenerator import CustomClassGenerator, MCIClassGenerator
from .errors import (BuildError, OrphanContainerBuildError, ReferenceTargetNotBuiltError, ContainerConfigurationError,
ConstructError)
from .manager import BuildManager, TypeMap
Expand Down
7 changes: 4 additions & 3 deletions src/hdmf/build/classgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,10 @@ def post_process(cls, classdict, bases, docval_args, spec):
:param spec: The spec for the container class to generate.
"""
# convert classdict['__fields__'] from list to tuple if present
fields = classdict.get(bases[0]._fieldsname)
if fields is not None:
classdict[bases[0]._fieldsname] = tuple(fields)
for b in bases:
fields = classdict.get(b._fieldsname)
if fields is not None and not isinstance(fields, tuple):
classdict[b._fieldsname] = tuple(fields)

# if spec provides a fixed name for this type, remove the 'name' arg from docval_args so that values cannot
# be passed for a name positional or keyword arg
Expand Down