Skip to content

name_source and _gen_filename #573

Closed
@satra

Description

@satra

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:

  1. 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.

  2. 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

  3. create two separate functions: _filename_from_source and _gen_filename

see the PR for details on option 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions