wildcard_match#

jdaviz.utils.wildcard_match(obj, value, choices=None)[source]#

Wrapper that handles both single string and list/tuple of strings as inputs for value.

Returns a list of strings from obj.choices that match the wildcard pattern(s) in value. If no matches are found, returns a list containing value itself.

Note

fnmatch provides support for all Unix style wildcards including *, ?. We do not check for ‘[seq]`` and ‘[!seq]’ because image extensions as we handle them contain brackets.

Parameters:
objobject

An object with attributes choices and potentially multiselect.

valuestr or list or tuple

A string or list/tuple of strings to match against choices. Each string may contain Unix shell-style wildcards.

choiceslist of str, optional

A list of strings to match against. If not provided, obj.choices will be used.

Returns:
list of str

A list of matched strings or value/[value] if no matches found.