MCPcopy Index your code
hub / github.com/cpplint/cpplint / _ExpandDirectories

Function _ExpandDirectories

cpplint.py:7798–7824  ·  view source on GitHub ↗

Searches a list of filenames and replaces directories in the list with all files descending from those directories. Files with extensions not in the valid extensions list are excluded. Args: filenames: A list of files or directories Returns: A list of all files that are

(filenames)

Source from the content-addressed store, hash-verified

7796
7797
7798def _ExpandDirectories(filenames):
7799 """Searches a list of filenames and replaces directories in the list with
7800 all files descending from those directories. Files with extensions not in
7801 the valid extensions list are excluded.
7802
7803 Args:
7804 filenames: A list of files or directories
7805
7806 Returns:
7807 A list of all files that are members of filenames or descended from a
7808 directory in filenames
7809 """
7810 expanded = set()
7811 for filename in filenames:
7812 if not os.path.isdir(filename):
7813 expanded.add(filename)
7814 continue
7815
7816 for root, _, files in os.walk(filename):
7817 for loopfile in files:
7818 fullname = os.path.join(root, loopfile)
7819 fullname = fullname.removeprefix("." + os.path.sep)
7820 expanded.add(fullname)
7821
7822 return [
7823 filename for filename in expanded if os.path.splitext(filename)[1][1:] in GetAllExtensions()
7824 ]
7825
7826
7827def _FilterExcludedFiles(fnames):

Callers 1

ParseArgumentsFunction · 0.85

Calls 1

GetAllExtensionsFunction · 0.85

Tested by

no test coverage detected