Skip to content

Commit

Permalink
Fix postprocess set of fields in custom class generator (#626)
Browse files Browse the repository at this point in the history
* Fix postprocess set of fields in custom class generator

* Update changelog

* Update changelog
  • Loading branch information
rly committed Jul 6, 2021
1 parent b76fa73 commit c4a28c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
-
-

## 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

0 comments on commit c4a28c0

Please sign in to comment.