def from_name_re(cls, path:PathOrStr, fnames:FilePathList, pat:str, valid_pct:float=0.2, **kwargs):
        "Create from list of `fnames` in `path` with re expression `pat`."
        pat = re.compile(pat)
        def _get_label(fn):
            if isinstance(fn, Path): fn = fn.as_posix()
            res = pat.search(str(fn))
            assert res,f'Failed to find "{pat}" in "{fn}"'
            return res.group(1)
        return cls.from_name_func(path, fnames, _get_label, valid_pct=valid_pct, **kwargs)
def from_name_re ( cls , path : PathOrStr , fnames : FilePathList , pat : str , valid_pct : float = 0.2 , ** kwargs ) : pat = re . compile ( pat ) def _get_label ( fn ) : if isinstance ( fn , Path ) : fn = fn . as_posix ( ) res = pat . search ( str ( fn ) ) assert res , f'Failed to find "{pat}" in "{fn}"' return res . group ( 1 ) return cls . from_name_func ( path , fnames , _get_label , valid_pct = valid_pct , ** kwargs )
Create from list of `fnames` in `path` with re expression `pat`.