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

[Feature request] Add a glob mechanism for specific_args #50

Closed
adrien-berchet opened this issue Jan 30, 2024 · 0 comments · Fixed by #52
Closed

[Feature request] Add a glob mechanism for specific_args #50

adrien-berchet opened this issue Jan 30, 2024 · 0 comments · Fixed by #52
Labels
enhancement New feature or request

Comments

@adrien-berchet
Copy link
Member

adrien-berchet commented Jan 30, 2024

Describe the feature

It would be nice to be able to write a glob for specific_args.

Example Use

For example we know that all the *.h5 files located in the directory a_directory can not be compared using the HdfComparator (for any reason). In this case one would like to write something like:

        specific_args = {
            "file.yaml": {"args": [None, None, None, False, 0, False]},
            "a_directory/*.h5": {"comparator": DefaultComparator()},
        }
        res = compare_trees(ref_tree, res_tree_equal, specific_args=specific_args)

or like:

        specific_args = {
            "file.yaml": {"args": [None, None, None, False, 0, False]},
            "a_directory": {
                "comparator": DefaultComparator(),
                "extensions": [".h5"],
            },
        }
        res = compare_trees(ref_tree, res_tree_equal, specific_args=specific_args)

or even like:

        specific_args = {
            "file.yaml": {"args": [None, None, None, False, 0, False]},
            "a_directory": {
                "comparator": DefaultComparator(),
                "file_patterns": [".*\.h5"],
            },
        }
        res = compare_trees(ref_tree, res_tree_equal, specific_args=specific_args)

Use cases

This situation can happen each time one want to apply the same comparator to all the files of a given directory. I think the last proposal is the best since it allows to filter the files in a very specific way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant