in cbmc_viewer/sourcet.py [0:0]
def select_source_files(files, root, exclude=None, extensions=None):
"""Return source files from a list of files under root.
Return absolute paths to the source files in a list of files.
Files in the list are paths relative to root. Exclude from the
list files matching the regular expression 'exclude'. Select from
the list files with file extensions matching the regular
expression 'extensions'.
"""
files = [os.path.normpath(path) for path in files]
if exclude is not None:
files = [path for path in files
if not re.match(exclude, path, re.I)]
if extensions is not None:
files = [path for path in files
if re.match(extensions, os.path.splitext(path)[1], re.I)]
files = [os.path.join(root, path) for path in files]
return files