MCPcopy Index your code
hub / github.com/nodejs/node / _ExpandDirectories

Function _ExpandDirectories

tools/cpplint.py:7949–7975  ·  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

7947
7948
7949def _ExpandDirectories(filenames):
7950 """Searches a list of filenames and replaces directories in the list with
7951 all files descending from those directories. Files with extensions not in
7952 the valid extensions list are excluded.
7953
7954 Args:
7955 filenames: A list of files or directories
7956
7957 Returns:
7958 A list of all files that are members of filenames or descended from a
7959 directory in filenames
7960 """
7961 expanded = set()
7962 for filename in filenames:
7963 if not os.path.isdir(filename):
7964 expanded.add(filename)
7965 continue
7966
7967 for root, _, files in os.walk(filename):
7968 for loopfile in files:
7969 fullname = os.path.join(root, loopfile)
7970 fullname = fullname.removeprefix("." + os.path.sep)
7971 expanded.add(fullname)
7972
7973 return [
7974 filename for filename in expanded if os.path.splitext(filename)[1][1:] in GetAllExtensions()
7975 ]
7976
7977
7978def _FilterExcludedFiles(fnames):

Callers 1

ParseArgumentsFunction · 0.85

Calls 5

GetAllExtensionsFunction · 0.85
walkMethod · 0.80
addMethod · 0.65
setFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…