I have a folder that need to contain certain files that contains magic in their name so i have a list of all the files with os.listdir(sstable_dir_path) and i have a list of regexes that one of them supposed to match one of those filenames. is there any way to do so without a nested for?
SSTABLE_FILENAMES_REGEXES = [re.compile(r'md-\d+-big-CompressionInfo.db'), re.compile(r'md-\d+-big-Data.db'),
re.compile(r'md-\d+-big-Digest.crc32'), re.compile(r'md-\d+-big-Filter.db'),
re.compile(r'md-\d+-big-Index.db'), re.compile(r'md-\d+-big-Statistics.db'),
re.compile(r'md-\d+-big-Summary.db'), re.compile(r'md-\d+-big-TOC.txt')]
filenames example:
md-146-big-CompressionInfo.db
md-146-big-Data.db
md-146-big-Digest.crc32
md-146-big-Filter.db
md-146-big-Index.db
md-146-big-Statistics.db
md-146-big-Summary.db
md-146-big-TOC.txt
how i currently do it
all([any([regex.fullmatch(fillename) for regex in SSTABLE_FILENAMES_REGEXES]) for fillename in os.listdir(sstable_dir_path)])