You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i think we need to rethink the name_source and _gen_filename api.
originally _gen_filename was meant to help auto generate filenames when typically a parameter that corresponded to an output was required. so if the output was Undefined_gen_filename would be called allowing interfaces to determine how the output should be called.
pattern:
undefined value + genfile -> gen_filename -> value
name_source extended this to allow more clever naming of the output name, instead of the defaults that the interface supplied.
patterns:
undefined value + genfile -> gen_filename -> value
'%s' in value & genfile & name_source -> gen_filename from name source -> value
the same function _gen_filename was overloaded to handle both these patterns and i think that every place where _gen_filename was used was not checked.
there are two solutions:
keep the single function, but go through every single one of them to ensure that they are behaving appropriately. make sure to write a test for these.
refine the function.
a. you cannot specify name_source without genfile
b. all overloaded _gen_filename functions have to call the base class function whenever
they don't deal with that name
create two separate functions: _filename_from_source and _gen_filename
see the PR for details on option 3.
The text was updated successfully, but these errors were encountered:
there could be also the option to have only name_source and in case the value is required the use_default_value should be set to True and a default value/template provided. This way in the case it is not defined the default template is used and this avoid writing _gen_filename in each interface with a lot of if elif to deal with each option. I think this should be managed as much as possible in the traits specification and handled in generic function of the BaseInterface class.
i think that's what we will head towards given the refactoring, but we have a lot of interfaces to go through and make sure that we are not breaking anything. especially given that we don't have actual running tests for these interfaces.
i think we need to rethink the
name_source
and_gen_filename
api.originally
_gen_filename
was meant to help auto generate filenames when typically a parameter that corresponded to an output was required. so if the output wasUndefined
_gen_filename
would be called allowing interfaces to determine how the output should be called.pattern:
name_source
extended this to allow more clever naming of the output name, instead of the defaults that the interface supplied.patterns:
the same function
_gen_filename
was overloaded to handle both these patterns and i think that every place where_gen_filename
was used was not checked.there are two solutions:
keep the single function, but go through every single one of them to ensure that they are behaving appropriately. make sure to write a test for these.
refine the function.
a. you cannot specify
name_source
withoutgenfile
b. all overloaded
_gen_filename
functions have to call the base class function wheneverthey don't deal with that name
create two separate functions:
_filename_from_source
and_gen_filename
see the PR for details on option 3.
The text was updated successfully, but these errors were encountered: