When customizing in the ObjectMapper the mapping for a constructor argument, the mapping is ignored if the function returns None. E.g.,
@register_map(Sweeps)
class SweepsMap(DynamicTableMap):
@ObjectMapper.constructor_arg('intracellular_recordings')
def intracellular_recordings_arg(self, builder, manager):
return None
will always be ignored. This is due to the following:
|
override = self.__get_override_carg(argname, builder, manager) |
|
if override is not None: |
|
val = override |
|
elif argname in const_args: |
|
val = const_args[argname] |
|
else: |
|
continue |
Here the check if override is not None: is used to check if a constructor argument is overwritten or not. Instead the check should look for whether a custom mapping is defined, rather than using the None return value as an indicator that there is no overwrite.
Proposed solution Add function has_overwrite_carg to check if a constuctor argument is overwritten and use it instead.
Checklist
When customizing in the ObjectMapper the mapping for a constructor argument, the mapping is ignored if the function returns None. E.g.,
will always be ignored. This is due to the following:
hdmf/src/hdmf/build/map.py
Lines 1204 to 1210 in 44c02ea
Here the check
if override is not None:is used to check if a constructor argument is overwritten or not. Instead the check should look for whether a custom mapping is defined, rather than using the None return value as an indicator that there is no overwrite.Proposed solution Add function has_overwrite_carg to check if a constuctor argument is overwritten and use it instead.
Checklist